You already know that IP address and its network mask create a unique layer 3 identifier of a host. This allows devices to communicate. When a computer sends a packet, it will put the address of the recipient in the IP header as the destination. It also puts its own address (sender), so the recipient knows who sent the packet and to whom a reply should be sent.
After reading my previous post it may seem clear what a network and a host in the network are. But you may still ask: "What is a network anyway?". As strange as it sounds, the answer to the question may not be as simple as one might think.
We tend to divide our networks into multiple pieces that are uniquely identified with the network portion of the address (masked by network mask bits set to 1). Individual hosts placed in those networks will also have unique host portion of the IP address (network mask bits set to 0). They are unique in their network.
Why do we break down the company's infrastructure into multiple chunks called networks?
There are many reasons we do it. Larger networks are harder to maintain and become very inefficient as the hosts receive too many broadcast transmissions (broadcast=one packet to everyone). Also, it is easier to control traffic and tighten the security when dealing with multiple networks rather than doing so in one single organism. So, we separate hosts using layer 3 devices called routers and address them uniquely, thus creating multiple interconnected networks. The routers that connect networks become the gateways between them allowing unicast communication (one-to-one). At the same time they do not allow broadcast traffic (one-to-everyone) to go through. They also are equipped with many mechanisms to control the traffic traversing through them.
How we divide our system into multiple networks may be depended on numerous factors. For instance, a network in the building can be divided based on the floors. First floor is the first network, second floor is the second network etc. Other division could be made based on the departments in the corporation. HR is going to be one network, Legal Dept. another etc. Either way, computers will belong to one of these networks, but all of them together will still belong to the same company.
So, what is a network? A network is a group of devices that share the same network portion of the address. That portion is dictated by the length of the network mask. These bits mask the corresponding bits in the address. But this you already know. However, there are a few more things you need to know.
Consider this picture.
Pic. 1 - IP Networks.
Icons designed by: Andrzej Szoblik - http://www.newo.pl
What do we see in the picture?
In the middle sits a layer 3 device called a router (R1). I will devote a whole post on what it is and what its functions are. Meanwhile, let's carry on with our description.
The router (R1) connects two different networks. It becomes the gateway between them. This means it allows communication between them (unicast by default). The two networks in the picture have the following addresses:
- The network on the left-hand side has the address of 192.168.1.0/24.
- The network on the right-hand side has the address of 192.168.2.0/24.
Finally we have two computers. PC1 belongs to the network 192.168.1.0/24, PC2 belongs to the network 192.168.2.0/24. Both have the same host identifier in the last byte of their IP address: 1. But their network portion of IP address is different. As a result of that the belong to two different networks. Just like two Mr. Smiths who live in two different houses on two different streets of the same town.
Have you noticed that the third octed (from the left) has different number? That makes the network portions of these two addresses unique.
What does this /24 mean in the address?
As you already know the netmask separates a network from a host portion of the address. Both IP addresses and their network mask are presented in the decimal notation with the length of network mask (/24). Yes, the shortcut /24 means, that the network mask is twenty four bits in length. This in turn, means that the first twenty four bits of the IP address is the network portion. The remaing eight bits are the host address in the network. Check it out below.
Pic. 2 - PC1 address with the netmask 24 bits (/24).
Looking at the binary, we see that /24 = 255.255.255.0.
If we convert 255.255.255.0 into binary we get twenty four 1s in the network mask, giving us three bytes of the network address. The remaining eight bits in the network mask are all 0s. This way, the last byte (8 bits) becomes the host identifier int the network 192.168.1.0.
Interestingly enough, many moons ago, there were no networks mask in use. So, how on Earth, did the devices know which bits of IP address were network bits and which were the host bits? The designers of IP addresses divided IP addresses into five different classes. The first byte of any IP address (on the left) determined which class an IP belonged to and how many bits of the address were network bits. Today, this is known as the first octet rule.
IP Address Classes
The value of the first byte in the IP address determines its class (the first byte on the left-hand side).
- Class A - values 0 through 127
- Class B - values 128 through 191
- Class C - values 192 through 223
- Class D - (multicast) - values 224 through 239
- Class E - (experimental) - values 240 through 255
Pic. 3 - IP Address Classes.
Pic. 4 - IP Adress Classes and First Octet Rule.
Fast forward to the present day. We still use the concept of IP address classes. And as such we refer to the so called: natural network mask (length).
- Class A - Natural network mask length = 8 bits (/8) or, 255.0.0.0
- Class B - Natural network mask length = 16 bits (/16) or, 255.255.0.0
- Class C - Natural network mask length = 24bits (/24) or, 255.255.255.0
If your IP address uses the network mask length longer than the natural network mask used by this class, we call this IP address a subnet.
In my next post, I will show you how you can create subnets and how to calculate those given the host requirements.