Tuesday, June 2, 2009

ip range with ipables | specify source ip range in iptables | specify destination ip range in iptables

iptables can use a range of IP address.
I have tested with iptables version 1.3.7 with Linux Kernel version 2.6.21-7.
Range specification depends on "iprange" module of iptables.


To specify a range of source IP address with iptables, use the following syntax,
# iptables -A INPUT -p tcp -m iprange --src-range 192.168.2.2-192.168.2.50 -j ACCEPT

To specify a range of destinationIP address with iptables, use the following syntax,
# iptables -A INPUT -p tcp -m iprange --dst-range 192.168.2.51-192.168.2.100 -j DROP


No comments:

Art Auctions starting at $1