Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save OoHerbethoO/81fce45b35b75e4ab900ec0e9d5ce9c6 to your computer and use it in GitHub Desktop.
Save OoHerbethoO/81fce45b35b75e4ab900ec0e9d5ce9c6 to your computer and use it in GitHub Desktop.
USB tethering is used to connect your OpenWrt Router to the Internet by using the your smartphone. It's more convenient and has better performance (lower latency) than turning your smartphone into an access point and using that. It also is less of a CPU load on your phone, charges your phone, and allows you the flexibility of doing things with y…
Installation
For the easiest installation, have a wired ethernet upstream internet connection to boot-strap this process. You will need: the router, your tethering phone, necessary cables, a laptop and an upstream internet connection via ethernet for initial setup. Instead of a wired upstream connection to plug into the router WAN port, is also possible to download necessary packages below, through your laptop while tethered to your phone, the same way you can get the OpenWrt distribution for your router. That is not covered in this guide.
Once OpenWRT is installed on the router,
Install some Kernel packages to get USB tethering support: Go to http://192.168.1.1 and log in to the router. Click on System, Administration, and SSH. Set the 'Interface' to 'LAN', then click 'Save & Apply'. You can now use an SSH client like Putty to connect to the router and issue commands. SSH into the router on 192.168.1.1 and log in.
Enter the commands:
opkg update
opkg install kmod-nls-base kmod-usb2 kmod-usb-core kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-rndis kmod-usb-ohci kmod-usb-uhci
nstallation for iOS devices
Install these packages:
opkg update
opkg install kmod-usb-net kmod-usb-net-rndis kmod-usb-net-cdc-ether kmod-usb-net-ipheth usbmuxd libimobiledevice usbutils
To poke iOS to start sharing the connection, execute usbmuxd on the router:
/usr/sbin/usbmuxd -v
you now should get the trust-question on your iPhone and the eth-interface should come up.
Configuration
On the Android Smartphone
Connect the smartphone to the USB port of the router with the USB cable, and then enable USB Tethering from the Android settings. You can, additionally, turn on the phone's Developer Options. There is a Default USB Configuration: USB Tethering option. The phone will immediately to USB Tethering mode when plugged into the router. However, it is necessary to remove the screen lock on the phone. A locked phone will not start USB Tethering by itself.
Using SSH on the router
On most routers using an Android device, continue to connect with SSH and enter:
opkg install nano
nano etc/config/network
Look for the line:
config interface 'wan'
On the line below it, change:
option ifname 'eth1'
to:
option ifname 'usb0'
Press CTRL+X to exit Nano, and when prompted to save, press 'Y'. Reboot your router, ensuring tethering is enabled on the phone.
It should be all working at this point. To activate wireless connections to the router, go to Network, Wireless and set then enable the interfaces.
Troubleshooting
If all went well, you should be able to see something like the following in the kernel log
click on Status and then on Kernel Log to see this log from the LuCi web interface
or write “dmesg” in the console over SSH.
[ 168.599245] usb 1-1: new high-speed USB device number 2 using orion-ehci
[ 175.997290] usb 1-1: USB disconnect, device number 2
[ 176.449246] usb 1-1: new high-speed USB device number 3 using orion-ehci
[ 176.654650] rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-f1050000.ehci-1, RNDIS device, ee:da:c0:50:ff:44
Note how the last line tells us that this new “RNDIS device” was bound to interface usb0. :!: The above messages will not be shown with IPhone tethering.
Alternate: Using the router web interface (LuCI) to modify settings for tethering
Go to Network, Interfaces. Create a new interface called TetheringWAN, and bind to it the new *usb0* network device (or for some cases '*eth1*, check what the log is showing in your case), set the protocol to DHCP client mode, and under the Firewall Settings tab, place it into the WAN zone. Save changes.
See the following screenshots.
https://openwrt.org/_media/docs/guide-user/advanced/image_create_new_interface.png?w=800&tok=1b4f10
https://openwrt.org/_media/docs/guide-user/advanced/image_create_new_interface_set_firewall_region.png
https://openwrt.org/_media/docs/guide-user/advanced/image_create_new_interface_end_result.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment