Using ethernet and wi-fi

Moderators: odroid, mdrjr

Using ethernet and wi-fi

Unread postby eguad » Sat Sep 29, 2018 1:52 am

Hello, this is my first post here.

We have an XU4 with Lineage 14.1 updated to Alpha 1.9. We added an ASUS USB-AC53 Nano that works fine. Wi-fi uses dhcp and connects to internet, and ethernet uses static 192.168.0.11 to connect to local.

Wi-fi works fine, browse and download no problem. On ethernet, PC can ping odroid, but odroid cannot ping PC.

I installed busybox and odroid can ping PC only if I do like this: ping -I eth0 192.168.0.10. So I think I am missing a routing metric perhaps, but I don't know how to do this.

edit:

I've found that Android only allows one interface to be active at a time. Is this true? is there a way to enable both?
eguad
 
Posts: 4
Joined: Sat Sep 29, 2018 12:38 am
languages_spoken: english
ODROIDs: XU4

Re: Using ethernet and wi-fi

Unread postby codewalker » Mon Oct 15, 2018 3:27 pm

Try to get sudo permission and do ping.

eguad wrote:Hello, this is my first post here.

We have an XU4 with Lineage 14.1 updated to Alpha 1.9. We added an ASUS USB-AC53 Nano that works fine. Wi-fi uses dhcp and connects to internet, and ethernet uses static 192.168.0.11 to connect to local.

Wi-fi works fine, browse and download no problem. On ethernet, PC can ping odroid, but odroid cannot ping PC.

I installed busybox and odroid can ping PC only if I do like this: ping -I eth0 192.168.0.10. So I think I am missing a routing metric perhaps, but I don't know how to do this.

edit:

I've found that Android only allows one interface to be active at a time. Is this true? is there a way to enable both?
User avatar
codewalker
 
Posts: 506
Joined: Mon Feb 25, 2013 11:03 am
languages_spoken: english
ODROIDs: all

Re: Using ethernet and wi-fi

Unread postby eguad » Tue Oct 23, 2018 2:32 am

Yes I did su beforehand; it's the only way ifconfig or ping works.

I'm starting to think the problem may be with the ODROID Utility. It requires me to put a gateway when there is none for the network, and when eth0 gets put as the active network, DNS doesn't work on wlan0.

I have modified my application to call ConnectivityManager.bindProcessToNetwork in appropriate places. wlan0 cannot resolve names, but it can access IP addresses. This leads me to think it is trying to use either the DNS or gateway associated with eth0.

I've found the ethernet configuration stored in /data/misc/ethernet/ipconfig.txt, but I'm not sure how that helps me. I see /etc/dhcpcd/dhcdcp.conf but it doesn't appear to be used, and there is no /etc/network/interfaces. I don't think I could modify dhcpcd.conf anyway since that is likely in the linux partition. There must be an Android service that reads and configures eth0 using that ipconfig.txt

ed> okay so i think i've got this working. I need to use ODROID utility and set the gateway/dns to 0.0.0.0 explicitly; it defaults to 192.168.1.xx otherwise and the dns to 8.8.8.8 which is unreachable. The application still has to specify eth0 (either by bindProcessToNetwork or by using Network.SocketFactory) because wlan0 will always be chosen as the active network when present.
eguad
 
Posts: 4
Joined: Sat Sep 29, 2018 12:38 am
languages_spoken: english
ODROIDs: XU4

Re: Using ethernet and wi-fi

Unread postby rooted » Tue Oct 23, 2018 4:04 pm

In Android you use setprop to change DNS.

Code: Select all
~$ su

potter:/ # getprop | grep dns

[net.dns1]: [192.168.1.18]
[net.dns2]: []
[net.dns3]: []
[net.dns4]: []

potter:/ # setprop net.dns1 8.8.8.8

potter:/ # getprop | grep dns

[net.dns1]: [8.8.8.8]
[net.dns2]: []
[net.dns3]: []
[net.dns4]: []
User avatar
rooted
 
Posts: 5865
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english

Re: Using ethernet and wi-fi

Unread postby eguad » Wed Oct 24, 2018 6:48 am

thank you, from looking at the output it seems i need to figure out how to disable ipv6 next.

I need dns to be set on the wlan0 interface, which uses dhcp. My problem is preventing eth0 from "advertising" dns or a gateway and it seems putting 0.0.0.0 works. Do you know how the parameters in /etc/misc/ethernet/ipconfig.txt get applied and if there is another way to persist a static config on eth0? when i tried "ip addr" it wouldn't stick on reboot.
eguad
 
Posts: 4
Joined: Sat Sep 29, 2018 12:38 am
languages_spoken: english
ODROIDs: XU4

Re: Using ethernet and wi-fi

Unread postby eguad » Tue Oct 30, 2018 2:44 am

So now I've gotten to the point where everything works somewhat reliably on either network. Problem is, every now and then eth0 comes up as the default network instead of wlan0. I can see this by calling ConnectivityManager.getActiveNetwork().

When eth0 comes up as the default, name resolution on the WAN (accessed via wlan0) doesn't work. If I unplug the ethernet cable and wait a bit to plug it back in, getActiveNetwork() will return "wlan0" and everything works.

So my problem now becomes getting wlan0 to always be the active network when present. I think maybe during boot the order the network interfaces come up makes a difference.
eguad
 
Posts: 4
Joined: Sat Sep 29, 2018 12:38 am
languages_spoken: english
ODROIDs: XU4


Return to Android

Who is online

Users browsing this forum: No registered users and 5 guests