I have android with two network interface wlan0 and eth0.
Interface eth0 is connected with some private network (without internet).
Interface wlan0 is the source of Internet of my device.
The problem is when activate eth0 ethernet port of the device the internet coming from the wifi stops to work, there are routing problems.
I did some routing configuration command and am able to solve it.
ip route add table eth0 default via 192.168.100.1 dev wlan0 proto static
The issue is, when I restart the kiosk the config disappears so, I have to do it again each time.
Can you tell me how can I change permanently ?
Thank you in advance.
Related
My device is based on Android 10 and has been rooted.
I want to find a way of using ADB to change the static IP address of a certain wifi connection and the result should be the same as from the system Settings.
I've tried three ways and none of them worked:
ifconfig wlan0 [ip]but nothing happened.
ip address add [ip] dev wlan0the IP in system wifi connection details dose changed but the real IP is still the previous one. It can not change the real IP being used.
I've tried to change the /data/misc/wifi/WifiConfigStore.xml file. But this file will be recovered when I reopen wifi. Changes made on this file will also be invalid.
Try using:
ip address change <IP> dev wlan0
Then do ip address, in wlan0 you will see the previous IP and then your IP. Do:
ip address del <old IP> dev wlan0
Then you can see your change in ip address and ifconfig.
In developer options (Android 7.1.2), I can activate "ADB over network". It automatically sets the IP address where ADB listens to the one of the devices WiFi interface.
For added security and flexibility (I'd like to debug in a cafe with public WiFi), I would like ADB to listen on the IP address of my OpenVPN tunnel. Is there a way to do that?
I had the same query and found your post.
I tried it, and although it doesn't show the IP assigned by the VPN server, you still can get adb to connect with that IP.
Whether or not it can be connected to with the displayed IP, I'm not sure.
I'm developing a platform using ODROID U3 with Android for a custom application. I merged the MPTCP Kernel Source with Android Kernel Source to get a MPTCP Enabled Kernel for Android.
The only thing is that Android by default disables the 3G Connection when a Wireless is available, and I want it to be both available to MPTCP work by share-loading it.
I can manually manage all stuff, but I didnt find what disables the 3G Connection and how to bypass it. I also have BSP if needed to bypass it.
Anyone knows where I can bypass or where it does the 3G Disconnection?
PS: I already saw Android High Priority Connection, and this doesnt apply to me. I need both connections working for I make the MPTCP routes transparently for the Network Access. Also I'm aware that this is not something I can do in non-rooted devices. I have root, and I can also recompile entire Android System from the BSPs. I searched all over the internet and I didnt find anything about that (only the High Priority Connection)
What I already have tryed:
1 - High Priority Connection: Works fine, but the application needs to be open. And I want the MPTCP system-aware not application-aware.
2 - Turn on Wifi, connect. And them manually bring up the Mobile Connection Interface via terminal: Doesn't work. For some reason the Mobile Connection doesn't get IP from DHCP.
3 - Search on Android BSP anything and anywhere it could switch off/on the Mobile Connection: Didn't find anything specific.
Thanks!
I found the solution here: https://sites.google.com/site/lotuseaterarpit/news/3g4gwififorandroidconcurrently
So basicly you need to disable wifi service from android (using svc wifi disable and them manually configure the Wireless Network as so:
Lets supose we have the wireless internet at wlan0, we will do:
Disable the Wifi Interface Service
svc wifi disable
Bring up Wifi Interface
busybox ifconfig wlan0 up
Configure wlan interface
iwconfig wlan0 mode managed essid YOUR_SSID
iwconfig wlan0 key s:WIRELESS_KEY
iwconfig wlan0 commit
DHCP interface to get IP
dhcpcd eth0
So with this, you can have your 3G Connection online together with Wireless Network. You need to configure the routes by yourself, but this will make you able to do that.
Hope it helps!
I found the following post which describes how to assign a static ip to a wifi interface. I am currently developing for a Nexus 7 (4.1.2) and have an OTG cable along with a Linksys 300M usb-to-ethernet adapter. Is there a way I could assign a static ip to the ethernet interface?
Once again, thank you very much.
Assuming your ethernet interface on the device is eth0, this should work :
ifup eth0 192.168.1.2 255.255.255.0
in general
ifup<interface name> <ip-address> <netmask>
You could also do this with ifconfig, but changing the IP address manually still requires root or you'll just get an ioctl error informing you as such.
Is it possible to have both 3G and Wifi connections up and running? I want to transmit at the same time through both interfaces.
However, I've noticed that when Wifi is up, 3G is going down. Actually, it seems that the routing table is updated on on/off of the interfaces.
Route table UMTS on / Wifi on
a.b.c.1 dev rmnet0
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via a.b.c.1 dev rmnet0
Route table Wifi on / UMTS on
192.168.1.0/24 dev eth0 src 192.168.1.147
default via 192.168.1.1 dev eth0
With wifi on I have run:
ip link set rmnet0 up
ip route
192.168.1.0/24 dev eth0 src 192.168.1.147
a.b.c.0/24 dev rmnet0 src a.b.c.2
default via 192.168.1.1 dev eth0
When I saw that I thought that I have managed to put both devices up and running. However, this is not the case. When I ping a public internet address (a.b.c.3), in case 1) and 2) everything goes well. In case 3) I get no answer.
Where on earth does Android set that only one device can be available at a time? How can I make both interfaces to be up and available, like on an ordinary Linux box?
P.S.: I have tried the solution in [1] to enable the data connection when wifi is on, and no way.
[1] How to enable data connection on Android 2.3
[2] How to block calls in android --> using ITelephony to get the telephonyService.enableDataConnectivity(); but I get an exception.
This is not going to be possible... unless you are will to go to great lengths to make it work. You are essentially asking for you device to become a router.
To do this you will need to find a program (sorry can't remember any names at the moment) that will accomplish this on a normal linux distro. Then recompile it to fit the Android OS and install is into the native system.
This explanation may make a little more sense to you. If you go to your ADB shell and run netcfg (or ifconfig to verbose this) you will see the devices networking options. You can run an ifconfig command to set the device or change its state - but you cannot have multiple devices route data to and from the phone at the same time I wouldn't think.
This would be my best guess...