How /30 and /32 bit IP subnet masks can help you with Cisco Networking
When it comes to IP subnetting, as you don’t do it everyday, it can be confusing and take a while to get back into. In this article, we will cover a certain type of IP subnet mask – the /30 and /32 bit subnet mask – and find how these subnet masks can be very useful when assigning IP addressing to your WAN links and to your special router interfaces.
What is a /30 bit subnet mask?
I am sure you are used to seeing subnet masks that look like 255.255.255.0. This is a /24 subnet mask in “slash notation”. As you can see, it is much easier to type /24 than it is to type 255.255.255.0. These two are the same because if you translate 255.255.255.0 to binary, you get 11111111 11111111 11111111 00000000, or 24 one’s.
As you know a /24 bit subnet mask has 254 usable IP addresses + 1 for the broadcast + 1 for the network. This is calculated 2^8 (or 2 to the 8th power) = 256 – 2 = 254.
So what is a /30 bit mask? A /30 bit mask would be 30 one’s, leaving just 2 zero’s that could be used for host addressing. If you apply the hosts formula, you get 2^2 = 4 – 2 = 2 useable IP addresses. In other words, our network would look like this:
- Host IP
- Host IP
So what can you do with a network that only has 2 usable host IP addresses? It seems a bit limited, right? Let’s find out…
How can /30 bit subnet masks help in in IP addressing my WAN?
The point of proper IP address design is that you don’t use any more IP addresses than are absolutely needed. With a /30 bit subnet mask providing us 2 useable IP addresses, let’s think of a network where there are only 2 hosts. While this idea seems silly for IP Addressing on a LAN, it is actually perfect for IP addressing on WAN connections or any router to router connections.
For example, say that I get an Internet T1 circuit. I setup my router and connect to the ISP’s router. An Internet circuit is treated like a point to point WAN circuit. There are only 2 routers on that circuit, each connecting to each other. Then you need a network address so that that entire network can be represented in a routing table. I really don’t see any purpose for the broadcast in that scenario but it you have a network then you also have a broadcast.
What better use for a /30 subnet mask that only provides 2 useable IP addresses than to put it to work on a network with only 2 devices – a point to point T1 Internet circuit. Also, this example completely applies to a point to point private network leased line (not on the Internet).
Again, the /30 subnet mask provides the most efficient use of IP addresses by not wasting any IP addresses when it is applies to a point to point network connection.
With a Cisco router point to point connection, a /3’02 bit network in use would look like:
ip address 22.214.171.124 255.255.255.252
ip address 126.96.36.199 255.255.255.252
What is a /32 bit subnet mask & How can it help me?
So what is a /32 bit mask? A /32 bit mask would be 32 one’s, leaving just NO zero’s that could be used for host network addressing. In other words, you get just a single IP address. What use is that? Why would I want a network that has no other hosts on it and doesn’t even have room for a default gateway IP address to get to other networks? Let me show you how useful this can be…
Say that we have a Cisco router. On that router we want to have a few loopback adaptors. These are virtual network adaptors that are created on the router for special purposes like representing the router as a router ID, testing, and update sources for communication. As the loopback adaptor is directly connected to the router, it doesn’t need any default gateway to communicate as a PC would with the same IP address. For this reason, a loopback adaptor in a network with only a single useable IP address can still communicate because it is part of the router. Let’s look at some configuration…
Say I take the IP address 188.8.131.52 and subnet it with a /30 (as we talked about above). That would give me 4 IP addresses before I subtract the network and broadcast. I could then take 3 of these IP addresses, assign them as loopback adaptors, then take the 4th IP address (the network), summarize these 3 loopback adaptors into a single IP, and advertise all 3 using a routing protocol. Here is the configuration example:
ip address 184.108.40.206 255.255.255.255
ip address 220.127.116.11 255.255.255.255
ip address 18.104.22.168 255.255.255.255
Router(config)# router ospf 1 Router(config-router)# area 1 range 22.214.171.124 255.255.255.252
Router(config-router)# network x.x.x.x
This would create the 3 loopback adaptors, then summarize them into a single IP address, and send them out to our other OSPF networks to allow those networks to communicate with us and for us to communicate with them.
While I was never too crazy about math, I actually enjoy IP subnetting because I like the challenge and once you get it down, it is not as difficult as it seems. If you are looking for a good reference for IP subnetting, I can make two suggestions- My IP Subnetting Charts and the Videos at LearntoSubnet. After reading this article, I hope you can see how useful /30 and /32 bit subnet masks can be and how they can help you to chose the most efficient IP address for the job.
Do you have questions about IP Network Subnetting, Troubleshooting, or Cisco Routers? If so, please visit our Cisco Router discussion forums.
To learn more about Cisco networking, consider the Train Signal CCNA Video Training package!