LeapFrog Pollux Platform: Internet Access
There are two methods of accessing the internet from your LeapFrog Pollux Platform device. While both require hooking up to a host PC, you can either using routing, or bridging to make the connection. Either way nets you the same goal. Some differences are Bridging deals with Layer 2 of the OSI model and and allow DHCP broadcasts, while Routing involves Layer 3.
For the Didj, it requires you Enable Networking
Configuring the Host
For this tutorial we'll use these IP address.
- Host usb0 is assigned 10.0.0.1
- Device usb0 is assignged 10.0.0.2
Configure the host machine's /etc/network/interfaces file as follows as root.
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto usb0 iface usb0 inet static address 10.0.0.1 netmask 255.255.255.0 up route add -net 10.0.0.0 netmask 255.255.255.0 dev usb0 up echo 1 > /proc/sys/net/ipv4/ip_forward up iptables -P FORWARD ACCEPT up iptables -A POSTROUTING -t nat -j MASQUERADE -s 10.0.0.2 down route del -net 10.0.0.0 netmask 255.255.255.0 down echo 0 > /proc/sys/net/ipv4/ip_forward down iptables -t nat -F POSTROUTING
To apply these new settings:
$ sudo /etc/init.d/networking restart
Now you can proceed to configuring your device
This is a hybrid method using Bridging and Routing. Configuring the Host
This will require you have bridge-utils installed
$ sudo apt-get install bridge-utils
You will need to edit a couple configuration files, be sure to make a back up copy first.
Edit /etc/network/interfaces by pasting this in at the end of the file.
iface br0 inet static address 10.0.0.1 netmask 255.255.255.0 pre-up brctl addbr br0 post-down brctl delbr br0
iface usb0 inet manual pre-up ifconfig usb0 down pre-up brctl addif br0 usb0 pre-up ifconfig usb0 up post-down ifconfig usb0 down post-down brctl delif br0 usb0
Edit /etc/rc.local and paste this in just before "exit 0"
echo 1 > /proc/sys/net/ipv4/ip_forward /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE /sbin/iptables -A FORWARD -i eth0 -o br0 -m state --state RELATED,ESTABLISHED -j ACCEPT /sbin/iptables -A FORWARD -i br0 -o eth0 -j ACCEPT
$ sudo ifup br0 $ sudo /etc/rc.local
You can now proceed to configuring the device.
Configuring the Device
If you are using a standard Didj configuration and you have not yet done so, rmmod the g_file_storage kernel module and insmod the g_ether/ko module. (see http://elinux.org/Didj_Networking_HOWTO#Installing_g_ether.ko)
With the USB cable connected to your host, configure an IP address on a different subnet from the rest of your LAN
# ifconfig usb0 10.0.0.2 netmask 255.255.255.0
Next, add a route from your Didj to the host (making it the gateway) using the ip address of the host's usb0 device.
# route add default gw 10.0.0.1 usb0
Finally, add nameservers to your Didj's /etc/resolv.conf file (you can add the lines from this example which uses the OpenDNS servers)
nameserver 184.108.40.206 nameserver 220.127.116.11
At this point, your Didj is connected to the outside world - and a ping or a wget to yahoo or google should work.
Routing packets from the gateway to the Didj.
Thanks to losinggeneration for useful input on this!