Subnet Mask PDF
Subnet Mask PDF
Subnet Mask PDF
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.
CIDR:
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 177.67.5.44/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.
1. No of subnetwork = 2BB
2. No. of usable hosts per subnetwork=2BR-2
TB=BR + BB
TB=Total bits in host portion
BB=Bits borrowed
BR=Bits Remaining
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
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 sub-
nets, the valid host ranges of each, and the broadcast address of each subnet:
255.255.128.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.
Valid subnets? 256 – 192 = 64. 0, 64, 128, 192. Remember that 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 next table.
The following table shows the four subnets available, the valid host range, and the broadcast address of each:
Another Example:172.16.0.0/25
255.255.255.128 (/25)
This is one of the hardest subnet masks you can play with. And worse, it actually is a really
good subnet to use in production because it creates over 500 subnets with 126 hosts for each
subnet—a nice mixture. So, don’t skip over it!
172.16.0.0 = Network address
255.255.255.128 = Subnet mask
Subnets? 29 = 512.
Hosts? 27 – 2 = 126.
Valid subnets? Okay, now for the tricky part. 256 – 255 = 1. 0, 1, 2, 3, etc. for the third octet. But you can’t
forget the one subnet bit used in the fourth octet. You actually get two subnets for each third octet value, hence
the 512 subnets. For example, if the third octet is showing subnet 3, the two subnets would actually be 3.0 and
3.128.
Broadcast address for each subnet?
Valid hosts?
The following table shows how you can create subnets, valid hosts, and broadcast addresses using the Class B
255.255.255.128 subnet mask (the first eight subnets are shown, and then the last two subnets):
Subnet 0.0 0.128 1.0 1.128 2.0 2.128 3.0 3.128 ... 255.0 255.128
Broadcast 0.127 0.255 1.127 1.255 2.127 2.255 3.127 3.255 ... 255.127 255.255
First host 0.1 0.129 1.1 1.129 2.1 2.129 3.1 3.129 ... 255.1 255.129
Last host 0.126 0.254 1.126 1.254 2.126 2.254 3.126 3.254 ... 255.126 255.254
Source : http://dayaramb.files.wordpress.com/2011/03/computer-network-notes-pu.pdf