Using IP Subnet Masks

 

 

 

Depending on the size of the network, IP-based networks are divided into three classes.
· Class A- Class A networks are mega monster networks with up to 224 nodes 16 million plus. Class A networks have their network addresses from 1.0.0.0 to 126.0.0.0, with the zero's being replaced by node addresses.
· Class B- Class B networks are smaller networks in comparison they can have only about 65,000 nodes! Network addresses for these ranges from 128.0.0.0 to 191.0.0.0. Here the last two zeros get replaced by the node addresses.
· Class C- These are the baby networks that can have only 254 nodes at the maximum. The network IP addresses for these range from 192.0.0.0 to 223.0.0.0.

 

 

 

 

 

 

The InterNIC has (RFC 1597 Address Allocation for Private Internets) allocated particular blocks of network addresses for use in intranets. These IP addresses don't conflict with those of existing Internet hosts and will not be handed out for use on the Internet.
The address blocks are:
Class A: 10.0.0.0
Class B: From 172.16.0.0 to 172.31.0.0
Class C: From 192.168.0.0 to 192.168.255.0


 

 

Without subneting, you can have the following configurations.

No of machines to be connected Class of network Network addresses
254 or less C 192.168.0.0 to 192.168.255.0
255 to 65,534 B 172.16.0.0 to 172.31.0.0
65,535 to 16,777,214 A 10.0.0.0

 

example in subnet design

 

Warning: You can safely ignore this section and use the IP subnet calculator instead. Remember that all this is done in binary. If you are curious as to what happens behind the scenes, here it goes.

We will consider a class C network being subneted.
First of all you have to decide how many subnets you want to have. This can be along functional lines like different subnets for accounts, sales, and marketing etc. You also need to know the number of hosts that the largest subnet is to support. And remember to keep future needs in mind.

Assume that the network address chosen for your intranet is 192.168.1.0, and that you want seven subnets, with the largest one having 20 hosts.Since you are dealing with binary numbers, subnets can be created only in blocks of powers of two. That is you can have two subnets, four, eight, 16, and so on. In this case you choose eight subnets, which will also give you one free subnet for future use. Your IP address is a 32-bit binary number. Out of this the first 24 bits (8 x 3) have already gone for the network address. Now you have to set aside the next three (8 = 23 ) for subneting. That leaves you with 32-24-3 = 5 bits for host addresses. With five bits you can have 25 = 32 individual IP addresses for the hosts. Of these, two all 1s and all 0s cannot be assigned to hosts. The all 0s host number identifies the base network or the subnet while the all 1s host number identifies the broadcast address of the network or subnetwork. So, you can have a maximum of 30 hosts on each subnet.

If you want more than 30 hosts on a subnet, what would you do? Reduce the number of subnets or go for a higher class of network. Remember that the maximum number of hosts on a class C network is 254 (after subtracting the broadcast address and the network address), and with every subnet, you are reducing that number by two. (8 x 30) + (7x2) = 240 + 14 = 254.

Now we come to the binary numbers.
Network address = 192.168.1.0 = 11000000.10101000.00000001.00000000
Default subnet for class C = 255.255.255.0 = 11111111.11111111.11111111.00000000
Adding 8 subnets = 11111111.11111111.11111111.11100000


Converting this to binary, the required subnet mask is 255.255.255.224 (11100000 in binary is 224 in decimal notation).
The subnets are numbered 0 to 7. The subnet is defined by replacing the three most significant digits ( first three from left) of the last octet in the network address with the binary representation of the subnet number. Thus,
Subnet 0 will be 11000000.10101000.00000001.00000000 = 192.168.1.0
Subnet 1 will be 11000000.10101000.00000001.00100000 = 192.168.1.32
Subnet 2 will be 11000000.10101000.00000001.01000000 = 192.168.1.64
Subnet 3 will be 11000000.10101000.00000001.01100000 = 192.168.1.96
Subnet 4 will be 11000000.10101000.00000001.10000000 = 192.168.1.128
Subnet 5 will be 11000000.10101000.00000001.10100000 = 192.168.1.160
Subnet 6 will be 11000000.10101000.00000001.11000000 = 192.168.1.192
Subnet 7 will be 11000000.10101000.00000001.11100000 = 192.168.1.224

A quick check on your calculations is that the fourth octet (in decimal) of all subnets will be multiples of the fourth octet (in decimal) of subnet 1.As originally defined, subnets with all 0s and all 1s subnets 0 and 7 in this case were not to be used. But today's routers can overcome this limitation.

Now we come to the host address for each of the subnets. Hosts are numbered from 1 onwards as against subnets which as we saw are numbered from 0 onwards. In this case, we have 30 hosts in each subnet, and they will be numbered from 1 to 30. To arrive at the host IP address, replace the host portion of the relevant subnet address (the last five digits of the fourth octet in this case) with the binary equivalent of the host number.Thus, the IP address of host number 3 on subnet 1 will be 11000000.10101000.00000001.00000011 = 192.168.1.3 and that for host number 30 in subnet 6 will be 11000000.10101000.00000001.11011110 =192.168.1.222.The broadcast address for subnet 4 is 11000000.10101000.00000001.10011111 = 192.168.1.159, which is one less than the subnet address of subnet 5.



Example 1
We have a Class B address 130.57.x.x.  We want to assign a subnet number of 12.
The subnet address is assigned using the first 4 bits of the third byte.
The decimal number 12  is represented by a binary 1100 (hexadecimal C).
The subnet mask would then be represented as:

 

Binary &127;11111111 11111111 11000000 00000000
Decimal 255 255 192 0
Hexadecimal FF FF C0 00
The subnet mask is therefore represented as:

                 255.255.192.0
Example 2
We have a Class B address 159.64.x.x.  We want to assign a subnet number of 15.
The subnet address is assigned using the first 4 bits of the third byte.
The decimal number 15  is represented by a binary 1111 (hexadecimal F).
The subnet mask would then be represented as:

 

Binary &127;11111111 11111111 11110000 00000000
Decimal 255 255 240 0
Hexadecimal FF FF F0 00
The subnet mask is therefore represented as:

                 255.255.240.0
Example 3
We have a Class C address 193.15.43.x.  We want to assign a subnet number of 4.
The subnet address is assigned using the first 4 bits of the fourth byte.
The decimal number 4  is represented by a binary 0100 (hexadecimal 4).
The subnet mask would then be represented as:

 

Binary &127;11111111 11111111 11111111 01000000
Decimal 255 255 255 64
Hexadecimal FF FF FF 40
The subnet mask is therefore represented as:

                 255.255.255.64

 

what is cidr?