Using IPTables to Allow Access to Private Networks
Below is a quick example of how to use iptables
to allow port access for all types of private networks. In this case we’re allowing access to ports 10000
and 20000
, commonly used by webmin
and usermin
.
for i in 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16; do for j in 10000 20000; do iptables -A INPUT -p tcp --dport ${j} -s ${i} -j ACCEPT done; done iptables -S && /sbin/iptables-save && /sbin/service iptables save