XO Internet Sharing with F11 Builds

My original OLPC News Post for Debian/Ubuntu on the XO:
http://www.olpcnews.com/forum/index.php?topic=4748.0

These directions work with F11 on the XO-1, but I’ve only tested os860.  YMMV and all that.

860 has dnsmasq already installed.  So it’s a “simple” matter of configuration.

Do this:

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

Edit /etc/sysctl.conf with these lines at the bottom:

net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1

Back up the dnsmasq config file:

mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak

Create this file:  /etc/dnsmasq.conf

interface=eth1
dhcp-range=172.18.0.100,172.18.0.150,24h
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
cache-size=20

Create this file:  /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
ONBOOT=yes
TYPE=Wired
IPADDR=172.18.0.1
NETMASK=255.255.0.0

Enter these lines at the bottom of /etc/rc.local:

iptables -A FORWARD -i eth0 -o eth1 -s 172.18.0.0/24 -m state –state NEW -j ACCEPT
iptables -A FORWARD -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
service iptables save

Start dnsmasq on boot (or not.  You can always do service dnsmasq start as needed.)

chkconfig –level 345 dnsmasq on

Reboot.  Connect the XO to the internet as usual.  Bring up your USB ethernet device:

sudo ifup eth1

And now anything on the other end should be getting internet.

Remember after every reboot you’ll have to:

sudo ifup eth1

To get that functionality.

You should be able to connect any wired device, even a wifi AP.  Though the wifi AP will need further configuration.

Leave a Reply