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.
11000000101010000000111000010111 = 192.168.14.23
10101100 00010010 11100111 00101111
IP address structure
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.
- 10, Popular Road
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
Class B addresses start with binary 10 hence the first byte is in the range 128-191
Class C addresses start with binary 110 hence the first byte is in the range 192-223
Host address field
For all devices on a given network, the network bits will be the same. The host bits will then be different for each device. With each class of address (A, B or C) we have 8, 16 or 24 bits respectively for hosts, so we can calculate the range of possible host addresses we can have. However, in any network, the first and last addresses are special. The first address (all 0's) is used to refer to the network itself. This is not usable as a destination address but is used in routing protocols. The last address (all 1's) is called the network directed broadcast and can be used to send an IP packet to all devices in the network.
|192.168.14.255||Class C||Broadcast to the 192.168.14.0 network|
|184.108.40.206||Class B||The 220.127.116.11 network|
|18.104.22.168||Class A||Broadcast to the 22.214.171.124 network|
Yes. They are both class A addresses and have the first 8 bits in common.
Yes. Both addresses are class C but are different in the first 24 bits. Hence they are different networks.
A large business with a Class A or B address will probably have many separate subnetworks in their organisation. They subdivide the host field in their allocated address by 'borrowing' bits to create subnetworks. We now ignore the class of the address and have a common new division of the bit structure which is specified with a sunet mask. Research how this works.
When an organisation has subnetted their network, some subnets may need further division. Thus we end up with subnets of varying sizes. We hence have different structures of bits in different networks. Thus we have many different subnet masks, hence the name Variable Length Subnet Masks (VLSM). Research how to do this.
With the structure of the Internet, many companies who own sequential network addresses may all be interconnected and share a common link back towards the core. Thus it is possible to aggregate several addresses together to create 'supernets'. We then have to ignore the class of address and just use the subnet masks. This is called Classless Inter Domain Routing.(CIDR). How has this helped keep the Internet working.