Posted: Sun Jun 03, 2018 7:36 Post subject: Re: 2017 Update: Got it working
shenoyh wrote:
Its 2017: Several Years have passed since the original question of how to tether Android phones to DDWRT.
A couple years have also passed since MountainX went around asking about the same to several forums and threads and he was only successful in getting pointers to OLD DDWRT Wikis and threads. The DDWRT Wiki on this is outdated and does not apply to newer K3 builds that include several of the required drivers as well as built in support for things like ACM, 3G/4G modems, RNDIS.
It appears that MountainX did get this setup working based on what he has posted on an other website though we are not sure how he did it.
While it may be that DDWRT supports it, there is no Wiki article or even a forum post that details how to do this in clear steps (Android USB tethering in general which is different from using a 3G USB dongle).
After several hours searching, I finally got it working. If I had Wiki access, I could have put this in the Wiki, but unfortunately I do not have Wiki access.
Note that during the process I also found that this won't work on TPLink or other Atheros WiSOC routers - works only on ARM and maybe MIPS.
This is my router model and firmware (TMo router on Latest KONG):
Router ModelAsus RT-AC68U
Firmware Version DD-WRT v3.0-r33435M kongac (10/08/17)
Samsung Android phone connected by USB to USB2.0 port or router (though that should not matter and the 3.0 port should work well).
On the phone, I go into settings->Tethering and Hotspot-> Check the "USB Tethering" box. In order to see this box, your phone must be connected by USB to the router and may initially need to be in Data (LTE/3G mode) though you can later switch to Wifi if required.
My phone is rooted, but that should not matter so long as you see the USB tethering option.
The following will work both to share the Wifi from the phone as well as the LTE/3G:
cd /lib/modules/4.4.89
insmod usbnet.ko
insmod cdc_ether.ko
insmod rndis_host.ko
ifconfig usb0 up
udhcpc -i usb0
What it does is bring up the usb0 interface and get it an IP address which now becomes the WAN address of the router. Note that I have selected Connection Type as "Automatic Configuration - DHCP". It appears that DDWRT automatically assigns the usb0 to the WAN VLAN and so there is no need to update nvram parameters.
Credit to calamari who first did something like this on a tomato in 2012.(https://dd-wrt.com/phpBB2/viewtopic.php?t=79336&postdays=0&postorder=asc&start=15)
To makes things complete you do need to open the firewall as well to forward packets between the USB0 and the br0 which is the gateway (192.168.1.1) for your network with these firewall rules:
iptables --table nat --append POSTROUTING --out-interface usb0 -j MASQUERADE
iptables --append FORWARD --in-interface br0 -j ACCEPT
When you switch between Wifi and LTE/3G data on the phone, you may have to run (ifconfig usb0 up;
udhcpc -i usb0) each time since it loses the DHCP IP and does not automatically ask for it again.
So whats the use of this several may ask. Why not use Wifi tethering and put DDWRT in bridge mode? The answer is that not everyone does everything the same way and there are many different applications.
My goal now is to do a failover to the phone's LTE/3G only when required though its WiFi will still be active all the time. I will use an old cheap phone and I am getting a cheap data plan either an iOT data plan from AT&T or an PAYG Sprint plan that does not require monthly payment.
My security system consisting of several Wireless IP devices connect to one DDWRT router which is the security hub. This router sits on a location that does not have cable based internet access. So I have to use the phone's Wifi radio for the purpose of obtaining internet access from the distant router that has only 2.4GHz radio and I have no control of this main router. Several of my devices are not 5GHz capable and so I cannot use the 5GHZ radio at all.
So in my situation, I would use the phone's Wifi to connect to the distant router over Wifi most of the time. If that router/Wifi fails for some reason, then my phone would switch to LTE data.
While failover routing would have been best to do on the DDWRT router than on the phone, there is not sufficient information about failovers on DDWRT either...(failover from client mode to the USB tether or cabled WAN port ethernet is what I hope to get DDWRT to do in the future). So I am just using Androids build in failover mechanism at this time.
You're my hero. Thank you and others greatly for posting this information. I've crawled the net for a long time looking for a solution like this. I can confirm this method worked for me on:
Router: Linksys WRT1900ACSV2
Firmware: DD-WRT v3.0-r34080 std (12/14/17)
Kernel: Linux 4.9.69-rc1 #83 SMP Wed Dec 13 01:23:39 CET 2017 armv7l
Phone: Samsung over USB Tethering
I will note that I tried several times over the course of a couple of hours before it worked. I think it's important to reset the router prior to setting this up, and immediately start the process before configuring any other settings.
Posted: Wed Nov 07, 2018 12:24 Post subject: Re: 2017 Update: Got it working
shenoyh wrote:
Its 2017: Several Years have passed since the original question of how to tether Android phones to DDWRT.
A couple years have also passed since MountainX went around asking about the same to several forums and threads and he was only successful in getting pointers to OLD DDWRT Wikis and threads. The DDWRT Wiki on this is outdated and does not apply to newer K3 builds that include several of the required drivers as well as built in support for things like ACM, 3G/4G modems, RNDIS.
It appears that MountainX did get this setup working based on what he has posted on an other website though we are not sure how he did it.
While it may be that DDWRT supports it, there is no Wiki article or even a forum post that details how to do this in clear steps (Android USB tethering in general which is different from using a 3G USB dongle).
After several hours searching, I finally got it working. If I had Wiki access, I could have put this in the Wiki, but unfortunately I do not have Wiki access.
Note that during the process I also found that this won't work on TPLink or other Atheros WiSOC routers - works only on ARM and maybe MIPS.
This is my router model and firmware (TMo router on Latest KONG):
Router ModelAsus RT-AC68U
Firmware Version DD-WRT v3.0-r33435M kongac (10/08/17)
Samsung Android phone connected by USB to USB2.0 port or router (though that should not matter and the 3.0 port should work well).
On the phone, I go into settings->Tethering and Hotspot-> Check the "USB Tethering" box. In order to see this box, your phone must be connected by USB to the router and may initially need to be in Data (LTE/3G mode) though you can later switch to Wifi if required.
My phone is rooted, but that should not matter so long as you see the USB tethering option.
The following will work both to share the Wifi from the phone as well as the LTE/3G:
cd /lib/modules/4.4.89
insmod usbnet.ko
insmod cdc_ether.ko
insmod rndis_host.ko
ifconfig usb0 up
udhcpc -i usb0
What it does is bring up the usb0 interface and get it an IP address which now becomes the WAN address of the router. Note that I have selected Connection Type as "Automatic Configuration - DHCP". It appears that DDWRT automatically assigns the usb0 to the WAN VLAN and so there is no need to update nvram parameters.
Credit to calamari who first did something like this on a tomato in 2012.(https://dd-wrt.com/phpBB2/viewtopic.php?t=79336&postdays=0&postorder=asc&start=15)
To makes things complete you do need to open the firewall as well to forward packets between the USB0 and the br0 which is the gateway (192.168.1.1) for your network with these firewall rules:
iptables --table nat --append POSTROUTING --out-interface usb0 -j MASQUERADE
iptables --append FORWARD --in-interface br0 -j ACCEPT
When you switch between Wifi and LTE/3G data on the phone, you may have to run (ifconfig usb0 up;
udhcpc -i usb0) each time since it loses the DHCP IP and does not automatically ask for it again.
So whats the use of this several may ask. Why not use Wifi tethering and put DDWRT in bridge mode? The answer is that not everyone does everything the same way and there are many different applications.
My goal now is to do a failover to the phone's LTE/3G only when required though its WiFi will still be active all the time. I will use an old cheap phone and I am getting a cheap data plan either an iOT data plan from AT&T or an PAYG Sprint plan that does not require monthly payment.
My security system consisting of several Wireless IP devices connect to one DDWRT router which is the security hub. This router sits on a location that does not have cable based internet access. So I have to use the phone's Wifi radio for the purpose of obtaining internet access from the distant router that has only 2.4GHz radio and I have no control of this main router. Several of my devices are not 5GHz capable and so I cannot use the 5GHZ radio at all.
So in my situation, I would use the phone's Wifi to connect to the distant router over Wifi most of the time. If that router/Wifi fails for some reason, then my phone would switch to LTE data.
While failover routing would have been best to do on the DDWRT router than on the phone, there is not sufficient information about failovers on DDWRT either...(failover from client mode to the USB tether or cabled WAN port ethernet is what I hope to get DDWRT to do in the future). So I am just using Androids build in failover mechanism at this time.
I have successfully enabled USB tethering using your guide, but it doesn't work good at all. Network slows down significantly as soon as I start loading web pages, and Ping goes through the roof. I tried switching from USB 2 to USB 3 which helped a lot but still not enough. Even tried switching cable, for a thicker one... Previously I used 5G Hotspot to tehter to my router, and set a Repeater Bridge on it, which worked much much better and faster. There were no slowdowns of any kind. My hope was that USB tethering would/should work faster, but it seems I was wrong. My Router is Netgear R6400v2 running DD-WRT v3.0-r37015M kongac (09/23/18 ) , and The connection type was set to Automatic Configuration - DHCP. I didn't touch anything else except enabling USB support and shortcut forwarding engine. All other settings are stock DD-WRT.
Is there something else I could try?
1.Set a WIPS on 2.4ghz and broadcast at 5ghz wifi if router flash ddwrt fw.
2.Set a USB tethered as duo WAN on it if you convert r6400 downgrades to r6300v2 and flash with koolshare fw.
3. Set a USB tethered as duo WAN on it if you convert r6400 upgrades to r7000 and flash with xvortex fw.
I've solved the problem. Disabled Shortcut Forwarding Engine (needed for full wifi speeds on R6400v2). The network behaves as expected now, much better compared to Repeater Bridge.
I've struggled to get this working using a Xiaomi Redmi Note 7 phone tethered to a TP-Link Archer C9 v4 router running the latest beta DD-WRT firmware.
I can telnet to the router and execute the documented insmod commands successfully but when I get to the ifconfig usb0 up command, it fails with "No such device"
I've Googled and read assorted posts about using nvram to create the usb0 interface, but nothing works.
If i just enter 'ifconfig' it lists out br0, eth0, eth1, eth2, lo, vlan1, vlan2. There is no usb0 interface.
If i tether my phone direct to my laptop (with the same USB Type-C cable), it works fine through the tethered 4G data link.
If i use an old mobile phone (HTC One M7) with an old style micro-USB (TypeB) cable and connect that to my Archer C9 router, then interface usb0 is available and tethering works.
So why, when I connect my Archer C9 to the Redmi Note 7 using the manufacturer supplied USB Type-C cable, does interface usb0 not appear??
I've tried everything to make usb0 appear but just cant figure out why it wont. Any help/suggestions?
This guide has since stopped working for me, post build r51140, udhcpc seems less powerful in terms of wan network options?
No idea for native ipv6, however... If you need IPv6...
On r51140 (12-31-2022) IPv6to4 tunneling via HE works if selected in the ipv6 menu.
Use all the settings from Hurricane Electric tunnel settings, set it up like this, add a line to startup; "ifconfig ip6tun up" ping6 google.com
IPv6 (make sure clients are ipv6 enabled if desired)
6in4 HE get values from their website
DHCP Client daemon disabled
DHCP Server daemon disabled
RADVD enabled, custom config
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Fri Jun 02, 2023 10:28 Post subject:
Evrything works until:
ifconfig usb0 up
udhcpc -i usb0
Seems something has changed somewhere and current builds DD-WRT v3.0-r52720 std (05/27/23) somehow while all indicated modules are present and loaded no new adapter is created that goes by usbX or any other adapters are created, all though ifconfig can add adapters manually, this would require new steps if at all possible that way.
Anyway, after spending some time on this guide/wiki page (like 10 minutes or so) I wasn't able to get there yet due to lack of anything usbX, shame I could really use this right now as my source of Internet is an unlimited data sim Ive rented for while, so my temporary network where Im stuck at can connect to WAN via router.
I do have a workaround, but requires a 2nd ethernet port on a PC/OTher where Android phone is thered to, and then share the NDIS WAN with that 2nd ethernet which in turn connects to routers WAN, in a pinch a sloppy solution with caveats.
OFFTOPIC.
YES Im alive, news of my demise or alien abduction stories are greatly exaggerated.
Issues lie in the current kernel modules in modern dd-wrt like cdc_ether.ko and rndis_host.ko fail to provide usb0, however on this thread and post provides these compiled modules, so for a test I removed the official and shunted those in and walla usb0 came to live in ifconfig.
after a apply setting on admin tab to restart network stack since I was loading the modules from /tmp for a test, it worked after udhcpc -i usb0 I was able to tether to android phone via usb direct to router, however clearly these modules need to be recompiled for the target kernel hence maybe the flakiness.
Joined: 08 May 2018 Posts: 14125 Location: Texas, USA
Posted: Thu Jun 15, 2023 4:44 Post subject:
Yes, kernel modules have to be compiled for specific kernel version, and this could also be included out-of-the box, but that is another story altogether. Moving right along...
The most simple solution would be this (and it works):
hebeda wrote:
i think the more easy approach is a android phone with android 12 or higher and a USB to Ethernet Adapter , it should have native Ethernet tethering support.
i am using a EDUP EP-9802 USB C to Ethernet Adapter with Realtek RTL8153 Chipset for such purpose with my Xiaomi Poco X3 Pro Phone ..