Main content
Course: Archived AP CSP content > Unit 1
Lesson 3: Archived Scalable Internet addressingIP addresses
The Internet Protocol (IP) describes how two computers can communicate with each other, and it's used by every computer on the Internet.
Each computer has an IP address, just like homes and companies have mail addresses.
When a computer sends a message to another computer, it specifies the recipient's address and also makes sure to include its own address, so that the second computer can reply.
IP v4 addresses
In the IP v4 protocol, IP addresses look like this:
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 number can range from
0
to 255
:[0-255].[0-255].[0-255].[0-255]
We write those numbers in decimal, but to the computer, they're represented with bits, like so:
01010101 01010101 01010101 01010101
Each number can represent values, thanks to the 8 bits. That's also why we often call them "octets."
Overall, that's possible values: possible IPv4 addresses.
That's a lot! But remember, in the beginning, we said there are more than 4 billion devices connected to the Internet? Well, we're reaching the limit of possible IP addresses. It's time for plan B.
IP v6 addresses
Back when they invented the Internet, they didn't anticipate how popular it'd become and they thought that 4 billion would be plenty.
That's what led to the IPv6 protocol, a new addressing scheme. Here's an IPv6 address:
2001:0db8:0000:0042:0000:8a2e:0370:7334
Notice the letters in those numbers, like
d
and b
in 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 , since is the highest digit in hexadecimal. Thus, the highest address would look like:
FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF
What's in decimal?
Each represents 15 in decimal, so that's : a grand total of .
We can also calculate that based on the bit representation of . Each hexadecimal digit corresponds to in binary, so that results in these 16 bits:
1111 1111 1111 1111
As we discuss in Binary numbers, the highest number that can be represented by binary digits is . That means the binary number above is , which once again equals .
Each 4-digit hexadecimal number can range between and , so each number can represent unique values—and there are 8 of them!
In total, each IP v6 address is represented by 128 bits, so there are possible IP v6 addresses. That's 340 undecillion:
🤔 Imagine a world where we have that many Internet connected devices. What does that look like? How could that much Internet make the world better?
Hierarchical addressing
Many addressing schemes are hierarchical, like phone numbers:
+1 (541) 754-3010
We can break that into 4 parts:
+1 | 541 | 754 | 3010 |
---|---|---|---|
Country code | Area code | Local exchange | Specific phone |
The hierarchy makes it easier for the telephone system to efficiently send calls to the right lines.
IP addresses are also hierarchical. The first sequence of bits identifies the network, and the final bits identify the individual node in the network.
Consider this IP address:
24.147.242.217
We can break that into 2 parts:
24.147 | 242.217 |
---|---|
Comcast network | My home network |
Network administrators can break IP addresses into further subnets (subnetworks) as needed, for easier routing.
Starting with this IP address:
141.213.127.13
That could break down into 3 parts:
141.213 | 127 | 13 |
---|---|---|
UMich network | Medicine school | Lab computer |
In actuality, addresses are typically split in the middle of the octets. The first 16 bits might route to all of UMich, the next 2 bits route to a specific UMich school, and the final 14 bits route to individual computers.
IP addresses use this hierarchical addressing scheme to make routing messages easier from place to place. Once a message gets to the network, then the network can take care of sending it to the individual node.
🔍 What's your IP address?
One way to find out your computer's IP address is by searching Google for "IP address". Google knows your IP address, since your computer sends a message to the Google computers as soon as it loads
google.com
.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.
Want to join the conversation?
- Is it possible for one computer to have the same IP address as another? Considering there are so many devices that have needed to be assigned an address, and also that there are probably people who want to run a server with the same address as another one for malicious purposes, how could this not happen?(6 votes)
- It is possible for two hosts to have the same IP address on a LAN - this is known as IP conflict, and packets will not be routed to the correct host. For malicious purposes, this would be IP spoofing, and is usually used to step into an existing session and either inject data or instructions, or extract valuable information.
As far as running a server that looks like a legitimate server - most bad actors do not use the same public facing IP address for their false server. Backbone DNS services are very well protected and hard to compromise. Instead, they will use URLs that look similar and rely on inattentive humans to miss misspellings, or take advantage of the inability of humans to distinguish between character sets that contain the same letters (ACII and UNICODE).
This is actually part of why DNS or name servers and routers are attractive targets to hit, as you can direct traffic however you like if you compromise one.(7 votes)
- Would we really need 340 undecillion different IP addresses?
Having that many seems kind of silly.(3 votes)- For practical purposes, no. But the number of available IP addresses goes up exponentially for each bit added. (If it were 2^33 bits long, there would be more than 8 billion addresses, but the number of bits in a block would be inconsistent, slowing down various calculations.) Another consideration is that the number of internet-enabled devices is growing. Now, in addition to PCs, smartphones, and servers, we have "smart" coffee machines, alarms, cars, light bulbs... all requesting IP addresses, and many of them are active 24/7. So the designers of IPv6 were playing it safe.(10 votes)
- How are they going about changing all the IP addresses? Are they able to change the address without stopping the website or changing anything?(4 votes)
- From the author:The first part of the upgrade process is making sure all the network infrastructure supports IP v6: the Internet Service Provider, the router, the firewall, the server. If all the hardware and software support IP v6, then the DNS records for the website can be modified to point to the IP v6 address instead.
With good preparation, yes, it is possible to upgrade from IP v4 to IP v6 without suffering downtime.
See this article for a much more in-depth explanation:
https://www.internetsociety.org/resources/deploy360/2013/making-content-available-over-ipv6/(2 votes)
- Why is IPv6 called IPv6? Why not IPv5 or IPv8?(3 votes)
- From the author:6 is the version of the protocol, and is specified in the packets. There was an IP version 5, but the proposal was never officially adopted. It contained ideas about improving the streaming of audio and video data. However, it still used IP v4 addressing. People soon realized the dire need for a larger address space, abandoned IP v5, and went to work on IP v6 instead. For more details, search the internet for "IP v5".(3 votes)
- I can't understand this part of the explanation... I'm stuck here :(
"In actuality, addresses are typically split in the middle of the octets. The first 16 bits might route to all of UMich, the next 2 bits route to a specific UMich school, and the final 14 bits route to individual computers."
What I understand of IPv4 is that they're divided into 8 bits each value. So how come the IP address be divided into 16 bits, 2 bits (?) and then 14 bits (?). I'm really confused here.(2 votes)- I think I understand your confusion. You are correct in that IPv4 32-bit addresses are divided into octets (8 bits). This is how computers interpret these bits.
However, humans do not have to use this same interpretation. We can assign a different meaning to the 32-bit address. In the example, we (humans) can interpret the 32 bits as grouped into 16, 2, and 14 bits. Each grouping can mean something different. In the example, the first grouping refers to UMich, the second grouping to a specific UMich school, and the third to a particular computer.
As a concrete example, take 255.255.63.255. The computer representation is (11111111 . 11111111 . 00111111 . 11111111). We humans can view this like the following: (11111111 . 11111111) . (00)(111111 . 11111111), where (11111111 . 11111111) is the ID of UMich, (00) is the ID of the specific UMich school, and (111111 . 11111111) is the ID of the computer.
In sum, it's a bit like how a computer could interpret 2 + 2 as addition of numbers, whereas we humans could interpret it as meaning the addition of dollars or calories.(4 votes)
- Is there a way to find my IP address on the terminal? ifconfig?(1 vote)
- When you try to find it on the command-line, the results can be a little confusing as there are both internal IP addresses and external IP addresses. This article has a nice explanation: http://www.chriswrites.com/how-to-find-your-macs-internal-and-external-ip-address/(3 votes)
- Why 65,535 and not 65,536 possibilities for each part of the 8 hex IPv6 address? A four digit hex number should have 16^4 possible values, shouldn't it? The text even uses 2^16 as an alternative calculation and that should equal 65,536.(2 votes)
- From the author:Good observation, I'll reword that. Off by 1 error!(2 votes)
- So far I have only seen IPv4 addresses, so does this mean that IPv6 is not yet used or there exist devices out there that are addressed using IPv6?(1 vote)
- No, the IPv6 switch is well underway and many have done the switch the IPv4 is easier to read so that might be why you see it more often.
Here the IP of a google DNS server
2001 :4860 : 4860 : 0 : 0 : 0 : 0 : 8888
There should be no empty spaces between the numbers and the colons, but the forum converts numbers next to colons as something else.(2 votes)
- How am I supposed to differentiate between an IPv4 address and an IPv6 address? And how am I supposed to tell if it's valid or not? I've stuck!(1 vote)
- An IPv4 adress is made up of four units each containing a number between 0 and 255 (0 - FF in hexadecimal) and seperated by a dot
So 111.111.111.111 would be valid v4
343.111.111.111 not and 22.22.1 neither.
An IPv6 adress is made up of eight units each containing a hexadecminal number between 0 and FFFF and seperated by colons
FF22:FFFF.FFFF:/FFFF:/0D00:/1111:/0024:/4897
would be a valid Ipv6 adress.
The slashes shouldn't be in the adress I just added them because of the forum formatting.(1 vote)
- How can I know what is my IP address?(1 vote)
- You can open "Command Prompt" on Windows or your terminal if you are using OS X. On Windows, type the command "ipconfig" and then press enter to view information about your I.P. address. On OS X, you will need to use "ifconfig," which will accomplish the same result.(1 vote)