User Tools

Site Tools


doc:recipes:ethernetoverusb_rndis

Use RNDIS USB Dongle for WAN connection

RNDIS (Remote Network Driver Interface Specification) is ethernet over USB protocol used by some fast speed USB modems/dongles.

For more more information about different protocols used:

Setting up RNDIS-based dongles

(This section is based on experience with Bleeding Edge r47548 from December of 2015 on a wt3020 and connecting to an Alcatel Onetouch L850.).

For rndis devices, only a limited subset of packages are necessary (besides the base USB packages, that are most likely already contained in the base image):

opkg update
opkg install kmod-usb-net-rndis usb-modeswitch

kmod-usb-net-rndis will also install kmod-mii, kmod-usb-net, kmod-usb-net-cdc-ether and kmod-usb-net-rndis as dependencies.

After installing the packages and connecting the USB stick, the following should appear in dmesg:

[  847.390000] usb 1-1: new high-speed USB device number 3 using ehci-platform
[  847.590000] usb 1-1: no of_node; not parsing pinctrl DT
[  847.610000] rndis_host 1-1:1.0: no of_node; not parsing pinctrl DT
[  847.620000] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-101c0000.ehci-1, RNDIS device, 72:4d:eb:bb:e2:60

You can verify the interface details on the new usb0 network interface by running ifconfig usb0.

If the USB stick will be your only WAN connection, then the easiest way to set up the automatic connection is to change /etc/config/network to be something like:

config interface 'wan'
        option ifname 'usb0'
        option proto 'dhcp'

(you need to reboot or restart the network subsystem with /etc/init.d/network restart afterwards)

Since RNDIS-based sticks create their own NATted IP subnet, it is important that OpenWRT's local IP range is different from the 4G stick's IP range. In the case of the Alcatel L850, the default range is 192.168.1.1, which clashes with OpenWRT's default. Therefore OpenWRT's LAN IP should be changed to something else, such as:

config interface 'lan'
        option ipaddr '10.10.10.1'

If auto-connect is disabled, or PIN-request is enabled on the 4G stick, you may have to visit the dongle's admin web interface (typically 192.168.1.1) to enter the PIN or initiate the 4G connection. You can do this from your PC connected to the OpenWRT wifi.

RNDIS Troubleshooting

If you only see the usb messages, but not the rndis_host messages, then modesetting may be at fault.

Checking /sys/kernel/debug/usb/devices , the device should look like this:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bbb ProdID=0195 Rev= 2.28
S:  Manufacturer=Alcatel
S:  Product=MobileBroadBand
S:  SerialNumber=0123456789ABCDEF
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA
A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=03
I:* If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host
E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

and not like this:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1bbb ProdID=f000 Rev= 2.28
S:  Manufacturer=Alcatel
S:  Product=MobileBroadBand
S:  SerialNumber=0123456789ABCDEF
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none)
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

(note the number of interfaces "#Ifs=" and the "ProdID=")

RNDIS Security Note

:!: Leaving your RNDIS-based dongle admin web interface available to LAN users might not be something you would like to do, as there is usually no authentication mechanism there. To protect it, you can add the following rule to Network→Firewall→Custom Rules:

iptables -A forwarding_lan_rule -d 192.168.1.0/24 -m comment --comment "no access to USB dongle from LAN" -j DROP

Now, if you need to access your dongle web interface, log in to your OpenWRT box with:

ssh -L 8080:192.168.1.1:80 root@your-openwrt-ip

and point your browser to http://localhost:8080.

doc/recipes/ethernetoverusb_rndis.txt · Last modified: 2017/04/02 13:49 by Jalakas