4G USB Modem

Post new topic   Reply to topic    DD-WRT 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: 187

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: 110
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: 13

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?
hoot_spoot
DD-WRT User


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

PostPosted: Fri Nov 26, 2021 22:28    Post subject: IPV6 Reply with quote
Anyone know how to get ipv6 working?

https://forum.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection

_________________
various hw
baboeska
DD-WRT Novice


Joined: 22 Jun 2011
Posts: 48

PostPosted: Wed Apr 12, 2023 11:40    Post subject: Re: IPV6 Reply with quote
hoot_spoot wrote:
Anyone know how to get ipv6 working?

https://forum.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection

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

interface br0 {
AdvSendAdvert on;
prefix yourcustomprefixfromHE/64
{
AdvOnLink on;
AdvAutonomous on;
};
};
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Fri Jun 02, 2023 10:28    Post subject: Reply with quote
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.

Be well folks.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Fri Jun 02, 2023 11:18    Post subject: Reply with quote
the-joker wrote:
OFFTOPIC.
YES Im alive, news of my demise or alien abduction stories are greatly exaggerated.

Be well folks.

Then please read:

DD-WRT :: View topic - Forum search function should ignore signatures
https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=334622

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Fri Jun 02, 2023 15:46    Post subject: Reply with quote
mwchang wrote:
Then please read:


Sorry, cant help you, I need to help myself with this issue.

So ONTOPIC:

This guide https://forum.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection and this thread are pertinent.

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.

In addition other changes happen also from gleamed from https://www.reddit.com/r/DDWRT/comments/fco6um/guide_android_usb_tether_as_wan/ namely the nvram wan_ifxxxx= entries must point to usb0

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.

I had also read https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1281232#1280315 however it only gave clues that a great deal has changed to get this working with minimal fuss.

thanks for the links, just no time to waste on this for the time being to get such a basic function going.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Thu Jun 15, 2023 4:44    Post subject: Reply with quote
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...

Android phone support

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 ..

Otherwise, for emergencies I have a couple of other options using FreshTomato (that supports Android tethering out of the box).

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Thu Jun 15, 2023 12:31    Post subject: Reply with quote
the-joker wrote:
mwchang wrote:
Then please read:


Sorry, cant help you, I need to help myself with this issue.

So ONTOPIC: ....

My bad. Sorry!! And... welcome back from your wilderness!

_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Goto page Previous  1, 2, 3 Display posts from previous:    Page 3 of 3
Post new topic   Reply to topic    DD-WRT 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