29/04/2010 @ 12:24:23:
share internet with iptables
# Defines the location of iptables executables.
iptables=/sbin/iptables
#Clears if any old iptable rules/ policies are there.
echo "Cleaning table..."
iptables --flush -t nat
# Now we will do Masquerading ie. we are doing NAT.
echo "Allowing Masquerading..."
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
# Enabling packet forwarding.
echo "Allowing Forwarding..."
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Allowing D-Link remote management..."
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 192.168.1.252 --dport 9091 -j DNAT --to 10.10.10.254:80
iptables -A FORWARD -p tcp -i eth1 -o eth0 -d 10.10.10.254 --dport 80 -j ACCEPT
Lire la suite?