Record of some of the computer tech I deal with so that it's documented at least somewhere.

Tuesday, 21 August 2007

Setting up iptables as a gateway

I've realised that the server's going to have to be a gateway with only one jack, iptables is installed by default on debian.

I also found arno-iptables-firewall which might be worth revisiting.

cripes, the manpage is a manbook

trying here http://www.yolinux.com/TUTORIALS/LinuxTutorialIptablesNetworkGateway.html

iptables --flush # Flush all the rules in filter and nat tables
iptables --table nat --flush
iptables --delete-chain #Delete all chains that are not in default filter and nat table
iptables --table nat --delete-chain

# Set up IP FORWARDing and Masquerading

iptables --table nat --append POSTROUTING --out-interface eth1 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT # Assuming one NIC to local LAN

echo 1 > /proc/sys/net/ipv4/ip_forward # Enables packet forwarding by kernel

all worked out I think :)

No comments: