Implementing classes in network numbers gave us some hierarchical structure to the Internet. Using class assignment, you could select a network number based on the number of hosts that are on or will be on your network. But the range was very
limited. Class A gave you a lot of hosts but just a few networks. Class B was the one picked to allow for a balance of hosts and networks, and Class C allowed many networks and a few hosts. Not much choice, either you had a lot of networks or a lot of hosts. The most requested network number was Class B; however, many Class B assignments were not fully used—really hard to have 65,535 hosts on a single network. Too many Class C addresses filled up routing tables and most did not fully use all 254 host addresses. Furthermore, some sites were requesting multiple addresses to fulfill their needs. Not many Class A addresses were handed out. In fact, after about 63 assignments, Class A assignments were not handed out at all. Class B addresses were popular and were the most frequently asked for address class. What’s the deal with Class C addresses? With only 254 hosts available for assignment, many Class C addresses have to be assigned.
Again, using Class assignment, the routing tables started to fill up and most of the bits were wasted when implemented. It was like being given a five–passenger car, but you never had anyone in the other seats. In short, subnetting allows for tremendous efficiency not only in Internet routing tables but also on customer networks as well. It allows us to assign some of the bits normally used by the host portion of the address and reassign these bits to the network portion of the address
1.2 SUBNETTING BASICS
The idea of a subnet is to break down the host number part of an IP address to provide an extra level of addressability. IP address has two parts:
Routing between networks is based upon the network number part of the address only. In a Class A network this means that 1 byte of the IP address is used for routing. However, that router must then move the traffic to each of the 16,777,214 hosts that a Class A network might have. This would result in huge routing tables in the routers, as they would need to know where every host was. To overcome this problem, the host number can be further subdivided into a subnet number and a host number to provide a second logical network within the first. This second network is known as the subnetwork or subnet. A subnetted address now has three parts:
The subnet number is transparent to remote networks. Remote hosts still regard the local part of the address (the subnet number and the host number) as a host number. Only those hosts within the network that are configured to use subnets are aware that subnetting is in effect. Exactly how you divide the local part of the address into subnet number and host number is up to the local network administrator. Subnetting can be used with all three classes of IP address A, B and C, but there are precautions to be aware of in the different classes. Class C addresses have only a 1-byte host number to divide into subnet and host. Care must be taken not to use too many bits for the subnet, because this reduces the number of bits remaining for the host’s allocation. For example, there are few networks that need to split a class C
address into 128 subnets with one host each.
1.3 IP Address
The IP address is one of the two types of addresses each machine has on a TCP/IP network that identifies the machine to its peers on the network. This address also gives peer hosts a notion of where a particular host is located on the network.
2.1 How to Create Subnets
To create subnetworks, bits from the host portion of the IP address are taken and reserve them to define the subnet address. This means fewer bits for hosts, so the more subnets, the fewer bits available for defining hosts.
In a classful routing, which means that all hosts (all nodes) in the network use the exact same subnet mask, while Variable Length Subnet Masks (VLSMs), each network segment can use a different subnet mask.
Follow these steps:
1. Determine the number of required network IDs:
One for each subnet
One for each wide area network connection
2. Determine the number of required host IDs per subnet:
* One for each TCP/IP host
* One for each router interface
3. Based on the above requirements, create the following:
One subnet mask for your entire network
A unique subnet ID for each physical segment
A range of host IDs for each subnet
2.2 Subnet Mask
A subnet is created by the use of a subnet mask. This is a 32-bit number just like the IP address itself and has bits relating to the network number, subnet number and host number. The bit positions in the subnet mask that identify the network number are set to 1s to maintain the original routing. In the remaining local part of the address, bits set to 1 indicate the subnet number and bits set to zero indicate the host number. You can use any number of bits from the host number to provide your subnet mask. However, these bits should be kept contiguous when creating the mask because this makes the address more readable and easier to administer. It is also recommended that, whenever possible, use 8 or 4 bits for the mask. Again, this makes understanding the subnetting values a lot easier.
Looking at a subnet mask of 255.255.255.0. This has a bit representation of:
11111111 11111111 11111111 00000000
In order for a host or router to apply the mask, it performs a logical_AND of the mask with the IP address it is trying to route (for example, 172.16.3.14).
10000000 00001010 00000011 00001110
11111111 11111111 11111111 00000000 logical_AND
10000000 00001010 00000011 00000000
The result provides the subnet value of 172.16.3. A subnet is normally identified as a concatenation of the network number and subnet number.The trailing zero is not normally shown. The original datagram can now be routed to its destination within the network based on its subnet value.
Not all networks need subnets, meaning they use the default subnet mask. This is basically the same as saying that a network doesn’t have a subnet address. Table 3.1 shows the default subnet masks for Classes A, B, and C. These default masks cannot change. In other words, you can’t make a Class B subnet mask read 255.0.0.0. If you try, the host will read that address as invalid and usually won’t even let you type it in. For a Class A network, you can’t change the first byte in a subnet mask; it must read 255.0.0.0 at a minimum. Similarly, one cannot assign 255.255.255.255, as this is all 1s—a broadcast address. A Class B address must start with 255.255.0.0, and a Class C has to start with 255.255.255.0.
Table1.1 Default Subnet Mask
CLASS FORMAT DEFAULT SUBNET MASK
A network.node.node.node 255.0.0.0
B network.network.node.node 255.255.0.0
C network.network.network.node 255.255.255.0
2.3 Classless Inter-Domain Routing (CIDR)
It’s basically the method that ISPs (Internet Service Providers) use to allocate an amount of addresses to a company, a home—a customer. They provide addresses in a certain block size. When one receive a block of addresses from an ISP, what you get will look something like this: 192.168.10.32/28. This is telling you what your subnet mask is. The slash notation (/) means how many bits are turned on (1s). Obviously, the maximum could only be /32 because a byte is 8 bits and there are four bytes in an IP address: (4*8 = 32). But the largest subnet mask available (regardless of the class of address) can only be a /30 because you’ve got to keep at least 2 bits for host bits. Take for example a Class A default subnet mask, which is 255.0.0.0. This means that the first byte of the subnet mask is all ones (1s), or 11111111. When referring to a slash notation, you need to count all the 1s bits to figure out your mask. The 255.0.0.0 is considered a /8 because it has 8 bits that are 1s—that is, 8 bits that are turned on. A Class B default mask would be 255.255.0.0, which is a /16 because 16 bits are ones (1s): 11111111.11111111.00000000.00000000.
Table 1.2 has a listing of every available subnet mask and its equivalent CIDR slash notation
Table 1.2
SubnetMask CIDR
255.248.0.0 /13
255.252.0.0 /14
255.254.0.0 /15
255.255.0.0 /16
255.255.128.0 /17
255.255.192.0 /18
255.255.224.0 /19
255.255.240.0 /20
255.255.248.0 /21
255.255.252.0 /22
255.255.254.0 /23
255.255.255.0 /24
255.255.255.128 /25
255.255.255.192 /26
255.255.255.224 /27
255.255.255.240 /28
255.255.255.248 /29
255.255.255.252 /30
2.4 Subnetting Class C Addresses
In a Class C address, only 8 bits are available for defining the hosts. Remember that subnet
bits start at the left and go to the right, without skipping bits. This means that the only Class C
subnet masks can be the following:
Binary Decimal CIDR
---------------------------------------------------------
10000000 = 128 /25
11000000 = 192 /26
11100000 = 224 /27
11110000 = 240 /28
11111000 = 248 /29
11111100 = 252 /30
Note /31 or /32 cannot be used, because we have to have at least 2 host bits for assigning IPaddresses to hosts.
255.255.255.192 (/26)
We’re going to subnet the network address 192.168.10.0 and subnet mask 255.255.255.192.
192.168.10.0 = Network address
255.255.255.192 = Subnet mask
_ How many subnets? Since 192 is 2 bits on (11000000), the answer would be 22.
_ How many hosts per subnet? We have 6 host bits off (11000000), so the equation would
be 26– 2 = 62 hosts.
_ What are the valid subnets? 256 – 192 = 64. Remember, we start at zero and count in our
block size, so our subnets are 0, 64, 128, and 192.
_ What’s the broadcast address for each subnet? The number right before the value of the
next subnet is all host bits turned on and equals the broadcast address.
_ What are the valid hosts? These are the numbers between the subnet and broadcast
address. The easiest way to find the hosts is to write out the subnet address and the
broadcast address. This way, the valid hosts are obvious. The following table shows
the 0, 64, 128, and 192 subnets, the valid host ranges of each, and the broadcast
address of each subnet:
The subnets (do this first) 0 64 128 192
Our first host (perform host addressing last) 1 65 129 193
Our last host 62 126 190 254
The broadcast address (do this second) 63 127 191 255
2.5 Subnetting Class B Addresses
These are the possible Class B subnet masks. Notice that we have a lot more possible subnet masks than we do with a Class C network address:
255.255.128.0 (/17) 255.255.255.0 (/24)
255.255.192.0 (/18) 255.255.255.128 (/25)
255.255.224.0 (/19) 255.255.255.192 (/26)
255.255.240.0 (/20) 255.255.255.224 (/27)
255.255.248.0 (/21) 255.255.255.240 (/28)
255.255.252.0 (/22) 255.255.255.248 (/29)
255.255.254.0 (/23) 255.255.255.252 (/30)
Example 1B: 255.255.192.0 (/18)
172.16.0.0 = Network address
255.255.192.0 = Subnet mask
First subnet 16.0 32.0
Second subnet 16.255 32.25
_ Subnets? 22 = 4.
_ Hosts? 214– 2 = 16,382 (6 bits in the third octet, and 8 in the fourth).
_ Valid subnets? 256 – 192 = 64. 0, 64, 128, 192. Note the subnetting is performed
in the third octet, so the subnet numbers are really 0.0, 64.0, 128.0, and 192.0, as
shown in the table below.
_ Broadcast address for each subnet?
_ Valid hosts?
The following table shows the four subnets available, the valid host range, and the broadcast
address of each:
Subnet 0.0 64.0 128.0 192.0
First host 0.1 64.1 128.1 192.1
Last host 63.254 127.254 191.254 255.254
Broadcast 63.255 127.255 191.255 255.255
Notice that we just added the fourth octet’s lowest and highest values and came up with the
answers. Again, it’s pretty much the same as it is for a Class C subnet—we just added 0 and 255
in the fourth octet.
2.6 Subnetting Class A Addresses
Class A subnetting is not performed any differently from Classes B and C, but there are 24 bits
to play with instead of the 16 in a Class B address and the 8 in a Class C address.
Let’s start by listing all the Class A subnets:
255.128.0.0 (/9) 255.255.240.0 (/20)
255.192.0.0 (/10) 255.255.248.0 (/21)
255.224.0.0 (/11) 255.255.252.0 (/22)
255.240.0.0 (/12) 255.255.254.0 (/23)
255.248.0.0 (/13) 255.255.255.0 (/24)
255.252.0.0 (/14) 255.255.255.128 (/25)
255.254.0.0 (/15) 255.255.255.192 (/26)
255.255.0.0 (/16) 255.255.255.224 (/27)
255.255.128.0 (/17) 255.255.255.240 (/28)
255.255.192.0 (/18) 255.255.255.248 (/29)
255.255.224.0 (/19) 255.255.255.252 (/30
Subnetting Class A Addresses
Example 1: 255.255.0.0 (/16)
Class A addresses use a default mask of 255.0.0.0, which leaves 22 bits for subnetting since you
must leave 2 bits for host addressing. The 255.255.0.0 mask with a Class A address is using
8 subnet bits.
_ Subnets? 28 = 256.
_ Hosts? 216 – 2 = 65,534.
_ Valid subnets? 256 – 255 = 1. 0, 1, 2, 3, etc. (all in the second octet). The subnets would
be 10.0.0.0, 10.1.0.0, 10.2.0.0, 10.3.0.0, etc., up to 10.255.0.0.
_ Broadcast address for each subnet?
_ Valid hosts?
The following table shows the first two and last two subnets, valid host range, and broadcast
addresses for the private Class A 10.0.0.0 network:
Subnet 10.0.0.0 10.1.0.0 … 10.254.0.0 10.255.0.0
First host 10.0.0.1 10.1.0.1 … 10.254.0.1 10.255.0.1
Last host 10.0.255.254 10.1.255.254 … 10.254.255.254 10.255.255.254
Broadcast 10.0.255.255 10.1.255.255 … 10.254.255.255 10.255.255.255