Most of the time a smartphone's wifi hotspot isn't powerful enough. So you might want to use the internet via usb tethering to router for better wifi coverage.
I'm pretty sure most of the routers can't do that by default, even if they have a USB port.
That's when OpenWrt is extremely useful, openwrt usb tethering is quite simple if you've a little knowledge about it.
What you need to setup OpenWrt usb tethering ?
Of course you need a router running OpenWrt with a USB port and a smartphone or a 3G/4G router capable of USB tethering.
Beside that, you've to make sure that,
- There's atleast 20 KB free space left on the router's NOR flash memory.
- The router can connect to internet somehow, need to install drivers.
- You're not using the USB port for any other purpose, like extroot.
- Basic understanding of linux commands and OpenWrt.
Alternatively you can build a OpenWrt custom firmware including the kmod-usb-net-rndis driver.
1. Login to the router via SSH and install drivers
At this step, you need to login to your router via SSH, use Putty if you're on Windows.
Make sure the router is connected to the internet, either through the WAN interface via an ethernet cable or via WiFi client mode. I used my laptop's ethernet port to share existing wifi connection through NetworkManager.
Now update the opkg repository with
opkg update, and install the OpenWrt RNDIS driver.
opkg install kmod-usb-net-rndis
That's enough, the package kmod-usb-net-rndis will automatically pull all other dependencies.
Enjoy free shipping and One-Day delivery, cancel any time.
All kernel drivers should be loaded automatically, check it with
lsmod | grep 'rndis' command.
2. Edit network interfaces
In this step, first plugin your tethering device and check what interface is created by the rndis_host driver.
[email protected]:~# dmesg
[ 59.980000] usb 1-1: new high-speed USB device number 3 using ehci-platform [ 60.160000] rndis_host 1-1:1.0 eth2: register 'rndis_host' at usb-ehci-platform-1, RNDIS device, fc:de:56:ff:01:06
Now create a new network interface, usb_wan and configure it.
Edit the /etc/config/network file with vi, and add the lines below, anywhere you want.
config interface 'usb_wan' option ifname 'eth2' option proto 'dhcp'
Now save the changes and exit vi editor. If you're not familier with the vi text editor, have a quick look here.
IPv6 support configuration
This is optional, but if you're thinking about IPv6 connectivity, create another interface
usb_wan6 on the
/etc/config/network file and add these extra lines there.
config interface 'usb_wan6' option ifname 'eth2' option proto 'dhcpv6'
Now reload the whole OpenWrt networking stuff.
You can see the a the new network interface is now up, and got an ip address.
In the above screenshot, eth0 is the ethernet LAN interface, eth1 is the ethernet WAN interface and eth2 is the USB tethered interface.
Note: If the tethering device is assinging the router any IP between 192.168.1.1 to 255, then you may need to change the ip address of the LAN interface from 192.168.1.1 to something like 192.168.2.1.
I've to change that, as my LTE router is assigning the 192.168.1.100 address to the router, so it was not working.
Basically the smartphone acts as a USB to ethernet adapter which we need to setup. This tutorial is also applicable for those external ethernet adapters too.
So that's how to setup USB tethering on a OpenWrt router. It's simple enough if you're familier with Linux and OpenWrt, but quite dubious for beginners. I can't make it even more simplier.
What's your thought about this method of setting up USB tethering to router ? Let me know through the comments.