USB Networking on Ubuntu

To get USB networking running from an Ubuntu PC, the instructions in USBNetworking will work, but there are two wrinkles.

Firstly, make sure that the Ubuntu network manager is set to configure usb0 correctly.

  1. Open System -> Preferences -> Network Connections

  2. Make sure there's a network interface in there which refers to usb0. It might be 'Auto usb0' or just 'usb0'. Select it and press 'Edit'.
  3. Ensure that 'Connect automatically' and 'Available to all users' are checked.
  4. Click the 'IPv4 Settings' tab.
  5. Select method 'Manual'.
  6. Set the address to 10.1.1.1, Netmask to 255.255.255.0 and Gateway to 0.0.0.0.
  7. Click 'Routes...'
  8. Check 'Use this connection only for resources on its network'
  9. Press OK, then Apply, then Close.

Secondly, a udev rule has to be added so that ifup and ifdown get run at the right times. Normally Ubuntu relies on its network manager to do this, but it doesn't support what we want to do.

Courtesy of http://asleepfromday.wordpress.com/2008/09/27/udev-and-allow-hotplug-on-ubuntu-and-debian/, a suitable udev rule to put in /etc/udev/rules.d/85-ifupdown is:

SUBSYSTEM=="net", GOTO="net_start"
GOTO="net_end"

LABEL="net_start"

ACTION=="add",          RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifup -- --allow hotplug $env{INTERFACE}"
ACTION=="remove",       RUN+="/sbin/start-stop-daemon --start --background --pidfile /var/run/network/bogus --startas /sbin/ifdown -- --allow hotplug $env{INTERFACE}"

LABEL="net_end"

Balloonboard: USBNetworkingUbuntu (last edited 2009-09-30 19:07:35 by ChrisJones)