If you work with networks, odds are pretty good that you're familiar with Cisco IP subnetting. But that doesn't mean you know all there is to know. It never hurts to refresh your subnetting skills—particularly if you're planning on taking a Cisco exam soon.
IP subnetting isn't some obscure, esoteric topic that only the network administration "gurus" can understand. In fact, you should be able to get a firm grasp on subnetting in about an hour.
However, just like almost anything else, you won't be able to understand subnetting unless you use it—and practice. Learning subnetting takes some repetition. And once you do learn it, you'll quickly forget it if you don't practice it periodically.
What is IP subnetting?
Subnetting means breaking a large network into smaller networks. You can accomplish this by changing the subnet mask.
When it comes to subnetting, how are routers different from computers?
Every computer needs three components in order to communicate both on its network and outside its network (e.g., to the Internet).
- An IP address
- A subnet mask: Combined with the IP address, the subnet mask tells the computer which IP addresses are on its local network.
- A default gateway: A computer uses the default gateway to transmit data not on its local network. If a computer only needs to communicate on its own LAN, a default gateway isn't necessary.
Routers function similarly to computers; every interface has an IP address and a subnet mask. While routers can also have default gateways, they don't always have them.
In addition, every interface on a router must be on a different network. In fact, the router won't let you place two interfaces on the same network.
Where did subnetting come from?
Published in 1990, RFC 1166 specified five different classes of IP addresses:
- Class A: Any IP address that begins with 1 to 127 has a subnet mask of 255.0.0.0.
- Class B: Any IP address that begins with 128 to 191 has a subnet mask of 255.255.0.0.
- Class C: Any IP address that begins with 192 to 223 has a subnet mask of 255.255.255.0.
- Class D is for multicast traffic only.
- Class E is experimental.
However, these fixed classes and subnet masks didn't fit the growth requirements of the Internet, and the industry abandoned them in favor of Classless Inter-Domain Routing (CIDR) in 1995 (RFC 1817). CIDR uses variable length subnet masks (VLSM) (RFC 1518 and RFC 1519). That means the classes above, with their fixed length subnet masks (FLSM), were no longer applicable.
VLSM means that the subnet mask can dynamically change based on how many networks or hosts you need. So, while it's important to know the default (fixed length) subnet masks for testing purposes, a subnet mask for an IP that begins with 192 may or may not be 255.255.255.0.
What do 1s and 0s have to do
Subnetting is taking the original subnet mask and adding bits to it to create more networks. In other words, if you convert a subnet mask into binary form and add more 1s, you are subnetting that network. The more 1s that are present in the subnet mask means the more networks with a fewer number of hosts. The more 0s that are present in the subnet mask means the fewer networks and the more hosts you have.
In other words, the subnet mask tells routers and computers which portion of the IP address is for the network and which is for the host. If you slide the line between network and host to the left, you create fewer networks and more hosts. If you slide the line to the right, you create more networks and fewer hosts.
How can I write out subnet masks?
You can write out subnet masks in two different ways: dotted decimal notation and slash notation. The dotted decimal notation method is more than likely what you're familiar with. This involves writing the numbers and separating them by periods (i.e., dots). For example, you would write a Class C default subnet mask as 255.255.255.0.
To use the slash notation method, you convert the subnet mask into binary form, writing the number of 1s in the subnet mask instead. For example, in binary form, 255.255.255.0 would be 11111111 11111111 11111111 00000000.
In slash notation, this "translates" to /24—in other words, the number of 1s. So, you would write your IP network with its subnet mask like this: 192.168.1.0/24. While the slash notation method may seem more complicated, keep in mind that it makes diagramming and note taking easier.
How can I learn more?
You can find a wealth of information on the Internet to learn more about subnetting. Here are some resources I recommend:
- "TechRepublic Tutorial: Subnetting a TCP/IP network"
- "IP Addressing and Subnetting for New Users" Cisco documentation
- The TCP/IP Guide Web site
- Learn to Subnet Web site
Stay tuned: Next time, I'll tell you five more things you need to know about Cisco IP subnetting, including various subnetting formulas, where to find subnetting calculators, what you need to know about subnetting for the CCNA exam, and more.
Want to learn more about router and switch management? Automatically sign up for our free Cisco Routers and Switches newsletter, delivered each Friday!
David Davis has worked in the IT industry for 12 years and holds several certifications, including CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of systems/network administrators for a privately owned retail company and performs networking/systems consulting on a part-time basis.