Automatically set up internet sharing

Q I have a two computer network at home, one running Windows XP and the other Mandrake 10.1. The Mandrake box acts as the server for the windows machine and shares the internet connection. My trouble is that every time the internet is restarted I have to enter the following three commands as su:

iptables -t nat -A POSTROUTING -o
ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
route add default ppp0

What files do I need to edit to put those commands into so I don't have to manually do this each time?

A Once you add the iptables rule, you can do /etc/init.d/ iptables save, which will save your iptables configuration for the next reboot. IP Forwarding is enabled through /etc/sysctl.conf, where you can add a line net.ipv4.ip_forward = 1' to set up IP Forwarding next time you reboot. For the default route through ppp0, you should be able to reconfigure your dialer to automatically add a default route when the modem connects. It's difficult to stop it setting a default route, so checking the logs to establish why one is not being added may be a good place to begin.

Back to the list