Skip to main content


Showing posts from January 2, 2009

Sharing an Internet Connection on Mandriva 2009.0

Sadly and frustratingly, the Mandriva Linux wizard intended to set up Internet sharing, drakgw, is broken* and has not been well maintained. Until they fix it, here's how to do it by hand, assuming that ppp0 is your Internet-facing connection and eth0 connects to your local LAN. Thanks in part to mheanre and the folks at TWUUG.

1. Mandriva uses shorewall as the default firewall. It needs to be told to pass the data we want to allow. Edit the contents of /etc/shorewall/policy to look like this:

loc net ACCEPT
fw loc ACCEPT
fw net ACCEPT
net all DROP info
all all REJECT info
loc $FW ACCEPT -

2. Set up ip-masquerade in the kernel:

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

To make this permanent, add the following to /etc/sysctl.conf:

net.ipv4.conf.default.forwarding = 1

3. Tell iptables to use NAT:

# /sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

I found that I needed to add that line to the end of /etc/rc.d/rc.local for it t…