I’ve recently fielded a few queries on the usage of /24 versus /32 in an access control list (ACL) rule. As an example, consider this practice test question:
Q. You need to configure a firewall to allow traffic from Homer’s computer to all of the servers within the 192.168.8.0/24 network. The following graphic shows a partial network diagram. Click it to view the image in full size.
Which of the following choices is the BEST to identify the source in the ACL rule?
A. 192.168.5.10/24
B. 192.168.5.10/32
C. 192.168.10.0/24
D. 192.168.10.0/32
Do you know the answer? More, do you know why the correct answer is correct and the incorrect answers are incorrect? The answer and explanation is available at the end of this post.
ACL Rules
ACL rules typically include the following information:
- Permission (allow or deny)
- Destination protocol (typically TCP, UDP, or ANY)
- Destination port (the port used on the destination system)
- Source IP address (where traffic is coming from)
- Destination IP address (where traffic is going to)
As an example, if you want to allow HTTPS traffic from the 192.168.5.0/24 network to the 192.168.8.0/24 network, you would use the following information in the rule.
Permission | Protocol | Port | Source | Destination |
Allow | TCP | 443 | 192.168.5.0/24 | 192.168.8.0/24 |
Note that all routers and firewalls don’t put this information in the same order. The important point is to understand the five elements (permission, protocol, port, source, and destination),
CIDR Notation
Classless Inter-Domain Routing (CIDR) notation expresses the subnet mask as a forward slash followed by a number (such as /24).
Consider an IP address of 192.168.1.10 with a subnet mask of 255.255.255.0. Using CIDR notation, you would express this as 192.168.1.10/24.
Remember that an IPv4 address is 32 bits long and the subnet mask is 32 bits long. You could express the IP address and subnet mask in binary like this:
IP address 192.168.1.10: 1100 0000 . 1010 1000 . 0000 0001 . 0000 1010
Subnet Mask 255.255.255.0: 1111 1111 . 1111 1111 . 1111 1111 . 0000 0000
Count the number of 1 bits in the subnet mask. You see that the first set is 8 bits, the second set is 8 bits, and the third set is 8 bits. The subnet mask has a total of 24 bits that are 1s so we can express this as /24 instead of 255.255.255.0.
CIDR Notation in an ACL Rule
Many routers and firewalls require you to combine the subnet mask (entered with CIDR notation) with the IP address.
As an example, imagine that you want to allow all traffic from computers in the 192.168.5.0/24 network to all computers in the 192.168.8.0/24 network.
The source is 192.168.5.0/24.
The destination is 192.168.8.0/24.
Using /32 in the ACL
What if you only want to allow traffic from a single computer (or to a single computer)?
As an example, what if you want to allow Lisa’s computer to send traffic to any of the servers in the 192.168.8.0/24 network, how would you identify only Lisa’s computer.
You might think that you could use 192.168.5.11/24 as the source because that identifies Lisa’s computer.
However, many routers and firewalls don’t interpret this as a single IP address. Instead, they interpret it as 192.168.5.0/24 and allow traffic from all computers in the 192.168.5.0/24 network.
If you want to identify only a single computer in the rule, you need to use /32 to mask the entire IP address. In other words, you would enter 192.168.5.11/32 to identify the source. The /32 equates to 255.255.255.255 for the subnet mask.
Do all routers and firewalls use /32 in the ACL rules?
No. Vendors can implement rules differently.
However, if you’re preparing to take the Security+ exam you should be aware of this practice used by many vendors.
You need to configure a firewall to allow traffic from Homer’s computer to all of the servers within the 192.168.8.0/24 network. The following graphic shows a partial network diagram (click it to view the image in full size).
Which of the following choices is the BEST to identify the source in the ACL rule?
A. 192.168.5.10/24
B. 192.168.5.10/32
C. 192.168.8.0/24
D. 192.168.8.4/32
B is the correct answer. The question is asking for the source (where traffic is coming from) and Homer’s computer IP address is 192.168.5.5. Because you only want to allow traffic from Homer’s computer , you use CIDR notation of /32.
If you used CIDR notation of /24, it would allow traffic from any of the computers in the 192.168.5.0/24 subnet. However, the requirement is to only allow traffic from Homer’s computer.
The rule would also include the destination, which is any of the servers within the 192.168.8.0/24 network. However, the question isn’t asking for the destination.
If the destination was set as 192.168.8.4/32, it would only allow traffic to Web Server 1. Again though, the question isn’t asking for the destination and it also states that traffic to any servers in the 192.168.8.0/24 network should be allowed.
The following links include additional information on firewalls rules.
Security+ and Firewall Rules Video
Page 1 of 3 ACLs and Security+
Page 2 Firewall Rules and Security+
Page 3 Firewall Rules Solution
Darril, the graphic in this question may not be right. The IP address for Homer in the graphic is 192.168.5.10, and the IP address in the (text) answer is 192.168.5.5. You may want to review and change one of them.
Thanks for the feedback. You’re correct and I just fixed it.