# A-level Computing 2009/AQA/Computer Components, The Stored Program Concept and the Internet/Structure of the Internet/IP addresses

Every device attached to a network has a number assigned to it. This unique number is called the IP Address, and you might be familiar with the format of:
Currently the most common form of IP Address is IPv4 which uses 32 bits to store an address. This means that there are theoretically $2^{32}=4,294,967,296$ different IP Addresses that can exist. However, due to the allocation of IP ranges to different organisations and tasks, the number is lower.
An IPv4 address is typically shown as split into 4 chunks as shown above. Different ranges of IP addresses are categorised differently, with the first part of the IP specifying who or where the IP address is (the network identifier), and the second part defining which host/machine it is (the host identifier).
$\underbrace {192\cdot 168} _{\text{network}}\cdot \underbrace {12\cdot 162} _{\text{host}}$
Different sets of IP ranges are allocated to particular networks, geographic areas, companies etc. The table below shows several examples of IP ranges and the uses that they have been put to:
| IP range | Description | Example |
| 192.168.___.___ 172.16.___.___ - 172.31.___.___ 10.___.___.___ | Private networks, e.g. intranets | 192.168.1.23 |
| 41.___.___.___ 102.___.___.___ 105.___.___.___ | AfriNIC allocations for IP addresses in Africa | 102.43.1.65 |
| 81.___.___.___ 217.___.___.___ 62.___.___.___ | European allocations for IP addresses | 81.202.17.89 |
| 200.___.___.___ | Latin America and the Caribbean | 200.100.50.25 |
| 9.___.___.___ | IBM | 9.1.2.3 |
| 17.___.___.___ | Apple | 17.19.23.29 |
As you saw with packet switching, every request that gets sent over the internet is sent with the sender's IP address attached. This is useful for many different reasons. Firstly you can send a confirmation message to the sender to confirm that you received the data. Secondly websites can keep track of where their users come from. Thirdly websites can block requests from certain IP address ranges. For example if you were running a national television service such as the BBC, where your programming was paid for by your fellow countrymen, you wouldn't want people from other countries watching programmes that they hadn't paid for. If you try and access the BBC iPlayer from the USA it will say "Not available in your area". This is because an American's IP would be from a banned IP range. IP banning can also be used by governments to bar their populations from accessing websites on certain IP addresses.
The diagram above shows how two intranets can connect across the internet. If the computer in Intranet A with the IP address 192.168.1.2 wants to send a message to a computer in Intranet B, it will send its message through the Router connected to Intranet A (IP=172.8.18.100). This router will then route the message onto the internet, going from router to router until it reaches the router attached to Intranet B (IP=201.108.0.45). This router will then pass the message on to the correct machine in Intranet B. Notice that because each intranet is connected to the internet through a router, the computers on each intranet will appear as having the IP of their router when connected to the internet. If you share a house and someone commits a crime online, the finger might be pointed at the whole household! Using IP addresses this way was never the intention of the designers of TCP/IP, they would much prefer that each machine had a distinct IP address, however, with the shortage of IP addresses this isn't possible. What is needed is a system that has more addresses available.
* Extension: IPv6
* As you might have noticed, there is a limit to the number of IPv4 addresses we can have, this limit is well below the current population of the world. If we were in the future to have every inhabitant of the planet connected to the internet, there wouldn't be enough IP Addresses for them to use! This problem is very current and IPv6 is being introduced to try and resolve it. IPv6 uses 128 bits for each address, meaning we have theoretically $2^{128}$ addresses available = $340,282,366,920,938,463,463,374,607,431,768,211,456$ different possible addresses.
* Decomposition of an IPv6 address from hexadecimal representation to its binary value.
* The IPv6 address has 128 bits split into:
* 64 bits for the network
* the first 16 bits are used for address type
* 16 bits for sub networks
* leaving 32 bits for main networks
* 64 bits for the interface addresses
* Why would we ever need this many you may ask? With so many addresses this will allow each person to have multiple devices connected to the internet, currently driven by the demand for internet on mobile phones. We are also looking at connecting lots of other devices to the internet that might not currently be connected. For example we could have fridges telling us when we are low on milk, ovens telling us when they need cleaning, bikes telling us when they need a service. The future is coming, watch this IPv6 space!
* Exercise: IP Addresses
* What is an IP address, give an example?
* Answer:
* Numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol 192.168.7.1
* What is the IP address range for an internal network?
* Answer:
* 192.168.___.___ OR 172.16.___.___ - 172.31.___.___ 10.___.___.___
* What IP address would an internal network machine appear to have when connecting to the internet?
* Answer:
* The address of the router
* Convert the following IP address into binary: 123.45.67.89
* Answer:
* 01111011.00101101.01000011.01011001
* Convert the following IP address into decimal: 01011110.01100010.10011011.00010000
* Answer:
* 94.98.155.16
* Why has IPv6 been introduced?
* Answer:
* IPv4 only has 32 bits, this means as more and more machines connect to the internet we will eventually run out of IP Addresses. IPv6 allows for more addresses to be used.
* For the following IP address can be split into two parts, label each: 192.168.23.2
* Answer:
* $\underbrace {192\cdot 168} _{\text{network}}\cdot \underbrace {23\cdot 2} _{\text{host}}$