Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

Difference between revisions of "LeapFrog Pollux Platform: Internet Access"

From eLinux.org
Jump to: navigation, search
(Configuring the Didj)
Line 6: Line 6:
 
For the Didj, it requires you [[Didj_Enable_Networking| Enable Networking]]
 
For the Didj, it requires you [[Didj_Enable_Networking| Enable Networking]]
  
== Configuring the Host ==
+
== Routing Method ==
 +
''' Configuring the Host '''
 +
 
 
For this tutorial we'll use these IP address.
 
For this tutorial we'll use these IP address.
  
Host usb0 is assigned 10.0.0.1
+
* Host usb0 is assigned 10.0.0.1
  
Device usb0 is assignged 10.0.0.2
+
* Device usb0 is assignged 10.0.0.2
  
 
Configure the host machine's /etc/network/interfaces file as follows as root.
 
Configure the host machine's /etc/network/interfaces file as follows as root.
Line 38: Line 40:
 
  $ sudo /etc/init.d/networking restart
 
  $ sudo /etc/init.d/networking restart
  
== Configuring the Didj ==
+
Now you can proceed to configuring your device
 +
 
 +
== Bridging Method ==
 +
''' Configuring the Host '''
 +
 
 +
This will require you have bridge-utils installed
 +
 
 +
'' On Host ''
 +
sudo apt-get install bridge-utils
 +
 
 +
This examples assumes you're interface is eth0. To find what your's is run.
 +
$ sudo ifconfig
 +
 
 +
You should see 'lo' and 'eth[X]' entries, where X is a number. That is your interface, and you'll need to change references to eth0 to your number.
 +
 
 +
The bridge will be made up of the host's usb ethernet link to the Didj ''usb0'', combined with the ethernet connection ''eth0'' in a virtual 'bridge' interface called ''br0''.
 +
 
 +
The bridged interface ''br0'' will be assigned the IP configuration for the PC.
 +
 
 +
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.
 +
 
 +
<code>
 +
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 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.0/24
 +
        down echo 0 > /proc/sys/net/ipv4/ip_forward
 +
        down iptables -t nat -F POSTROUTING
 +
iface br0 inet dhcp
 +
        pre-up  echo    "Adding ethernet bridge between LeapFrog device and LAN"
 +
        pre-up  ifconfig eth0 0.0.0.0
 +
        pre-up  brctl    addbr br0
 +
        pre-up  brctl    setfd br0 0
 +
        pre-up  brctl    stp br0 off
 +
        pre-up  brctl    addif br0 eth0
 +
        pre-down echo    "Removing ethernet bridge between LeapFrog device and LAN"
 +
        post-down brctl    delif br0 eth0
 +
        post-down brctl    delbr br0
 +
        post-down ifdown eth0
 +
        post-down ifup eth0
 +
</code>
 +
 
 +
To apply these new settings:
 +
 
 +
'' On Host ''
 +
$ sudo /etc/init.d/networking restart
 +
 
 +
If you are using DHCP as we do in the above example,  make a note of your br0 ip address by typing ifconfig.
 +
 
 +
Bring the bridge up.
 +
 
 +
'' On Host ''
 +
$ sudo ifup br0
 +
 
 +
You can no 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.
 
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.

Revision as of 01:37, 9 July 2011

Summary

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.

Prerequisites

For the Didj, it requires you Enable Networking

Routing Method

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:

On Host

$ sudo /etc/init.d/networking restart

Now you can proceed to configuring your device

Bridging Method

Configuring the Host

This will require you have bridge-utils installed

On Host

sudo apt-get install bridge-utils

This examples assumes you're interface is eth0. To find what your's is run.

$ sudo ifconfig

You should see 'lo' and 'eth[X]' entries, where X is a number. That is your interface, and you'll need to change references to eth0 to your number.

The bridge will be made up of the host's usb ethernet link to the Didj usb0, combined with the ethernet connection eth0 in a virtual 'bridge' interface called br0.

The bridged interface br0 will be assigned the IP configuration for the PC.

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 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.0/24
       down echo 0 > /proc/sys/net/ipv4/ip_forward
       down iptables -t nat -F POSTROUTING
iface br0 inet dhcp
        pre-up   echo     "Adding ethernet bridge between LeapFrog device and LAN"
        pre-up   ifconfig eth0 0.0.0.0
        pre-up   brctl    addbr br0
        pre-up   brctl    setfd br0 0
        pre-up   brctl    stp br0 off
        pre-up   brctl    addif br0 eth0
        pre-down echo     "Removing ethernet bridge between LeapFrog device and LAN"
        post-down brctl    delif br0 eth0
        post-down brctl    delbr br0
        post-down ifdown eth0
        post-down ifup eth0

To apply these new settings:

On Host

$ sudo /etc/init.d/networking restart

If you are using DHCP as we do in the above example, make a note of your br0 ip address by typing ifconfig.

Bring the bridge up.

On Host

$ sudo ifup br0

You can no 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

On Didj

# 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.

On Didj

# 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 208.67.222.222
nameserver 208.61.220.220

At this point, your Didj is connected to the outside world - and a ping or a wget to yahoo or google should work.


Todo

Routing packets from the gateway to the Didj.


References

http://wiki.openmoko.org/wiki/USB_Networking

http://wiki.openzaurus.org/HowTos/USB_Networking_Without_Bridging

Acknowledgments

Thanks to losinggeneration for useful input on this!