You are not logged in.

#1 2017-03-20 23:26:59

JP-Ellis
Member
Registered: 2015-01-18
Posts: 2

Issues with USB tethering when connecting after booting up

I'm trying to use my Android phone as a tether (via USB), and I'm having issues with getting an IP address if I set up the connection after booting; however, if I boot with the connection active it works fine.

I'm using systemd-networkd to manage the connection with the configuration

$ cat /etc/systemd/network/10-wired.network
[Match]
Name=en*

[Network]
DHCP=yes

[DHCP]
RouteMetric=10

and the systemctl status is:

$ systemctl status systemd-networkd
● systemd-networkd.service - Network Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-03-21 09:31:15 AEDT; 2min 48s ago
     Docs: man:systemd-networkd.service(8)
 Main PID: 1028 (systemd-network)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-networkd.service
           └─1028 /usr/lib/systemd/systemd-networkd

$ systemctl status dhcpcd
● dhcpcd.service - dhcpcd on all interfaces
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

I don't have netctl or networkmanager installed.

Here's the log of networkd starting from boot.  To begin with, it works fine, but if I then disable and re-enable the USB tethering, I fail to get an IP address (just to make sure, I try disabling and re-enabling WiFi and that manages to get an IP address again).  I also try and restart systemd-networkd, but to no avail.

$ journalctl -b -u systemd-networkd
-- Logs begin at Fri 2017-03-10 14:03:29 AEDT. --
Mar 21 09:31:15 systemd-networkd[1028]: wlp3s0: Lost carrier
Mar 21 09:31:15 systemd-networkd[1028]: enp0s20u1: IPv6 enabled for interface: Success
Mar 21 09:31:15 systemd-networkd[1028]: enp0s20u1: Gained carrier
Mar 21 09:31:15 systemd-networkd[1028]: wlp3s0: Gained IPv6LL
Mar 21 09:31:16 systemd-networkd[1028]: enp0s20u1: Gained IPv6LL
Mar 21 09:31:18 systemd-networkd[1028]: enp0s20u1: DHCPv4 address 192.168.42.9/24 via 192.168.42.129
Mar 21 09:31:29 systemd-networkd[1028]: enp0s20u1: Configured
Mar 21 09:31:53 systemd-networkd[1028]: wlp3s0: Gained carrier
Mar 21 09:31:58 systemd-networkd[1028]: wlp3s0: DHCPv4 address 10.4.35.205/19 via 10.4.32.1
Mar 21 09:31:58 systemd-networkd[1028]: wlp3s0: Configured
## On Android phone, disable and then re-enable USB tethering
Mar 21 09:35:19 systemd-networkd[1028]: enp0s20u1: Lost carrier
Mar 21 09:35:19 systemd-networkd[1028]: enp0s20u1: DHCP lease lost
Mar 21 09:35:33 systemd-networkd[1028]: usb0: Renamed to enp0s20u1
Mar 21 09:35:33 systemd-networkd[1028]: enp0s20u1: IPv6 enabled for interface: Success
Mar 21 09:35:33 systemd-networkd[1028]: enp0s20u1: Gained carrier
Mar 21 09:35:34 systemd-networkd[1028]: enp0s20u1: Gained IPv6LL
## sudo ip link set wlp3s0 down && sudo ip link set wlp3s0 up
Mar 21 09:36:13 systemd-networkd[1028]: wlp3s0: Lost carrier
Mar 21 09:36:13 systemd-networkd[1028]: wlp3s0: DHCP lease lost
Mar 21 09:36:14 systemd-networkd[1028]: wlp3s0: Gained IPv6LL
Mar 21 09:36:43 systemd-networkd[1028]: wlp3s0: Gained carrier
Mar 21 09:36:49 systemd-networkd[1028]: wlp3s0: DHCPv4 address 10.4.35.205/19 via 10.4.32.1
Mar 21 09:36:49 systemd-networkd[1028]: wlp3s0: Configured
## sudo ip link set enp0s20u1 down && sudo ip link set enp0s20u1 up
Mar 21 09:37:07 systemd-networkd[1028]: enp0s20u1: Lost carrier
Mar 21 09:37:07 systemd-networkd[1028]: enp0s20u1: Gained carrier
Mar 21 09:37:08 systemd-networkd[1028]: enp0s20u1: Gained IPv6LL
Mar 21 09:39:09 systemd[1]: Stopping Network Service...
Mar 21 09:39:10 systemd[1]: Stopped Network Service.
Mar 21 09:39:10 systemd[1]: Starting Network Service...
Mar 21 09:39:10 systemd-networkd[21056]: enp0s20u1: Gained IPv6LL
Mar 21 09:39:10 systemd-networkd[21056]: wlp3s0: Gained IPv6LL
Mar 21 09:39:10 systemd-networkd[21056]: Enumeration completed

Note that if the connection is initially working and I restart it with:

sudo ip link set enp0s20u1 down && sudo ip link set enp0s20u1 up

I'm able to get a connection again, so the issue really seems to be when the interface disappears.

I have also tried running dhcpcd manually, but that also doesn't work:

$ sudo systemctl stop sytemd-networkd systemd-networkd.socket
$ # Disable and then re-enable USB tehtering
$ sudo dhcpcd -d enp0s20u1
dhcpcd-6.11.5 starting
enp0s20u1: disabling kernel IPv6 RA support
enp0s20u1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' PREINIT
enp0s20u1: executing `/usr/lib/dhcpcd/dhcpcd-run-hooks' CARRIER
DUID 00:01:00:01:1c:41:f6:ed:80:e6:50:19:37:be
enp0s20u1: IAID 54:76:ed:7e
enp0s20u1: delaying IPv6 router solicitation for 0.4 seconds
enp0s20u1: delaying IPv4 for 0.0 seconds
enp0s20u1: soliciting a DHCP lease
enp0s20u1: sending DISCOVER (xid 0x4768f0a3), next in 3.1 seconds
enp0s20u1: soliciting an IPv6 router
enp0s20u1: sending Router Solicitation
enp0s20u1: sending DISCOVER (xid 0x4768f0a3), next in 8.4 seconds
enp0s20u1: sending Router Solicitation
enp0s20u1: sending Router Solicitation
enp0s20u1: sending DISCOVER (xid 0x4768f0a3), next in 16.7 seconds
enp0s20u1: sending Router Solicitation
enp0s20u1: no IPv6 Routers available
enp0s20u1: sending DISCOVER (xid 0x4768f0a3), next in 32.0 seconds
timed out
dhcpcd exited

I have tried a varient of the above whereby I first boot my computer, disable systemd-networkd, enable USB tethering, and then run dhcpcd but I get the same result.

Does anyone know what might be the issue?  Looking at the wiki page on Android tethering, it really should just be a matter of starting the tether and then running dhcpcd.

Offline

#2 2017-03-21 23:09:19

mrschu
Member
Registered: 2017-03-04
Posts: 4

Re: Issues with USB tethering when connecting after booting up

I am just going to take a stap at this and state some things I would try. So if you shut off the tethering and turn it back on it does not work correct? Have you tried some of the other options with dhcpcd? For example from dhcpcd's man page:

     -k, --release [interface]
             This causes an existing dhcpcd process running on the interface
             to release its lease and de-configure the interface regardless of
             the -p, --persistent option.  If no interface is specified then
             this applies to all interfaces in Master mode.  If no interfaces
             are left running, dhcpcd will exit.

     -n, --rebind [interface]
             Notifies dhcpcd to reload its configuration and rebind the speci‐
             fied interface.  If no interface is specified then this applies
             to all interfaces in Master mode.  If dhcpcd is not running, then
             it starts up as normal.  This may also cause wpa_supplicant(8) to
             reload its configuration for each interface as well if the rele‐
             vant hook script has been installed.

     -N, --renew [interface]
             Notifies dhcpcd to renew existing addresses on the specified
             interface.  If no interface is specified then this applies to all
             interfaces in Master mode.  If dhcpcd is not running, then it
             starts up as normal.  Unlike the -n, --rebind option above, the
             configuration for dhcpcd is not reloaded.

I am unsure if this is a solution or not but rather some trouble shooting steps I personally would take. My thoughts are it is still holding onto the old connection. I am running with NetworkManager and do not have an issue using it to USB tether. With NetworkManager I have dhcpcd service disabled.

Best of luck,
Ben

Offline

#3 2017-03-22 02:37:15

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 15,073

Re: Issues with USB tethering when connecting after booting up

All you should need to do is to run dhcpcd as root


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
----
How to Ask Questions the Smart Way

Offline

#4 2017-03-22 04:49:08

JP-Ellis
Member
Registered: 2015-01-18
Posts: 2

Re: Issues with USB tethering when connecting after booting up

mrschu wrote:

So if you shut off the tethering and turn it back on it does not work correct? Have you tried some of the other options with dhcpcd?

Indeed that is correct.  More generally though, it is if I don't boot up with tethering enabled that the issue occurs.  I have indeed tried some of the other options; I have even once tried using a static configuration but to no avail (though I'm not 100% sure whether I correctly configured the static DHCP values).

ewaller wrote:

All you should need to do is to run dhcpcd as root

I have tried exactly that (see my first post for the debug information of DHCP) and unfortunately, it doesn't work.

Offline

Board footer

Powered by FluxBB