Setting up USB Networking

Introduction

This document has been reviewed for maemo 4.0.

This document describes how USB networking can be set up between the host Linux machine and Internet Tablet.

USB networking connects the device and Linux laptop with IP protocol over the USB cable. This provides fast and effortless access to the device and enables e.g. file copying, remote login over SSH, using of NFS and remote debugging.

Setting up Environment and Device

In order to use USB networking on the device, some extra packages must be installed such as openssh.

Linux host side instructions are for Debian and its derivatives, and might not work on other distributions.

A root shell access on the device is needed for setting up the USB networking on the device side. For this, you need to start xterm. There is a script for root access that should be run on terminal.

$ sudo gainroot

When using USB networking, device must be booted from flash, meaning that MMC dualboot is an unavailable option. The reason for this is that the device can only act as either a mass storage or network device at any given time.

Check whether the device has been pre-configured for USB networking with IP 192.168.2.15. If not, please add the following lines to your /etc/network/interfaces:

auto usb0
iface usb0 inet static
        address 192.168.2.15
        netmask 255.255.255.0
        gateway 192.168.2.14

The IP address of the host machine in the USB network has to be 192.168.2.14 for the usb0 interface.

The following steps should prepare the device and host machine for USB networking:

  1. Make sure the USB cable is disconnected.
  2. Gain root shell access on the device, and perform the following:
    # insmod /mnt/initfs/lib/modules/2.6.21-omap1/g_ether.ko
    # ifup usb0
    

    Note! You may need to run insmod twice.

  3. Make sure the kernel of the host machine has usbnet enabled.
  4. Add the following entry to the /etc/network/interfaces file of the host machine:
    mapping hotplug
            script grep
            map usb0
    
    auto usb0
    iface usb0 inet static
    address 192.168.2.14
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.255
    up iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
    up echo 1 > /proc/sys/net/ipv4/ip_forward
    down iptables -t nat -D POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
    down echo 0 > /proc/sys/net/ipv4/ip_forward
    
  5. Now both the device and the host machine should be ready for initiating a USB connection

Testing Connection

After making the preparations, the USB network should automatically be set up when connecting the device to the host machine with a USB cable.

For basic testing, pinging can be performed from the host machine.

$ ping 192.168.2.15
PING 192.168.2.15 (192.168.2.15) 56(84) bytes of data.
64 bytes from 192.168.2.15: icmp_seq=1 ttl=245 time=79.8 ms
...

Use Application Manager to install openssh from Chinook extras. Now, an ssh root shell over the USB network from host to tablet can be initiated.

$ ssh root@192.168.2.15

The password of the root is rootme.



Improve this page