Синергия ворованного из интернета.
C eth0 на eth1
gw
eth0 - х.х.х.х
eth1 - х.х.х.х
Правила на gw
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth0 DROP
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWART -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
C eth0 на eth1
gw
eth0 - х.х.х.х
eth1 - х.х.х.х
Правила на gw
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth0 DROP
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWART -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT