FORUMS
Remove All Ads from XDA

enable wireless and 4g at the same time

238 posts
Thanks Meter: 60
 
By jdock, Senior Member on 19th March 2013, 04:25 PM
Post Reply Email Thread
Is there any way to do this? It seems that when I enable wifi, the rmnet_usb0 interface becomes inaccessible (no ipv4 address). When I disable wifi, even the wlan and cfg80211 modules get unloaded. I can't seem to find the way to load them (with wifi set as disabled) to try to ifconfig the interface up. Maybe I am just going about it in the completely wrong way!

All I really want is to have both interfaces up and running at the same time, with the default gateway pointing out the rmnet_usb0 interface so that I can access the internet via 4g, but still being able to route to my local wireless lan.
The Following User Says Thank You to jdock For This Useful Post: [ View ] Gift jdock Ad-Free
 
 
19th March 2013, 04:47 PM |#2  
gunnyman's Avatar
Senior Member
Flag Greenville SC
Thanks Meter: 2,696
 
Donate to Me
More
Re: enable wireless and 4g at the same time
I think your best bet is going to be setting up a vpn
20th March 2013, 12:46 AM |#3  
chrisphoenix7's Avatar
Senior Member
Thanks Meter: 28
 
More
Re: enable wireless and 4g at the same time
My laptop has wifi and bluetooth on the same assembly, and only 1 is accessible at once. Maybe its like that.

Sent from my LG-E970 using xda app-developers app
20th March 2013, 01:31 PM |#4  
OP Senior Member
Thanks Meter: 60
 
More
I know they can physically be enabled at the same time, because the phone can be a hotspot. That doesn't really help me though if I want to connect wired devices to it. I want it to remain a wifi client.

There's an app called SuperDownload or something that uses wifi and mobile data simultaneously for downloading. It seems to bring the mobile data up in some special mode where the app can use it but it's not otherwise generally routable. That's what the author says, at least, but I'm not sure that makes sense. Normally when data is in use it basically looks like any other network interface.

A more general way of asking my question might be "what happens behind the scenes when you enable wifi?" if there's a script being run I can see what's going on (loading the module and so on) and maybe adapt it to my needs.
20th March 2013, 02:52 PM |#5  
Senior Member
Thanks Meter: 49
 
More
http://forum.xda-developers.com/show....php?t=1667025

This app uses them both simultaneously, maybe you can get some info there..
20th March 2013, 03:23 PM |#6  
OP Senior Member
Thanks Meter: 60
 
More
SUCCESS I think: enable wireless and 4g at the same time
Quote:
Originally Posted by bigworm50

http://forum.xda-developers.com/show....php?t=1667025

This app uses them both simultaneously, maybe you can get some info there..

Yep that's the one I mentioned. Doesn't seem to be much help.

I think I've gotten somewhere. I can't test this fully because I don't have access to any other machines on the current wireless lan, but I can get a dhcp address from it and ping its gateway, while meanwhile traceroutes to the internet are going through the mobile network.

1. Turn off wifi in the normal way (from the phone's user interface) if it's not already off.

All the following steps done in a root shell:

2. load the drivers

busybox insmod /system/lib/modules/cfg80211.ko
busybox insmod /system/lib/modules/wlan.ko

3. start wpa_supplicant to connect to the first available wireless network. The wpa_supplicant.conf file I list below is the one maintained automatically by the phone as you join new networks. If you want more control (e.g. connect to only a specific network), copy the wpa_supplicant.conf file somewhere, modify it as needed, and specify it on the command line.

wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf

4. dhcpcd

busybox pkill dhcpcd
rm /data/misc/dhcp/*
dhcpcd wlan0

5. verify route

busybox route

For me this is showing the original default first on the list (goes through rmnet_usb0) followed by the new one configured for the wireless lan wlan0. Traceroute shows the traffic going out the first one.

Now, at this point if you try to enable wifi normally from the phone it will not work. To make it work:

ifconfig wlan0 down
ifconfig wlan0 unplumb
rmmod wlan
rmmod cfg80211


And you can turn on wireless again.
The Following 3 Users Say Thank You to jdock For This Useful Post: [ View ] Gift jdock Ad-Free
21st March 2013, 01:33 PM |#7  
OP Senior Member
Thanks Meter: 60
 
More
I was able to test at home, and it is definitely working.

As for what this buys us, there are two things. First, I have crappy satellite internet at home, so I want to be able to transfer files back and forth, and sometimes even use the LG OSP, without my phone having to use that instead of 4G (which is marginal but still better).

More usefully, it allows non-tethered proxying. I can run a socks or http proxy on my phone and point my non-wireless devices at it, letting me browse the web without routing all my internet traffic through the phone.

I'm still a little bit away from non-wireless tethering (i.e. being able to set my pc's default gateway to my phone and have it route all internet traffic through the mobile data connection), but that would be nice as well. I will need to set up some iptables NAT stuff the way wifi tether does, and I haven't gotten the right combination yet since I don't get much opportunity to test it.
The Following User Says Thank You to jdock For This Useful Post: [ View ] Gift jdock Ad-Free
7th October 2013, 05:46 PM |#8  
sordna's Avatar
Senior Member
Thanks Meter: 655
 
More
works on nexus4 too
Thank you so much for this info, I was able to change things a bit and make it work on my stock / rooted Nexus 4:

Code:
# enable dual-networking:
pkill dhcpcd
svc wifi disable
svc data enable
netcfg wlan0 up
cd /data/misc/wifi/.
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
dhcpcd wlan0
ip route add x.x.x.x via x.x.x.y # add any desired local route

# disable dual-networking:
ip route del x.x.x.x/x via x.x.x.y
pkill dhcpcd
pkill wpa_supplicant 
rm -rf /data/misc/wifi/wlan0
netcfg wlan0 down
svc wifi disable
svc data disable
I use SH Script runner to create and run the 2 above scripts easily.
The Following 3 Users Say Thank You to sordna For This Useful Post: [ View ] Gift sordna Ad-Free
6th February 2014, 10:30 AM |#9  
Member
Thanks Meter: 1
 
More
I am a newbie... Do I have to just run the script in Sh script runner? And I don't know what IP route to use.

Sent from my GT-I9300 using XDA Premium 4 mobile app

---------- Post added at 12:25 PM ---------- Previous post was at 11:26 AM ----------

I am not able to load the drivers.. It's showing not found.. Even though I have installed busy box using busy box installer pro

Sent from my GT-I9300 using XDA Premium 4 mobile app

---------- Post added at 12:30 PM ---------- Previous post was at 12:25 PM ----------

I checked the directory using root Explorer and I can't find cfg80211.ko and wlan.ko

Sent from my GT-I9300 using XDA Premium 4 mobile app
6th February 2014, 05:50 PM |#10  
sordna's Avatar
Senior Member
Thanks Meter: 655
 
More
Whether you have any kernel modules to install with insmod, depends on your phone model, ROM, kernel.

For my nexus 4 with franco.kernel I don't have the modules either, but got it to work fine. So maybe its a similar situation with your phone .

SH script runner is not required, you can run the script in any terminal app after doing su.

EDIT: Some other interesting threads related to this topic are here:
http://forum.xda-developers.com/show....php?t=1640472
http://forum.xda-developers.com/show...90&postcount=1
http://forum.xda-developers.com/show....php?t=1667025
The Following User Says Thank You to sordna For This Useful Post: [ View ] Gift sordna Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes