Letux Kernel


Table of Content

using Ethernet Gadget to do IP connection and forwarding over USB cable

Ethernet gadget

The Ethernet gadget is a kernel driver on the Letux device to allow to access the Letux device throug IP although it is connected throug an USB cable to some host computer.


  • ssh from host into Letux device
  • ssh from Letux device to the host
  • Internet access from Letux device through the host's WLAN connection
  • Internet access from the host through the Letux device (tethering)

Setup on Letux device

If you use our Debian Rootfs everything is set up. There is an usb0 interface (see ifconfig). The IP address of the device is And DNS is set up.

Setup on a Linux Host

configure network

ifconfig usb0 up

share your internet connection

on the device which should share the connection:

translate the local addresses on your outgoing interface:

iptables -t nat -A POSTROUTING -o <upstream_iface> -j MASQUERADE

enable packet forwarding for all interfaces (check if this might cause security problems in your setup):

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

Setup on Mac OS X (El Capitan)

RNDIS/Gadget Driver

Apple provides a compatible driver but it must be configured:

  1. boot the device
  2. plug in the cable to the Mac
  3. open System Preferences / Networking
  4. an RNDIS/Ethernet Gadget interface appears
  5. select it
  6. choose

    IPv4 configuration: Manual IP Address: Subnet: Router: Apply

Now you should be able to ping.

a) on the device: ping b) on the Mac: ping

If that works, you can ssh in both directions. The devices are set up with root enabled, so do:

ssh root@

IP forwarding

If you want to share the Internet connection of your Mac (e.g. WLAN) to the Letux device (so that you can e.g. apt-get install something), the standard Internet Sharing does not work.

  1. Open Internet Sharing in System Preferences and make sure that Internet Sharing does not try to share the RNDIS/Ethernet Gadget
  2. run these commands (e.g. from a shell script):

    internet=en1 # WLAN vom Mac device= # Device connected through USB over RNDIS-driver (local IP, remote IP echo "nat log on $internet from $device to any -> ($internet)" | sudo pfctl -N -f - -e sudo sysctl -w net.inet.ip.forwarding=1 sudo sysctl -w net.inet.ip.fw.enable=1

Now your Letux device should be able to ping (google) and apt-get update.


means that you enable WWAN on your Letux device and route all internet access of your Mac through that connection.

... to be described ...

Created: 7 years 9 months ago
by Nikolaus Schaller

Updated: 7 years 5 months ago
by Andreas Kemnade

Old Revisions