14.2.9. Using an Address Range Instead of a Group

In the example above, the three hosts used for the group "management hosts" have consecutive addresses,, Although this example may be artificial, it allows us to illustrate how a different type of object could be used to achieve the same goal - to permit access to the firewall from these three addresses. The difference may be negligible when we deal with just three addresses, but when the list gets into hundreds it may become significant.

Since addresses of the management hosts are consecutive, we can use an address range object to describe them:

Figure 14.19. Policy for the Server

Policy for the Server

We use this object in the rule just like any other object. Figure 14.20 shows the rule:

Figure 14.20. Policy for the Server

Policy for the Server

The main difference in the generated code for the rule using a address range compared to the rule using collection of individual addresses is that compiler is allowed to optimize it. It tries to squeeze the address range to the minimal set of address and network objects. Here is how it looks like for iptables:

# Rule 0 (global)
$IPTABLES -A INPUT  -s   -m state --state NEW  -j ACCEPT 
$IPTABLES -A INPUT  -s   -m state --state NEW  -j ACCEPT 

Again, the difference may not be very great when we have only three IP addresses, but in the case of a range that spans hundred addresses the performance gain and reduction in the size of generated script are significant.

The generated PF and PIX configurations look similar.


Copyright © 2000-2012 NetCitadel, Inc. All rights reserved.
 Using free CSS Templates.