To define the network and host portions of an address, the devices use a separate 32-bit pattern called a subnet mask. We express the subnet mask in the same dotted decimal format as the IPv4 address. The subnet mask is created by placing a binary 1 in each bit position that represents the network portion and placing a binary 0 in each bit position that represents the host portion.
The prefix and the subnet mask are different ways of representing the same thing - the network portion of an address.
Default Subnet Mask:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
A routing system used by routers and gateways on the backbone of the Internet for routing packets. CIDR replaces the old class method of allocating 8, 16, or 24 bits to the network ID, and instead allows any number of contiguous bits in the IP address to be allocated as the network ID. For example, if a company needs a few thousand IP addresses for its network, it can allocate 11 or 12 bits of the address for the network ID instead of 8 bits for a class C (which wouldn’t work because you would need to use several class C networks) or 16 bits for class B (which is wasteful).
How It Works?
CIDR assigns a numerical prefix to each IP address. For example, a typical destination IP address using CIDR might be 18.104.22.168/13. The prefix 13 indicates that the first 13 bits of the IP address identify the network, while the remaining 32 - 13 = 19 bits identify the host. The prefix helps to identify the Internet destination gateway or group of gateways to which the packet will be forwarded. Prefixes vary in size, with longer prefixes indicating more specific destinations. Routers use the longest possible prefix in their routing tables when determining how to forward each packet. CIDR enables packets to be sent to groups of networks instead of to individual networks, which considerably simplifies the complex routing tables of the Internet’s backbone routers.
How to Create Subnets?
To create subnetworks, you take bits from the host portion of the IP address and reserve them to define the subnet address.
How many bits to borrow?
- No of subnetwork = 2BB
- of usable hosts per subnetwork=2BR-2
TB=BR + BB
TB=Total bits in host portion
Subnetting Class C Addresses
There are many different ways to subnet a network. The right way is the way that works best for you. 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:
Subnetting Class C Address: 192.168.10.0/26
In this second example, we’re going to subnet the network address 192.168.10.0 using the subnet mask 255.255.255.192.
192.168.10.0 = Network addresses 255.255.255.192 = Subnet mask Now, let’s answer the big five:
How many subnets? Since 192 is 2 bits on (11000000), the answer would be 22 = 4 subnets. 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. (Magic Number=256-Subnet Mask)
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. For the zero subnet, the next subnet is 64, so the broadcast address for the zero subnet is 63.
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.
Subnetting Class B Address: 172.16.0.0/17
172.16.0.0 = Network address 255.255.128.0 = Subnet mask
Subnets? 21 = 2 (same as Class C).
Hosts? 215 – 2 = 32,766 (7 bits in the third octet, and 8 in the fourth).
Valid subnets? 256 – 128 = 128. 0, 128. Remember that subnetting is performed in the third octet, so the subnet numbers are really 0.0 and 128.0, as shown in the next table.
These are the exact numbers we used with Class C; we use them in the third octet and add a 0 in the fourth octet for the network address.
Broadcast address for each subnet?