Diario

Thursday, December 29, 2005

Gateway based Iptables

You only create this file named gateway.sh and put into /etc/rc.local
cat gateway.sh
#!/bin/bashecho 1 > /proc/sys/net/ipv4/ip_forward
iptables --flushiptables --table nat --flushiptables --delete-chainiptables --table nat --delete-chain
# Set up IP FORWARDing and Masqueradingiptables --table nat --append POSTROUTING --out-interface eth2 -j MASQUERADEiptables --append FORWARD --in-interface eth0 -j ACCEPT