Scenario 1
The company has been allocated the Class C IP address 196.67.25.0 by the Internet Service Provider. This company has offices in:
1. Seattle in Washington state
2. New York in New York state
3. Orlando in Florida state
4. Los Angeles in California state
For some obscure reason they want to use public addresses on all their machines and networks, and to connect to the internet without any NAT. Not common but it does work fine.
1. Seattle in Washington state
2. New York in New York state
3. Orlando in Florida state
4. Los Angeles in California state
For some obscure reason they want to use public addresses on all their machines and networks, and to connect to the internet without any NAT. Not common but it does work fine.
When the company purchased this Class C address 196.67.25.0, :
a. How many networks did they get ? One.
b. How many hosts can you put on that network ? 256 but remember that in any and every network, the first IP address is the network address and cannot be used on a host, and the last IP address is the broadcast address and cannot be used on a host either. So the maximum number of hosts on this single network now is 254.
We see ten networks in the diagram. Four of them service the hosts inside the individual offices, and six of the networks are connecting every office to every other office across the country through WAN links.
(Disclaimer: This diagram is for illustration purposes only. Actual networks may not be designed this way.)
We have purchased one network IP but we need to divide it into ten networks. We will need to sacrifice on the number of hosts in order to increase the number of networks.
Three-step procedure for subnetting:
1. Determine the number of networks needed and convert that number into binary
2. Reserve bits in the subnet mask and find your increment
3. Use the increment to find your network ranges
Here we go:
1. Determine the number of networks needed and convert that number into binary
Number of networks needed = ten. Convert ten into its binary equivalent:
00001010
So it takes 4 bits (1010 after ignoring the leading zeros). Now take a leap and imagine that 1's represent the network and 0's represent hosts.
2. Reserve bits in the subnet mask and find your increment to get ten.
Original subnet: 11111111.11111111.11111111.00000000
New subnet : 11111111.11111111.11111111.11110000
I converted four 0's into four 1's here because it took 4 binary bits to form the number ten in Step 1. In the netmask, you need to mark off 4 bits from left to right, as shown.
11110000 in binary = 128 + 64 + 32 + 16 = 240 in decimal.
You now see that the new subnet is 255.255.255.240 . In CIDR notation, it is /28 .
Now look for the increment. The increment is the lowest network bit that is converted back to a decimal number. In our example it is the 4th bit, which is 16 ( after getting past 128, 64 and 32).
3. Use the increment to find your network ranges
Start with the original IP address and increment it by 16 to get the beginning of every network range. Keep going until you reach 255.
195.67.25.0
195.67.25.16
195.67.25.32
195.67.25.48
195.67.25.64
195.67.25.80
195.67.25.96
195.67.25.112
195.67.25.128
195.67.25.144
195.67.25.160
195.67.25.176
195.67.25.192
195.67.25.208
195.67.25.224
195.67.25.240
The numbers you see above are the network IDs, and they also represent the beginning of individual network ranges. To complete the list:
As already noted, in any network, we cannot use the first IP address and the last IP address for a host since these two IPs are for Network identification and Broadcast address respectively. Hence you see only 14 host IPs available in each of the 16 networks. And as already mentioned, each of these 16 networks has the subnet mask 255.255.255.240 .
In general, it is easy to calculate the number of networks and number of hosts you will get by subnetting. It is calculated as follows:
Number of networks = 2 to the power of number of bits converted to 1 in the subnet mask. In our example it was 4 since it takes 4 binary bits to form the decimal number ten. Hence the number of networks in our example = 2 ** 4 = 16.
Number of hosts per network = Two less than two to the power of bits that are zeros in the last field = in our example, (2 to the power of 4) minus 2 = 14 hosts per network.
Notice: Observe that in this setup, we have a situation where we are using up 16 IPs for each of the networks 5, 6, 7, 8, 9 and 10. Strictly speaking, each of these 6 networks needs only 4 IPs i.e. the network ID, the broadcast address and one IP per router interface connecting across the WAN links. A /30 network would suffice and is recommended. We will address this situation in a different topic that comes under the VLSM i.e. Variable Length Subnet Mask category.
Scenario 2
Let us assume that we have been given a Class C address 198.27.53.0 and that we are required to have 50 networks.
Use the same three-step procedure used in Scenario 1 for subnetting:
Notice: Observe that in this setup, we have a situation where we are using up 16 IPs for each of the networks 5, 6, 7, 8, 9 and 10. Strictly speaking, each of these 6 networks needs only 4 IPs i.e. the network ID, the broadcast address and one IP per router interface connecting across the WAN links. A /30 network would suffice and is recommended. We will address this situation in a different topic that comes under the VLSM i.e. Variable Length Subnet Mask category.
Scenario 2
Let us assume that we have been given a Class C address 198.27.53.0 and that we are required to have 50 networks.
Use the same three-step procedure used in Scenario 1 for subnetting:
1. Determine the number of networks needed and convert that number into binary
2. Reserve bits in the subnet mask and find your increment
3. Use the increment to find your network ranges
Here it is:
1. Determine the number of networks needed and convert that number into binary
Decimal 50 converted to binary is:
00110010
So it takes 6 binary bits (110010 after ignoring the leading zeros) to make 50.
2. Reserve bits in the subnet mask and find your increment
Original subnet: 11111111.11111111.11111111.00000000
New subnet : 11111111.11111111.11111111.11111100
Note: I have rendered the original host bits ( zeros) to ones in the first six places in the relevant octet. This is because it takes six bits to form the number 50, which is the number of networks we need to get.
The new subnet is going to be: 255.255.255.252
or in CIDR notation: /30
3. Use the increment to find your network ranges
Let us calculate what is the increment number. The increment number is the lowest network bit that is converted back to a decimal number. In our example it is the 6th bit from the left to the right in the relevant octet. Let us get to it:
128 64 32 16 8 4
1st 2nd 3rd 4th 5th 6th
So now, start with the original IP address and keep incrementing the networking by 4:
198.27.53.0
198.27.53.4
198.27.53.8
198.27.53.12
198.27.53.16
198.27.53.20
198.27.53.24
..................
..................
..................
198.27.53.232
198.27.53.236
198.27.53.240
198.27.53.244
198.27.53.248
198.27.53.252
Let us complete the table to elucidate the pieces of the puzzle:
So we end up being able to subnet the Class C /24 IP address 198.27.53.0 into more than 50 networks, with the following characteristics:
Number of networks: 64
Number of hosts per network: 4 but REMEMBER --- the first IP in every network is the Network ID and the last IP is the Broadcast address, which means we have only two usable IPs per network. Yes, only two Host IPs per network !!!!
Subnet mask: 255.255.255.252 or /30
A final note: It may look strange that somebody would want to have 50 or 60 or 64 networks with just two hosts in each network. In reality this /30 network is the second most popular network after the regular Class C /24 network. The reason being: these networks are used by ISPs (Internet Service Providers) as WAN links which require only two IPs to connect remote offices and which results in absolutely no wastage of unused IPs.
Scenario 3
Let us now consider a Class B address 161.71.0.0 purchased by the company from the ISP. We need to split or subnet this address into 100 different networks.
Let us follow the same procedure as before:
1. Determine the number of networks needed and convert that number into binary
100 in decimal is equal to 01100100.
That would mean it takes 7 bits (1100100) to get the decimal number 100.
2. Reserve bits in the subnet mask and find your increment
Original subnet: 255.255.0.0 since it is a Class B network address. /16 in CIDR notation.
Original subnet in binary: 11111111.11111111.00000000.00000000
New subnet in binary : 11111111.11111111.11111110.00000000
Note: Since it is a Class B network, the conversion of the host bits into network bits starts in the 3rd octet, unlike the Class C where it happens in the 4th octet.
The new Netmask value is: 255.255.254.0 i.e. it is a /23 network.
3. Use the increment to find your network ranges
Let's evaluate the increment from the 3rd octet:
128 64 32 16 8 4 2
1st 2nd 3rd 4th 5th 6th 7th
So the 7th bit number i.e. 2 is the increment.
Now let us get back to our original address allocation from the ISP: 161.71.0.0
The network IDs will be:
161.71.0.0
161.71.2.0
161.71.4.0
161.71.6.0
161.71.8.0
161.71.10.0
.................
.................
161.71.246.0
161.71.248.0
161.71.250.0
161.71.252.0
161.71.254.0
Notice that the increment got into the act in the 3rd octet since it is a Class B address.
What is the last address before 161.71.2.0 ? Go back to elementary mathematics:
How would you add say 17 to 29 ?
You cannot add them as:
29
17
-------------
316 XXXXXXXX
--------------
where 9+7=16 and 2+1=3.
The correct way of adding is
29
17
--------------
46
--------------
where you added 9 to 7, inserted 6 and moved the 1 to the more significant position, and then added this 1 to 2+1 to get a 4.
In binary, 255 is like 9 in the math above.
The last IP before 161.71.0.2 is 161.71.1.255
So the first network will be:
161.71.0.0 to 161.71.1.255
That's a range of 512 addresses
Exactly in the middle we get two numbers:
161.71.0.255 and 161.71.1.0
These two are perfectly applicable like all the other addresses and are no different from others though they may look scary at first sight.
Yes, we do get 512 addresses in this network BUT REMEMBER: the first IP is the Network ID and the last IP is the Broadcast.
So the available IP range in this network 161.71.0.0 would be:
161.71.0.1 to 161.71.1.254
Here is the complete table:
We needed a 100 networks to begin with, and we now have 128 networks available on hand.
Scenario 4
For this scenario, let us select a Class A address 45.0.0.0 and let us subnet it to get 2000 networks.
1. Determine the number of networks needed and convert that number into binary
2000 in decimal converted to binary will be:
1024 512 256 128 64 32 16 8 4 2 1
1 1 1 1 1 0 1 0 0 0 0
i.e. 11111010000
It takes eleven binary bits to form 2000 in decimal.
2. Reserve bits in the subnet mask and find your increment
Class A subnet mask: 11111111.00000000.00000000.00000000
New subnet mask : 11111111.11111111.11100000.00000000
As you can see above, we had to start with the 2nd octet since it is a Class A IP but them since we need to mark off eleven bits, we transgressed 3 spots into the 3rd octet.
The increment is 32 since we are on the 3rd bit in the octet, going from the left to the right in that particular octet.
3. Use the increment to find your network ranges
Coming back to our original allocation, the networks would be:
45.0.0.0
45.0.32.0
45.0.64.0
45.0.96.0
45.0.128.0
45.0.160.0
45.0.192.0
45.0.224.0
45.1.0.0 (since 224 + 32 is 256 but no 256 exists in a byte, thus resulting in a carryover)
45.1.32.0
45.1.64.0 and so on.
The following tables result:
Now we have 2048 networks, and 16382 available IPs in each of those 2048 networks.
Here it is:
1. Determine the number of networks needed and convert that number into binary
Decimal 50 converted to binary is:
00110010
So it takes 6 binary bits (110010 after ignoring the leading zeros) to make 50.
2. Reserve bits in the subnet mask and find your increment
Original subnet: 11111111.11111111.11111111.00000000
New subnet : 11111111.11111111.11111111.11111100
Note: I have rendered the original host bits ( zeros) to ones in the first six places in the relevant octet. This is because it takes six bits to form the number 50, which is the number of networks we need to get.
The new subnet is going to be: 255.255.255.252
or in CIDR notation: /30
3. Use the increment to find your network ranges
Let us calculate what is the increment number. The increment number is the lowest network bit that is converted back to a decimal number. In our example it is the 6th bit from the left to the right in the relevant octet. Let us get to it:
128 64 32 16 8 4
1st 2nd 3rd 4th 5th 6th
So now, start with the original IP address and keep incrementing the networking by 4:
198.27.53.0
198.27.53.4
198.27.53.8
198.27.53.12
198.27.53.16
198.27.53.20
198.27.53.24
..................
..................
..................
198.27.53.232
198.27.53.236
198.27.53.240
198.27.53.244
198.27.53.248
198.27.53.252
Let us complete the table to elucidate the pieces of the puzzle:
So we end up being able to subnet the Class C /24 IP address 198.27.53.0 into more than 50 networks, with the following characteristics:
Number of networks: 64
Number of hosts per network: 4 but REMEMBER --- the first IP in every network is the Network ID and the last IP is the Broadcast address, which means we have only two usable IPs per network. Yes, only two Host IPs per network !!!!
Subnet mask: 255.255.255.252 or /30
A final note: It may look strange that somebody would want to have 50 or 60 or 64 networks with just two hosts in each network. In reality this /30 network is the second most popular network after the regular Class C /24 network. The reason being: these networks are used by ISPs (Internet Service Providers) as WAN links which require only two IPs to connect remote offices and which results in absolutely no wastage of unused IPs.
Scenario 3
Let us now consider a Class B address 161.71.0.0 purchased by the company from the ISP. We need to split or subnet this address into 100 different networks.
Let us follow the same procedure as before:
1. Determine the number of networks needed and convert that number into binary
100 in decimal is equal to 01100100.
That would mean it takes 7 bits (1100100) to get the decimal number 100.
2. Reserve bits in the subnet mask and find your increment
Original subnet: 255.255.0.0 since it is a Class B network address. /16 in CIDR notation.
Original subnet in binary: 11111111.11111111.00000000.00000000
New subnet in binary : 11111111.11111111.11111110.00000000
Note: Since it is a Class B network, the conversion of the host bits into network bits starts in the 3rd octet, unlike the Class C where it happens in the 4th octet.
The new Netmask value is: 255.255.254.0 i.e. it is a /23 network.
3. Use the increment to find your network ranges
Let's evaluate the increment from the 3rd octet:
128 64 32 16 8 4 2
1st 2nd 3rd 4th 5th 6th 7th
So the 7th bit number i.e. 2 is the increment.
Now let us get back to our original address allocation from the ISP: 161.71.0.0
The network IDs will be:
161.71.0.0
161.71.2.0
161.71.4.0
161.71.6.0
161.71.8.0
161.71.10.0
.................
.................
161.71.246.0
161.71.248.0
161.71.250.0
161.71.252.0
161.71.254.0
Notice that the increment got into the act in the 3rd octet since it is a Class B address.
What is the last address before 161.71.2.0 ? Go back to elementary mathematics:
How would you add say 17 to 29 ?
You cannot add them as:
29
17
-------------
316 XXXXXXXX
--------------
where 9+7=16 and 2+1=3.
The correct way of adding is
29
17
--------------
46
--------------
where you added 9 to 7, inserted 6 and moved the 1 to the more significant position, and then added this 1 to 2+1 to get a 4.
In binary, 255 is like 9 in the math above.
The last IP before 161.71.0.2 is 161.71.1.255
So the first network will be:
161.71.0.0 to 161.71.1.255
That's a range of 512 addresses
Exactly in the middle we get two numbers:
161.71.0.255 and 161.71.1.0
These two are perfectly applicable like all the other addresses and are no different from others though they may look scary at first sight.
Yes, we do get 512 addresses in this network BUT REMEMBER: the first IP is the Network ID and the last IP is the Broadcast.
So the available IP range in this network 161.71.0.0 would be:
161.71.0.1 to 161.71.1.254
Here is the complete table:
We needed a 100 networks to begin with, and we now have 128 networks available on hand.
Scenario 4
For this scenario, let us select a Class A address 45.0.0.0 and let us subnet it to get 2000 networks.
1. Determine the number of networks needed and convert that number into binary
2000 in decimal converted to binary will be:
1024 512 256 128 64 32 16 8 4 2 1
1 1 1 1 1 0 1 0 0 0 0
i.e. 11111010000
It takes eleven binary bits to form 2000 in decimal.
2. Reserve bits in the subnet mask and find your increment
Class A subnet mask: 11111111.00000000.00000000.00000000
New subnet mask : 11111111.11111111.11100000.00000000
As you can see above, we had to start with the 2nd octet since it is a Class A IP but them since we need to mark off eleven bits, we transgressed 3 spots into the 3rd octet.
The increment is 32 since we are on the 3rd bit in the octet, going from the left to the right in that particular octet.
3. Use the increment to find your network ranges
Coming back to our original allocation, the networks would be:
45.0.0.0
45.0.32.0
45.0.64.0
45.0.96.0
45.0.128.0
45.0.160.0
45.0.192.0
45.0.224.0
45.1.0.0 (since 224 + 32 is 256 but no 256 exists in a byte, thus resulting in a carryover)
45.1.32.0
45.1.64.0 and so on.
The following tables result:
Now we have 2048 networks, and 16382 available IPs in each of those 2048 networks.
No comments:
Post a Comment