The problem with the initial way of using IP addresses was that we were fixed with having certain parts of the address for the network and certain parts for the hosts.
Class A addresses were fixed with 8 bits for the network and 24 for the hosts. Class B addresses were fixed with 16 bits for the network and 16 for the hosts. Class C addresses were fixed with 24 bits for the network and 8 for the hosts. There had to be some way for host addresses to not be wasted. The answer came with the introduction of subnetting.
Subnetting allowed bits that were normally used for the host part to be used for the subnet part of the address. In order to let the routers or PCs know that subnetting was being used another number had to be applied to the IP address. This number is known as the subnet mask and is also a binary number.
IN THE REAL WORLD: Subnetting and many other internetworking methods and tools are introduced by Requests for Comments or RFCs. RFCs are open for anybody to comment upon before they are published. www.rfc-editor.org
Each bit on the subnet mask is compared with the bits on the IP address to determine which parts belong to the network and which belong to the host. A default subnet mask is allocated to each class of address. If you do not want to use subnetting simply add the subnet mask to the end of the IP address. It is not possible to enter an IP address onto a PC or router without also entering the subnet mask.
Default subnet masks
Class A – 255.0.0.0 or in binary:
11111111.00000000.00000000.00000000
Class B – 255.255.0.0 or in binary:
11111111.11111111.00000000.00000000
Class C – 255.255.255.0 or in binary:
11111111.11111111.11111111.00000000
We can see that the first octet for class A addresses is reserved for the network number. This is the default anyway, like the first two octets for class B and the first three for class C.
A rule for subnet masks is that the 1 and 0 network and host bits must be contiguous i.e. connect without a break. So you can have 11111111.11111111.0000000.000000 but you cannot have 11111111.000111111.00000000.00000000. We can also see how important it is to remember that the router or PC sees numbers in binary.
IN THE REAL WORLD: Whenever a network address does not look right to you, write it out in binary.
What we now have is a situation where each part of the IP address is matched with the subnet mask to determine which bits are part of the network identification and which bits are part of the host identification.
Example:
10001100.10110011.11110000.11001000 140.179.240.200 Class B
11111111.11111111.00000000.00000000 255.255.0.0 Subnet mask
—————————————————
10001100.10110011.00000000.00000000 140.179.0.0 Network Address
How did we get this number? The router performs something called logical ANDing. It compares the 1’s and 0’s to establish which numbers belong to the network and which belong to the host.
| 0 | 1 | |
| 0 | 0 | 0 |
| 1 | 0 | 1 |
So all the values are compared and anything apart from a 1 and 1 equals 0. Check the above example again to make sure you understand how it works.
IN THE REAL WORLD: Many network engineers do not understand subnetting. Make sure you are not one of them. Once you know it you know it forever.
Because you now know which are the network addresses and which are the hosts, you can start assigning IP addresses to hosts on your network. If all the host bits are 0 then you cannot use this to put on a network host. The all 0’s represents the subnet; we shall see why and how shortly.
140.179.0.0 is your network address
140.179.0.0 in binary has all of the host bits turned off:
10001100.10110011.00000000.00000000 Every host bit is turned off
Network. Network. Host. Host
140.179.0.1 can be used for your first host
140.179.0.2 can be used for your second host
You can keep adding hosts until both the 3rd and 4th octet are (almost) full.
140.179.0.255 is still a valid host number
140.179.1.255 is still okay
140.179.255.254 is the last host number you can use.
Here is the last host number in binary:
10001100.10110011.11111111.11111110 Not every host bit is turned on
Network. Network. Host. Host
Why can’t we use the last bit portion above for a host? An IP address with all 1’s in the host portion is reserved to tell the network that the packet is a broadcast packet. A broadcast packet is a packet that must be examined by all hosts on the network (or more specifically, all of the hosts on this portion of the network i.e. the subnet). The number below is a broadcast packet to every host on the 140.179 network.
140.179.255.255 in binary has all the host bits turned on:
10001100.10110011.11111111.11111111 Every host bit is turned on
Network. Network. Host. Host
So now we can see that we are not permitted to use all 0’s for the hosts since this is the network and we cannot use all 1’s because this is reserved for a broadcast. With this information we will be able to decide how many available hosts we have per network or subnet.
FOR EXAMS: You may be tested thoroughly in the exam on subnetting and working out how many hosts per subnet and which is the subnet and broadcast address. You must be able to do this quickly or you will run out of time.
We use the power of two formula to work out how many hosts we get on our subnet. We simply multiply two to the power of how many host bits we have and take away two. One for the network of all 0’s and one for the broadcast address of all 1’s.
So for our example of 140.179.0.0 255.255.0.0 we can see we that we have the last two octets free (the 0.0) to allocate to hosts on the network. That is two lots of eight binary bits giving us 16.
The formula is 2^n-2
2^16-2 = 65534
Do you think it would be practical to have a network with over 65000 hosts on? We cannot break this network down into smaller units and if we have a broadcast on the network each and every single host on the network will have to stop what they are doing to listen to the broadcast packet to see if it is the intended recipient.
Let’s steal some bits from the host part of the address and make a subnet or mini-network from those bits. I will write out the network address in long hand to make it easier to understand.
140.179.00000 000.00000000
[16 bits] [5 bits] [11 bits ]
[network][subnet][host bits ]
We have stolen five of the host bits to use to make our subnet. The advantage is that we have more than one subnet we can use and we have less hosts per subnet. We can use the powers of two formula to work out how many subnets we have and how many hosts per subnet. We do not have take two away for the subnets for reasons you will see later.
2^5 (or 2x2x2x2x2) = 32 subnets each with
2^11 (or 2x2x2x2x2x2x2x2x2x2x2-2) = 2046 hosts per subnet
Why would we want to do this? You have fewer hosts using the bandwidth on your network segment. It is far easier to administer smaller subnets rather than one huge network. Additionally, it is desirable to limit the number of broadcasts on a given subnet because each and every host on a subnet must examine the contents of a broadcast packet, whether it is the intended recipient or not.
In an environment with an excessive number of hosts, the number of broadcasts can grow quite a bit and while not immediately measurable, this broadcast traffic will lower the overall performance of all of the networked systems. Also, you can only have one network per router interface. It is better to have a smaller number of hosts connected to a router interface rather than several thousand.
Remember: the more host bits you steal the more subnets you get but each of those subnets is capable of supporting a lesser number of hosts. Deciding how many hosts you need and how many hosts per subnet is part of the network design phase. The more host bits we steal means we have more and more subnets and less host bits available, this is the trade off.
Table 1.3 is for a class B network. Remember that for class B addresses we are looking at the third and fourth octets for the bit pattern. The first two octets are used for the network address and cannot be stolen.
| Bit Pattern (3rd/ 4th Octet) | CIDR | Masked Bits | Subnets | Hosts Per Subnet (2^x-2) |
| 00000000.00000000 | /16 255.255.0.0 |
0 | 1 (network) | 65534 |
| 10000000.00000000 | /17 255.255.128.0 |
1 | 2 | 32766 |
| 11000000.00000000 | /18
255.255.192.0 |
2 | 4 | 16382 |
| 11100000.00000000 | /19 255.255.224.0 |
3 | 8 | 8190 |
| 11110000.00000000 | /20
255.255.240.0 |
4 | 16 | 4094 |
| 11111000.00000000 | /21
255.255.248.0 |
5 | 32 | 2046 |
| 11111100.00000000 | /22 255.255.252.0 |
6 | 64 | 1022 |
| 11111110.00000000 | /23
255.255.254.0 |
7 | 128 | 510 |
| 11111111.00000000 | /24
255.255.255.0 |
8 | 256 | 254 |
| 11111111.10000000 | /25 255.255.255.128 |
9 | 512 | 126 |
| 11111111.11000000 | /26 255.255.255.192 |
10 | 1024 | 62 |
| 11111111.11100000 | /27 255.255.255.224 |
11 | 2048 | 30 |
| 11111111.11110000 | /28 255.255.255.240 |
12 | 4096 | 14 |
| 11111111.11111000 | /29 255.255.255.248 |
13 | 8192 | 6 |
| 11111111.11111100 | /30 255.255.255.252 |
14 | 16384 | 2 |
| 11111111.11111110 | /31 255.255.255.254 |
15 | 32768 | 0 (not usable) |
TABLE 1.3 Class B Subnetting Summaries
No comments yet
Leave A Reply (No comments So Far)