$> iptables -t nat -A PREROUTING -p tcp -i eth1 -dport 80 -j DNAT -to 192.168.1.2 $> iptables -t nat -A OUTPUT -p tcp -dport 80 \ $> iptables -t nat -A POSTROUTING -p tcp -dport 110 \ $> iptables -t nat -A PREROUTING -p tcp -dport 5001 \ $> iptables -t nat -A PREROUTING -p tcp -dport 5000 $> iptables -t nat -A PREROUTING -i eth0 -p tcp -dport 80 # Options for DNAT (abstract of manual page) # Options for SNAT (abstract of manual page) $> iptables -t nat -A POSTROUTING -p tcp -s 192.168.1.2 \ # (a backslash indicates contination at the next line) $> iptables -t nat -A POSTROUTING -o eth1
# all packets except TCP packets and except packets from 192.168.1.2: $> iptables -t nat -A POSTROUTING -p udp -d 192.168.1.2 $> iptables -t nat -A POSTROUTING -p tcp -s 192.168.1.2 # remove user-defined chain with index 'myindex':
Iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE Iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE