IP Addressing and Routing Part 1: IP Address Architecture
I wrote this article with the invasion of IP services in our daily life in mind. Think about it — the electronics you use every day: your computer, your TV, your home phone, your mobile phone — all possess an IP address. Our world would not be the same without the Internet Protocol. But do you know what it is? Why it is needed? How it is structured? If you answered no to at least one of these questions, keep reading — all of this and more will be explained in this article.
And in my next article, Part 2 of this mini-series, I will go even further and explain the process of IP routing by showing you step-by-step what happens when two hosts need to communicate between each other. And in Part 3 we’ll go over default and static routing basics. But first let’s take a look at what’s required before communication can occur — the IP address and the different IP network classes.
To get a clear understanding of why we need this thing called IP address, I’ll use an example from daily life. Imagine that you need to send some mail to Train Signal Inc. What you need is Train Signal’s country, street name, and number.
The IP address structure is similar to the mail system architecture. There is a specific part in the IP header that identifies the country part of the address. A separate field identifies the postal code and street name within the country and another one identifies the actual mail box and name of a particular host.
All these fields of course, have special names of their own in the “IP world.” The table below shows the analogy between IP addressing structure and mail system architecture:
Imagine if every router in the Internet had to know the IP addresses of every host around the world — this would be extremely inefficient. That is why the 2 or 3 level hierarchical addressing scheme is efficient, because each router along the path reads and matches only the hierarchical part of the IP address that it needs to know about.
Only the router closest to the destination host will need to match the whole network-subnet-host address and physically identify the host in a subnet (identify the street number). That is where the MAC address takes action. The latter has only local meaning, in the sense that it identifies hosts within a given subnet (street).
The combination of the virtual addressing scheme (IP address) and physical addressing scheme (MAC address) ensures reliable delivery of messages to their destination.
An IP address consists of 4-bytes of data. A byte consists of 8 bits (a bit is a single digit and it could only be either a 1 or 0), therefore we have a total of 32 bits for each IP address. The IP address is presented in a dotted decimal formation, where each byte is seen as a separate section with a full-stop dividing each section. The same IP address can be represented using one of these three methods:
- Binary: 11000000. 10101000. 00001010.00000010
- Hexadecimal: C0.A8.0A.02
- Decimal: 192.168.10.2
To simplify things, the decimal representation is usually used.
Now that we’ve gone over the hierarchical addressing scheme, let’s take a look at the network and host parts and how a network class determines their location in the IP address field.
Class A Network
In a class A network the first byte of the address identifies the network part and the remaining three bytes identify the host part. The format is:
Class A network addresses are one byte long with the first bit of the byte being set permanently to zero. Therefore, the first Class A network that can be created is the 00000000 network. Actually this network cannot be used because it is reserved to designate the default route.
The last Class A network that can be defined is 01111111 (127 decimal). And guess what, this network cannot be used either because it’s reserved for testing purposes. Therefore, we are left with 126 (128-2) available networks.
The remaining three bytes can be used to identify hosts. The actual maximum number of usable hosts is 16777214. When you see an IP address that starts from 1 and goes up to 126, then you will know that it’s a Class A address.
Class B Network
In Class B networks, the first bit of the first byte must always be 1 and the second bit must always be 0. Therefore the range for a Class B network in binary notation is:
- 10000000 up to 10111111
Class B networks use two bytes for the network part and two for the host part which leads to a total of 16384 Class B networks with a maximum of 65535 hosts per network. The format of a Class B network is:
When you see an IP address that starts from 128 and goes up to 191, then you will know that is a Class B address.
Class C Network
In Class C networks we have the first two bits of the first byte permanently set to 11 and the third bit set to 0. Therefore, the range for a Class B network in binary notation is:
- 11000000 up to 11011111
Class C networks use three bytes for the network part and one for the host part which leads to a total of 2097152 Class C networks with a maximum of 254 hosts per network. The format of a Class C network is:
When you see an IP address that starts from 192 and goes up to 223, then you will know that is a Class C address.
Classes D and E
Class D addresses start from 224 until 239. These addresses are defined as multicast addresses whereas Class E addresses are used only for scientific purposes. The latter cover the starting range from 240 until 255.
Special Purpose Addresses
Some IP addresses are reserved to serve certain purposes and they cannot be assigned to hosts. These special purpose addresses include:
- IP address 127.0.0.1 — reserved for loopback tests.
- Node address of all 0s — used to identify the network address.
- Node address of all 1s — used to identify the broadcast address within a network (intended for all the hosts in the network).
- IP address 0.0.0.0 — used to designate the default route.
- IP address 255.255.255.255 — used for broadcast to all hosts
Private IP Addresses
A range of IP addresses has been reserved for use within a LAN for conservation purposes. The ranges of private IP addresses that can be used in the Local network and cannot be routed to the internet are the following:
- 10.0.0.0 10.255.255.255
- 172.16.0.0 172.31.255.255
- 192.168.0.0 192.168.255.255
If you’re interested in this topic, you can find the details about the usage of these private addresses in conjunction with Network Address Translation (NAT) functionality in one of my previous posts: Learn About Scaling IP addresses with NAT and PAT
I hope this article has been helpful! Now you can identify the different network classes and classify IP addresses within each class. The following table is sort of a cheat sheet, and it will help you remember how to do it all: