Calculating Subnet Masks Constructing Network Addresses Calculating Subnet Masks © 2004 Cisco Systems, Inc. All rights reserved. INTRO v2.0—5-1
Outline Overview What a Subnet Mask Does How End Systems Use Subnet Masks How Routers Use Subnet Masks Mechanics of Subnet Mask Operation Applying Subnet Mask Operation Summary Lab Exercise 5-1: Modifying the IP Subnet Mask
What a Subnet Mask Does Subnet mask used by routers and hosts to determine the number of network-significant bits in an IP address
Mail Operation Example
End System Subnet Mask Operation
How Routers Use Subnet Masks
Octet Values of a Subnet Mask Subnet masks like IP addresses can be represented in the dotted decimal format like 255.255.255.0.
Boolean AND Procedure Example
Subnet Masks on Octet Boundaries Using the Boolean or Logical “AND” Procedure 255 means all 1’s in mask - therefore copy entire octet 0 means all 0’s in mask - therefore 0 entire octet
Subnet Masks on Non-Octet Boundaries Using the Boolean or Logical “AND” Procedure 255 means all 1s in mask; therefore, copy entire octet. 0 means all 0s in mask; therefore, 0 entire octet. Any other value of octet means we must examine the address in binary format. Therefore, network address = 172.16.55.64
Example: Using a Given Class C Address and Given Subnet Mask
Using a Subnet Mask for a Class B Address
Using a Subnet Mask for a Class A Address
Summary Subnet masks help routers and end systems immediately recognize the network and subnet portion of IP addresses. End systems use subnet masks to compare the network portion of the local network addresses with the destination addresses of the packets to be sent. Routers use subnet masks to determine if the network portion of an IP address is on the corresponding routing table or if the packet needs to be sent to the next router. The subnet mask is the tool used by the router to determine which bits are routing (network and subnet) bits and which bits are host bits. The Boolean AND operation is carried out by evaluating a mask bit against an address bit and supplying a result, which is either 0 or 1.
Summary (Cont.) The effect of the Boolean operation between the IP address and the subnet mask is to replace all the host-significant part of the IP address with 0s. In CIDR notation, the value n in /n format of the representation indicates how many bits in the subnet mask are set to 1. Subnet masks that fall on the octet boundary are considered default subnet masks. The CIDR notation for the default Class A subnet mask is A=/8. The CIDR notation for the default Class B subnet mask is B=/16. The CIDR notation for the default Class C subnet mask is C=/24.
Summary (Cont.) Subnet masks that fall within an octet are considered to be on non-octet boundaries. These subnet masks are slightly more difficult to calculate than masks on octet boundaries. Determining the subnetwork number is accomplished through this procedure: Express the IP address in binary form. Express the subnet mask in binary form. Perform the AND operation on the IP address and the subnet mask, yielding the subnet address in binary form. Express the subnet address in decimal form.