čtvrtek 27. září 2012

Linux router iptables quick how-to

# Delete old configuration, if any
# Flush all the rules in filter and nat tables

iptables --flush

iptables --table nat --flush

# Delete all chains that are not in default filter and nat table, if any

iptables --delete-chain
iptables --table nat --delete-chain


# Set up IP FORWARDing and Masquerading (NAT)
# Interface with internet connection

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

# Interface with nat-ed clients

iptables --append FORWARD --in-interface eth1 -j ACCEPT

#enable IP forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Žádné komentáře: