If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Computers and the Internet>Unit 3

The Internet Protocol (IP) is one of the core protocols in the layers of the Internet, as you might guess from its name. It's used in all Internet communication to handle both addressing and routing.
The protocol describes the use of IP addresses to uniquely identify Internet-connected devices. Just like homes need mailing addresses to receive mail, Internet-connected devices need an IP address to receive messages.
When a computer sends a message to another computer, it must specify the recipient's IP address and also include its own IP address so that the second computer can reply.

There are actually two versions of the Internet Protocol in use today:
• IPv4, the first version ever used on the Internet
• IPv6, a backwards-compatible successor
In the IPv4 protocol, IP addresses look like this:
$\text{74.125.20.113}$
🔍Try visiting that IP in your browser. Where does it go?
Each IP address is split into $4$ numbers, and each of those numbers can range from $0$ to $255$:
$\text{[0-255].[0-255].[0-255].[0-255]}$
We write those numbers in decimal, but the computer stores them in binary, like so:
$\text{01010101 01010101 01010101 01010101}$
Each number can represent ${2}^{8}$ values, thanks to the $8$ bits. That's also why we often call them "octets."
Overall, that's ${2}^{32}$ possible values: $4,294,967,296$ possible IPv4 addresses.
That's a lot! But remember, in the beginning, we said there are more than four billion devices connected to the Internet? Well, we're reaching the limit of possible IP addresses. It's time for plan B.

Back when the Internet protocols were first invented, the creators didn't anticipate how popular it would become and that there would eventually be more than ${2}^{32}$ devices wanting to connect to the Internet.
When it became obvious in the 1990s that the IPv4 addresses were running out, the IPv6 protocol was proposed with a much longer addressing scheme.
$\text{2001:0db8:0000:0042:0000:8a2e:0370:7334}$
Notice the letters in those numbers, like $\text{d}$ and $\text{b}$ in $\text{0db8}$? Those are hexadecimal numbers, which means that the IPv6 address is much longer than it looks. Let's do some math to see exactly how much longer.
There are $8$ hexadecimal numbers, and each number is $4$ digits long. The highest value for each number is $\text{FFFF}$, since $\text{F}$ is the highest digit in hexadecimal. Thus, the highest address would look like:
$\text{FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF}$
What's $\text{FFFF}$ in decimal?
$\text{F}$$\text{F}$$\text{F}$$\text{F}$
${16}^{3}$${16}^{2}$${16}^{1}$${16}^{0}$
$4096$$256$$16$$1$
Each $\text{F}$ represents $15$ in decimal, so that's $\left(15×4096\right)+\left(15×256\right)+\left(15×16\right)+\left(15×1\right)$: a grand total of $65,535$.
We can also calculate that based on the binary representation of $\text{FFFF}$. Each hexadecimal digit $\text{F}$ corresponds to $1111$ in binary, so that results in these $16$ bits:
$\text{1111 1111 1111 1111}$
As we discuss in Binary numbers, the highest number that can be represented by $n$ binary digits is ${2}^{n}-1$. That means the binary number above is ${2}^{16}-1$, which once again equals $65,535$.
Each 4-digit hexadecimal number can range between $0$ and $65,535$, so each number can represent $65,536$ unique values—and there are $8$ of them!
In total, each IP v6 address is represented by $128$ bits, so there are ${2}^{128}$ possible IP v6 addresses. That's $340$ undecillion:
$340,282,366,920,938,000,000,000,000,000,000,000,000$
🤔 Imagine a world where we have that many Internet connected devices. What does that look like? How could that much Internet usage make the world better?

Your IP address might be different tomorrow than it is today. Each ISP has a range of addresses they can assign, and they might give you a different one of those addresses each time they see your computer pop up on the network. That's called a dynamic IP address.
Switching to a different Wi-Fi network will definitely give you a new IP address, since each Wi-Fi provider has its own range of addresses that it can give out.
Computers that act as servers, like the computers that power Google.com, often have static IP addresses. That makes it easier for computers to quickly send search requests to the Google servers. If you tried out the IP address above, you hopefully found yourself on the Google homepage.
Identify whether each address below is IPv4, IPv6, or invalid:
$\text{119.67.44.86}$
$\text{94.49.190.138}$
$\text{258.151.50.253}$
$\text{e0f8:af58:eee6:52b}$
$\text{d938:2da7:b596:6d34:3970:6789:c941:2340}$
$\text{d938:2da7:b596:6d3:3970:6789}$

## Want to join the conversation?

• Hey there! I don't think you mentioned before what an ISP is...I'm kinda curious :)
• ISP is an acronym for Internet Service Provider. In other words, the company you buy internet service from.
• if internet is free that means anyone can connect through it i always wonder why we need to pay money in order to access internet
• let's put this in a different analogy:

when you buy a house or a car, you are given the keys, right? without the keys, you don't have the car or house. same with networking, if you don't have the necessary devices to form the bridge between you and the internet, no internet. the product is free, sitting there, your paying for the keys.
• I had a couple questions about IPv6. How is it backwards compatible (I wasn't sure what they meant by that)? Does that simply mean it will still work within the IP protocol? Also, if hexadecimal is base 16 (as opposed to base 2 or base 10), then why does F represent 15 instead of 16?
• Yes, backwards compatibility means that the new IP address system will still work with the old IP address system.

Hexadecimal is base 16 because there are 16 possible values: the numbers 0 through 9, plus the first six letters of the alphabet.
• I often come accross the crime shows in which a suspect is caught through his IP address, how will that be possible if IP addresss are so dynamic?
• IP addresses won't be able to pinpoint your exact location, however, you may be able to use them to trace your location to the correct town or a short radius. This is because ISPs operate within certain locations and are assigned a range of IP addresses. The ISP usually further subdivides the assigned IP address range for different locations.
• In the "What's Your IP Address section, it says, "Each ISP has a range of addresses they can assign, and they might give you a different one of those addresses each time they see your computer pop up on the network." Does this meant that every time you use the internet your IP address changes or that it changes every time you connect to that Internet? For example, if I am not using my computer, but the wifi is still connected, am I still on the network. Secondly, what's the difference between wifi and internet?
• Most people connect to the internet using a router and so the IP address doesn't change as often, because the router stays connected to the internet and so you keep your IP until the ISP resets the connection (or the router runs a reset).

Wifi is a protocol your computer uses to connect two systems (in your cases probably your computer and your router). Wifi is what you use to connect to the internet.
• In the "What's Your IP Address" section, it says that IP addresses change often. Do Internet Service Providers just cycle through their given range of numbers? Also, is it safe to look up your IP address? If so, how? Are there any possible dangers to doing so? Thanks
• Each ISP has a pool of IP addresses from which it can dynamically assign you one (using the DHPC: dynamic host configuration protocol). Once you stopped using yours, it can be assigned to someone else.

Looking up your IP shouldn't pose any dangers. If you visit a site they can see your IP anyway and in many cases that site will even record it.

There programs that can be used (e.g. ifconfig), but the easiest way to get it is to just write "Whats my IP?" in your search engine of choice.