I use this script for NAT:
# Enable kernel IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# Clear previous iptables
iptables --table nat --flush
iptables --table nat --delete-chain
# Set up iptables forwarding
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
I previously used this with a USB ADSL modem, but it was a very dodgy and dropped a lot, so I switched to a PPPoE ethernet modem (a Draytek Vigor 100).
To connect here I use this /etc/conf.d/net, and then connect with /etc/init.d/net.ppp0 start:
modules=( "ifconfig" )
config_eth0=( "192.168.0.2 netmask 255.255.255.0" )
eth0 is the LAN interface, eth1 is the interface connected to the modem.
This connects fine, and works absolutely fine on the machine that is connected to the modem.
However the machines connecting through it (the machines on the network) only have limited network access:
They can only browse a small number of sites, most sites will just time out. Ones that work include google.com, morse.com, cstim.com and oracle.com. They can ping anything fine, even the sites that don't work. Connecting to various IRC servers for instance irc.quakenet.org will start to connect, but simply stop half way through the MOTD.
Does anybody have any idea? I've run out of ideas here.
Thanks very much.