4G USB Modem

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3
Author Message
e.r0k
DD-WRT Novice


Joined: 03 Jun 2018
Posts: 1

PostPosted: Sun Jun 03, 2018 7:36    Post subject: Re: 2017 Update: Got it working Reply with quote
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.

Thanks again!
Sponsor
Aback
DD-WRT Novice


Joined: 06 Nov 2018
Posts: 12

PostPosted: Wed Nov 07, 2018 12:24    Post subject: Re: 2017 Update: Got it working Reply with quote
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?

Thanks.
deslatha
DD-WRT User


Joined: 12 Jul 2016
Posts: 190

PostPosted: Wed Nov 07, 2018 12:54    Post subject: Reply with quote
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.
Aback
DD-WRT Novice


Joined: 06 Nov 2018
Posts: 12

PostPosted: Wed Nov 07, 2018 13:25    Post subject: Reply with quote
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.
Saiber77
DD-WRT Novice


Joined: 10 Nov 2019
Posts: 8

PostPosted: Sun Nov 10, 2019 6:38    Post subject: Reply with quote
I followed this guide with my RT-AC68U and couldn't get it to work, "ifconfig usb0 up" returns: "ifconfig: ioctl 0x8913 failed: No such device".

Any ideas?
hoot_spoot
DD-WRT User


Joined: 07 Dec 2009
Posts: 90
Location: Earth.

PostPosted: Tue Mar 31, 2020 4:45    Post subject: Added to Wiki Reply with quote
See link: https://forum.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection
_________________
various hw
suprnova74
DD-WRT Novice


Joined: 09 Feb 2012
Posts: 12

PostPosted: Wed Jul 01, 2020 15:01    Post subject: Reply with quote
Saiber77 wrote:
I followed this guide with my RT-AC68U and couldn't get it to work, "ifconfig usb0 up" returns: "ifconfig: ioctl 0x8913 failed: No such device".

Any ideas?


I know this is a necro, but searches tend to bring this post up as one of the first hits aside from the Wiki.

For anyone else running into this issue, see https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1209728#1209728 as he explains how to find the device ID in the event it doesn't use "usb0" as well as a bunch of troubleshooting tips on performance etc.
smithbill17
DD-WRT Novice


Joined: 18 Aug 2020
Posts: 1

PostPosted: Tue Aug 18, 2020 16:14    Post subject: Reply with quote
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?
Goto page Previous  1, 2, 3 Display posts from previous:    Page 3 of 3
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum