Difference between revisions of "Iptables"

From Hack Sphere Labs Wiki
Jump to: navigation, search
(Created page with "*http://www.hackorama.com/network/portfwd.shtml")
 
Line 1: Line 1:
 
*http://www.hackorama.com/network/portfwd.shtml
 
*http://www.hackorama.com/network/portfwd.shtml
 +
 +
=IP Tables That Work=
 +
 +
iptables --flush
 +
iptables --table nat --flush
 +
iptables --delete-chain
 +
iptables --table nat --delete-chain
 +
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
 +
iptables --append FORWARD --in-interface tun0 -j ACCEPT
 +
echo 1 > /proc/sys/net/ipv4/ip_forward
 +
 +
client
 +
iptables --table nat --append POSTROUTING --out-interface bond0 -j MASQUERADE
 +
iptables --append FORWARD --in-interface eth1 -j ACCEPT
 +
 +
server
 +
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
 +
iptables --append FORWARD --in-interface bond0 -j ACCEPT

Revision as of 12:16, 24 July 2012

IP Tables That Work

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface tun0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

client

iptables --table nat --append POSTROUTING --out-interface bond0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT

server

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface bond0 -j ACCEPT