[Q] Enable both wifi and mobile data for multihoming - General Questions and Answers

This might sound like a slightly odd thing to do, but I am trying to enable both wifi and mobile data on an Motorola Xoom pad at the same time. I need both interfaces as I am exploring multihoming of mobile devices. To illustrate the current behavior of the xoom.
sh-4.1# netcfg
...
ppp0 UP 95.209.163.33 255.255.255.255 0x000010d1
sh-4.1# svc wifi enable
sh-4.1# netcfg
...
ppp0 UP 95.209.163.33 255.255.255.255 0x000010d1
wlan0 UP 0.0.0.0 0.0.0.0 0x00001043
sh-4.1# netcfg
...
ppp0 DOWN 0.0.0.0 0.0.0.0 0x00001090
wlan0 UP 130.229.167.92 255.255.192.0 0x00001043
sh-4.1# netcfg
...
wlan0 UP 130.229.167.92 255.255.192.0 0x00001043
It seems that enabling data over wlan0 automatically disables the mobile data. Is there any known way to prevent this and have both interfaces enabled at the same time?
I have root access on the tablet and I am not afraid to write some code if that is what is needed. I just don't know where to start.
ps.
I have tried searching and not found any similar question.
ds.
/Pehr

Related

[Q] VPNC Route Help

So I inadvertently killed my D1 by drowning it in a river and work sent me a new D3.
With a rooted D1, I was able to get VPNC to a Cisco working and <whisper>WiFi tether; I wanted the same usability in the D3. A little trickier getting things set up, but I'm just about there.
With wonderful resources like you people, found a radio tweak, and also that the D3 has tun built in (can see dev/net/tun), so with VPNC widget, got connected, see our Cisco banner text and issued IP in the VPNC log.
However, once connected to VPN, I can't access internet and can't ping any of our internal IPs either...I think my routes are wrong.
But, I don't know enough about setting up the routing table and was hoping someone could steer me in the right direction? I would like to manually adjust them, see if it works, then hopefully script it for after connection.
Not sure what anyone might need, but I'll start with this:
Before...
ip route list
66.174.201.64 dev ppp0 scope link
66.174.201.64 dev ppp0 proto kernel scope link src 10.251.3.122
default via 66.174.201.64 dev ppp0
netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
gether0 DOWN 0.0.0.0 0.0.0.0 0x00001002
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
ip6tnl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
tun DOWN 0.0.0.0 0.0.0.0 0x00001002
ppp0 UP 10.251.3.122 255.255.255.255 0x000010d1
After VPN connected...
66.174.201.64 dev ppp0 scope link
66.174.201.64 dev ppp0 proto kernel scope link src 10.251.3.122
default via 66.174.201.64 dev ppp0
netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
gether0 DOWN 0.0.0.0 0.0.0.0 0x00001002
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
ip6tnl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
tun DOWN 0.0.0.0 0.0.0.0 0x00001002
tun0 UP 192.168.144.8 255.255.255.255 0x000010d1
ppp0 UP 10.251.3.122 255.255.255.255 0x000010d1
I appreciate anyone taking the time to help me out.
Update...
Apparently, I found my busybox wasn't symlinked properly, so things like grep weren't working...that's why the usual vpnc-script file wasn't updating routes as it normally would. Updated bb and after connecting with VPNC, I now get:
ip route list
<myciscoip> via 66.174.201.64 dev ppp0 src 10.242.253.151 mtu 1500
advmss 1460
66.174.201.64 dev ppp0 scope link
66.174.201.64 dev ppp0 proto kernel scope link src 10.242.253.151
default dev tun0 scope link
netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
gether0 DOWN 0.0.0.0 0.0.0.0 0x00001002
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
ip6tnl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
tun DOWN 0.0.0.0 0.0.0.0 0x00001002
ppp0 UP 10.242.253.151 255.255.255.255 0x000010d1
tun0 UP 192.168.144.5 255.255.255.255 0x000010d1
Unfortunately, I still can't reach internet or ping any of our internal IPs? Like I said, I don't know enough about TCP route configuration to know what's missing/wrong from the phone's routing table.
Anyone with some insight?
Interesting...came across this (site wouldn't allow me to post link, so I mucked it a bit): androidforums.com /evo-4g-support-troubleshooting/ 140775-post-froyo-vpn-issues.html
They could connect to VPN if using WiFi, but not 3g. So, I tried connecting to my home WiFi, then VPN to work Cisco on phone...voila! Works fine...ping internal work IPs, facebook is blocked in browser due to our WebSense...just as expected.
So, can't VPN over 3g connection just yet....
Please use the Q&A Forum for questions Thanks
Moving to Q&A
I've got it working in mine by doing the folowing (Thether + 3G):
First try using IP instead of DNS. Otherwise you'll need what I need probably (strip your APN of MMS etc.)
Create a new APN. Only fill in mimimal:
Name: Internet
APN: Internet
Type: Internet
Rest default. Worked for me. Adding MMS proxy etc. Blocks my VPN

join ad hoc network

Hello all,
I have android 4.2.2 ,Nexus 4
I would like to setup adhoc network .
Firstly I rooted the device,
secondly I tried to create adhoc network in android phone :
I create ad hoc network in an android smartphone with this:
-------------------
[email protected]:/ # ip link set dev wlan0 down
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
[email protected]:/ # ip link set dev wlan0 up
[email protected]:/ # ifconfig wlan0 192.168.65.129
---------------
when I typed iwconfig wlan0:
the result is:
result1:
-----------------
Qcom:802.11n ESSID:"Test1"
Mode:Ad-Hoc Frequency:2.437 GHz Cell: 02:82:5F:C1:4B:C1
Bit Rate=0 kb/s Tx-Power=0 dBm
RTS thr=2347 B Fragment thr=8000 B
Encryption keyff
--------------
Secondly, in my laptop ,I could see "Test1",so I did connect to "Test1" and I configure static ip address 192.168.65.128.
in this case ,the smartphone create the ad hoc network and my laptop join it,then I can ping from my laptop to mobile and vice-versa.
However,in other case when :
my laptop create ad hoc network
and later in an android mobile ,I tried to join it :
-----------------
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
------------
But,when I type iwconfig wlan0 ,essid still off/any
result2:
Qcom:802.11n ESSIDff/any
Mode:Ad-Hoc Frequency:2.437 GHz Cell: Not-Associated
Bit Rate:0 kb/s Tx-Power=0 dBm
RTS thr=2347 B Fragment thr=8000 B
Encryption keyff
it seems that android mobile can create ad hoc network but can not join existing one.
so the same result I found when I try to setup adhoc network between two android mobiles:
in both android mobiles I typed :
--------------
[email protected]:/ # ip link set dev wlan0 down
[email protected]:/ # iwconfig wlan0 mode ad-hoc
[email protected]:/ # iwconfig wlan0 channel 6
[email protected]:/ # iwconfig wlan0 essid 'Test1'
[email protected]:/ # ip link set dev wlan0 up
-------------------
for the first one I configure
[email protected]:/ # ifconfig wlan0 192.168.65.129
the second one:
[email protected]:/ # ifconfig wlan0 192.168.65.127
so the result of iwconfig wlan0:
in the first one: like result1
in the second android smartphone :like result2
and of course ,I can't ping from one to other.
in brief,it seems that in android smartphone I can create adhoc network but I can't join existing one.
can anybody tell me what it's wrong here,and if there is any possible solution,
I tried many methods to setup ad hoc network in my android mobiles,and only this method that it seems work,but it still something wrong that prevent android phone to join existing ad hoc network.

[Q] wifi 3g/4g simultaneously

I want to do MPTCP.
I've tried many ways to let them work at the same time.
But I still can't use them.
I use adb shell.
First, I let 3g always on, and turn off the wifi
then,
netcfg wlan0 up
wpa_supplicant -B -Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
but in here, i use 'netcfg' to see the network informantion
I can't get the WiFi's IP address, I only can get 3G IP or WiFi IP
http://forum.xda-developers.com/showthread.php?t=2197776
http://forum.xda-developers.com/showthread.php?t=1640472
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
I use dhcpcd wlan0
「Version 5.5.6 Starting,
wlan0: waiting for carrier
timed out
allowing 8 seconds for IPv4LL timeout
timed out 」
so, how can I get the dual networks IP address?

wired networking without DHCP

I suspect I'm not the only person with a wired network adapter - and some of us may be trying to do things like configure routers, etc, where there's no active DHCP server.
I was in this situation a couple of days ago, configuring a dd-wrt box with DHCP turned off.
The best how-to I found was at this entry at HeadlessAndroid
This could be "old hat" to everybody here (other than me), but, for most of my android devices, if I'm in the terminal, I'm connected via "adb terminal" so I've never needed to do this - and ifcfg does not work the way I'd have expected.
Hope this helps someone...
Networking on a Headless Android System
Android isn't the most intuitive environment for setting up networking on the command line. After playing with several different options here's what I've found.
Summary
# netcfg eth0 dhcp
# route add default gw 192.168.0.1 dev eth0
# setprop net.dns1 208.67.222.222
# setprop net.dns2 208.67.222.220
Details
The Android tools are quite different from the tools found on other embedded Linux systems, so most people I've talked to have had difficulty figuring out what utilities to use and how to use them. The most interesting one is ifconfig. When you type ifconfig on an Android system nothing happens. On a standard busybox or gnu based Linux system you will see the available networking interfaces and their associated settings (ok, technically ifconfig -a will show you that information). Since ifconfig doesn't show anything, most people assume (incorrectly) that it doesn't work.
On my development platform, to set a static IP address, I did the following:
# ifconfig eth0 192.168.0.84 netmask 255.255.255.0
Which didn't give any response, but DID show the following when I did netcfg.
# netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
eth0 UP 192.168.0.84 255.255.255.0 0x00001043
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
tunl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
gre0 DOWN 0.0.0.0 0.0.0.0 0x00000080
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
So what about DHCP you may ask?
# netcfg eth0 dhcp
Which yields the following.
# netcfg
lo UP 127.0.0.1 255.0.0.0 0x00000049
eth0 UP 192.168.0.227 255.255.255.0 0x00001043
usb0 DOWN 0.0.0.0 0.0.0.0 0x00001002
tunl0 DOWN 0.0.0.0 0.0.0.0 0x00000080
gre0 DOWN 0.0.0.0 0.0.0.0 0x00000080
sit0 DOWN 0.0.0.0 0.0.0.0 0x00000080
Just because you have an IP address now doesn't mean the applications on your Android device can get to the network. For that you have to set a default route and set the DNS resolver addresses. Again, with route keep in mind it won't show the usual output that a standard busybox or gnu based embedded Linux system would show.
To set the default route:
# route add default gw 192.168.0.1 dev eth0
And to set the DNS (I'm using OpenDNS addresses here):
# setprop net.dns1 208.67.222.222
# setprop net.dns2 208.67.222.220
And that allows the holy grail of a DNS resolved ping to a domain on the Internet.
# ping google.com
PING google.com (74.125.224.134) 56(84) bytes of data.
64 bytes from nuq04s09-in-f6.1e100.net (74.125.224.134): icmp_seq=1 ttl=57 time=41.5 ms
64 bytes from nuq04s09-in-f6.1e100.net (74.125.224.134): icmp_seq=2 ttl=57 time=43.2 ms
References
I found some great information in the following links.
http://www.anddev.org/advanced_networking_with_android-linux-t155.html
http://elinux.org/Android_Networking
Click to expand...
Click to collapse

[CLOSED]Android usbnet networking setup

Hello there!
I have android 10 based device and I have troubles with configuring usbnet device automatically.
I've modified kernel config, added `CONFIG_USB_USBNET=y` etc. Now I have usb0 device, and I can assign ip and routing to it, but it seems that there is another layer of networking setup in android: utility named ndc.
I tried next script:
```
ip link set usb0 up
ip addr add 192.168.1.2/24 dev usb0
ndc network create 101
ndc network interface add 101 usb0
ndc network route add 101 usb0 192.168.1.0/24
ndc network default set 101
```
Now I can ping device on the other side of usb0 interface but I'm losing wlan0 connection. Sure I can do next:
```
ndc network interface add 101 wlan0
ndc network route add 101 wlan0 0.0.0.0/0 10.0.0.1
ndc resolver setifdns wlan0 8.8.8.8 8.8.4.4
```
I also tried to modify default ROM:
uncomment in frameworks/base/core/res/res/values/config.xml
```
<string translatable="false" name="config_usb_ethernet_iface_regex">usb\\d</string>
<!-- Configuration of Ethernet interfaces in the following format:
<interface name|mac address>;[Network Capabilities];[IP config];[Override Transport]
Where
[Network Capabilities] Optional. A comma seprated list of network capabilities.
Values must be from NetworkCapabilities#NET_CAPABILITIES_* constants.
[IP config] Optional. If empty or not specified - DHCP will be used, otherwise
use the following format to specify static IP configuration:
ip=<ip-address/mask> gateway=<ip-address> dns=<comma-sep-ip-addresses>
domains=<comma-sep-domains>
[Override Transport] Optional. An override network transport type to allow
the propagation of an interface type on the other end of a local Ethernet
interface. Value must be from NetworkCapabilities#TRANSPORT_* constants. If
left out, this will default to TRANSPORT_ETHERNET.
-->
<string-array translatable="false" name="config_ethernet_interfaces">
<!--
<item>eth1;12,13,14,15;ip=192.168.0.10/24 gateway=192.168.0.1 dns=4.4.4.4,8.8.8.8</item>
<item>eth2;;ip=192.168.0.11/24</item>
<item>eth3;12,13,14,15;ip=192.168.0.12/24;1</item>
-->
<item>usb0;13,14,15;ip=192.168.1.2/24;8</item> #this line
</string-array>
```
But no luck usb0 interface remain unconfigured after boot.
After that I can ping both usb0 peer and wlan0 direct gateway but default route(0.0.0.0/0) not working. Don't understand why...
In general, I have 2 questions:
1. how to automate IP configuration for usb0 network in time of building ROM?
2. how to make usb0 and wlan0 play well together? Ideally without creating new network via ndc etc.
Are there any manuals about network configuration?
swexru said:
Hello there!
I have android 10 based device and I have troubles with configuring usbnet device automatically.
I've modified kernel config, added `CONFIG_USB_USBNET=y` etc. Now I have usb0 device, and I can assign ip and routing to it, but it seems that there is another layer of networking setup in android: utility named ndc.
I tried next script:
```
ip link set usb0 up
ip addr add 192.168.1.2/24 dev usb0
ndc network create 101
ndc network interface add 101 usb0
ndc network route add 101 usb0 192.168.1.0/24
ndc network default set 101
```
Now I can ping device on the other side of usb0 interface but I'm losing wlan0 connection. Sure I can do next:
```
ndc network interface add 101 wlan0
ndc network route add 101 wlan0 0.0.0.0/0 10.0.0.1
ndc resolver setifdns wlan0 8.8.8.8 8.8.4.4
```
I also tried to modify default ROM:
uncomment in frameworks/base/core/res/res/values/config.xml
```
<string translatable="false" name="config_usb_ethernet_iface_regex">usb\\d</string>
<!-- Configuration of Ethernet interfaces in the following format:
<interface name|mac address>;[Network Capabilities];[IP config];[Override Transport]
Where
[Network Capabilities] Optional. A comma seprated list of network capabilities.
Values must be from NetworkCapabilities#NET_CAPABILITIES_* constants.
[IP config] Optional. If empty or not specified - DHCP will be used, otherwise
use the following format to specify static IP configuration:
ip=<ip-address/mask> gateway=<ip-address> dns=<comma-sep-ip-addresses>
domains=<comma-sep-domains>
[Override Transport] Optional. An override network transport type to allow
the propagation of an interface type on the other end of a local Ethernet
interface. Value must be from NetworkCapabilities#TRANSPORT_* constants. If
left out, this will default to TRANSPORT_ETHERNET.
-->
<string-array translatable="false" name="config_ethernet_interfaces">
<!--
<item>eth1;12,13,14,15;ip=192.168.0.10/24 gateway=192.168.0.1 dns=4.4.4.4,8.8.8.8</item>
<item>eth2;;ip=192.168.0.11/24</item>
<item>eth3;12,13,14,15;ip=192.168.0.12/24;1</item>
-->
<item>usb0;13,14,15;ip=192.168.1.2/24;8</item> #this line
</string-array>
```
But no luck usb0 interface remain unconfigured after boot.
After that I can ping both usb0 peer and wlan0 direct gateway but default route(0.0.0.0/0) not working. Don't understand why...
In general, I have 2 questions:
1. how to automate IP configuration for usb0 network in time of building ROM?
2. how to make usb0 and wlan0 play well together? Ideally without creating new network via ndc etc.
Are there any manuals about network configuration?
Click to expand...
Click to collapse
Note: Questions go in Q&A Forum
If you are posting a Question Thread post it in the Q&A forum. Technical discussion of Android development and hacking. No noobs, please. Device-specific releases should go under the appropriate device forum...
forum.xda-developers.com

Categories

Resources