# Fundamentals of communication and networking: IP addresses

Each device connected to the Internet needs a unique address. The design of IP version 4 (IPv4) specified a 32-bit field for this in the IP header. In theory this allows for 232 addresses (4,294,967,296) which, at the time, seemed a big enough address space to allow for future expansion. However due to the way in which the addresses space was structured and allocated, and the unimaginable growth of the Internet, the address space is now depleted.

In preparation for this depletion a new version of IP has been developed and is called IP version 6 (IPv6). This uses 128-bit addressing. As of 2016 both systems are in use, with major new networks using IPv6. However IPv4 is still predominant and will coexist for many more years.

This section will deal with IPv4.

To write out the 32-bit address we don't usually write it in binary. We split it into four 8-bit chunks (bytes) and convert each byte to decimal. We then write the four decimal values with a '.' between them. This is then referred to as dotted decimal notation.

 Binary 11000000 10101000 00001110 00010111 Dotted decimal 192 168 14 23

11000000101010000000111000010111 = 192.168.14.23

 Exercise: IP addresses What is the address 00110001 11001100 00000100 11111111 in dotted decimal Answer: 49.204.4.255 What is the address 172.18.231.47 in binary Answer: 10101100 00010010 11100111 00101111

An IP address has structure in a similar way that a postal address has structure. A postal address is a multi-level route to the destination.

Newtown
London
UK

This tells us to get to this location we first need to get to the UK, then London, then Newtown then the road. On the road we will find number 10.

IP address have a two-level address. First we have the network address, then the host address and all within the 32-bit address. The network address will be common to all devices connected to a particular network such as a home, an office or a big business. Generally the network is under one administrative control. The network may be divided into sub networks but more of that later. Thus we first have to deliver the packet to the right network and this is the job of a router or routers. Once it is on the right network we can deliver it to the correct host.

The question arises as to how many of the 32 bits we should devote to the network address and how many to the host.

• 8 bits for the network leaves 24 bits for hosts. This gives us 256 networks each of which can have 16,777,216 hosts.
• 16 bits for the network leaves 16 bits for hosts. This gives us 65,536 networks each of which can have 65,536 hosts.
• 24 bits for the network leaves 8 bits for hosts. This gives us 16,777,216 networks each of which can have 256 hosts.

None of these options are ideal by themselves. We have a few really big networks, many mid-sized networks and many small networks. Thus we adopt all three approaches and define three classes of networks.

### Class A,B and C IP addresses

We use the first bit or bits of the IP address to indicate the class.

Class A addresses start with a binary 0 hence the first byte is in the range 0-127

7 6 5 4 3 2 1 0 Decimal Value
0 0 0 0 0 0 0 0 0
0 * * * * * * * -
0 1 1 1 1 1 1 1 127

7 6 5 4 3 2 1 0 Decimal Value
1 0 0 0 0 0 0 0 128
1 0 * * * * * * -
1 0 1 1 1 1 1 1 191

7 6 5 4 3 2 1 0 Decimal Value
1 1 0 0 0 0 0 0 192
1 1 0 * * * * * -
1 1 0 1 1 1 1 1 223
 Exercise: IP address classes What class of address is 192.168.14.11 Answer: Class C How many bits are used to specify hosts in the address 180.14.110.240 Answer: 16 bits