Setup Internet Gateway in Linux
Saturday, 16. September 2006, 16:25:13
# Delete and flush. Default table is "filter". Others like "nat" must be
# explicitly stated.
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
# Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface eth0 \
-j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
A good tutorial on iptables
2. You can create your own startup script in /etc/init.d/ or just modify one of the scripts to
perform some customized tasks. Here is a video tutorial on Debian Startup scripts.
3. Gnome or KDE provides networking configuration GUI. It enables you to configure the network interfaces. The actual configuration file is /etc/network/interfaces. Somtimes you may find this configuration tool is not powerful enough, e.g., you want to configure the mode or frequency of your wirelss cards. In this case, you may need to put something in your startup scripts such as
iwconfig eth1 mode ad-hoc iwconfig eth1 freq 2.457G iwconfig eth1 channel 10 ......

