Sample iptable Command
Putting this all together creates a firewall that can protect your network. Assume that we have a Linux router attached to a perimeter network with the address 172.16.12.254 on interface eth0 and to an external network with the address 192.168.6.5 on interface eth1. Further assume that the perimeter network contains only a sendmail server and an Apache server.
iptables -F INPUT iptables -F FORWARD iptables -A INPUT -i eth1 -j DROP iptables -A FORWARD -i eth1 -s 172.16.0.0/16 -j DROP iptables -A FORWARD -o eth1 -d 172.16.0.0/16 -j DROP iptables -A FORWARD -d 172.16.12.1 25 -j ACCEPT iptables -A FORWARD -d 172.16.12.6 80 -j ACCEPT iptables -A FORWARD -j DROP Note
|

