13

I'm trying to get USB tethering to work between a Nexus 5 phone (running CM11) and my desktop running Debian 8. I connected the phone to the computer via USB and got these messages:

[14972.580738] usb 3-2: new high-speed USB device number 6 using xhci_hcd
[14972.709236] usb 3-2: New USB device found, idVendor=18d1, idProduct=4ee3
[14972.709239] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[14972.709240] usb 3-2: Product: Nexus 5
[14972.709242] usb 3-2: Manufacturer: LGE
[14972.709243] usb 3-2: SerialNumber: 04a0ba5813aff0d4

After enabling USB tethering on the phone, I additionally get:

[14972.710663] rndis_host 3-2:1.0 usb0: register 'rndis_host' at usb-0000:00:14.0-2, RNDIS device, 02:04:67:3f:31:35

The device is also listed by lsusb, albeit as a Nexus 4:

Bus 003 Device 006: ID 18d1:4ee3 Google Inc. Nexus 4 (tether)

(Is that a problem?)

I do not, however, get a usb0 network interface or anything else that could be it. ifconfig lists only the previously present interfaces, which are eth0, lo, as well as two tun devices provided by OpenVPN.

I searched for possible reasons this doesn't work, but they revolve around a too-old kernel (from the 2.6 days). My kernel is 3.16.0, which I would assume supports USB tethering. I also remember that I got USB tethering to work with a Sony Ericsson phone by just connecting it, and that was years ago.

As far as I can tell, all the relevant kernel modules are loaded:

rndis_host             12698  0 
cdc_ether              12564  1 rndis_host
usbnet                 30844  2 rndis_host,cdc_ether
usbcore               195340  8 xpad,rndis_host,ehci_hcd,ehci_pci,usbhid,usbnet,xhci_hcd,cdc_ether
usb_common             12440  1 usbcore

What do I have to do to get the usb0 network interface?


Update: I tried this on another computer running Debian 8, and it worked. As far as I can tell, the difference is that two other modules are loaded: rndis_wlan and mii. However, though loading these modules manually via modprobe seems to work without errors, usb0 is still missing.

After some googling I found that I should get information about network interfaces using ip link. The output is:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 30:85:a9:f6:24:cd brd ff:ff:ff:ff:ff:ff
31: tun1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 100
    link/none 
32: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 100
    link/none 
37: usb0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0e:21:59:43:d3:ca brd ff:ff:ff:ff:ff:ff

So it appears that usb0 does exist after all. I then tried ifup usb0, but it says

Ignoring unknown interface usb0=usb0.

I did the whole thing also with a Nexus 7 (1st gen), with the same results.

9

Ok, it appears I have figured it out. These commands made it work:

ip link set usb0 up
dhclient usb0

Strangely enough, ifup usb0 still tells me that this interface is unknown, and: before running dhclient, not even a ping 8.8.8.8 works.

I'd still be interested to know how I can automate this, or why this does happen automatically on another Debian 8 install.

|improve this answer|||||
  • 1
    "ifup usb0 still tells me that this interface is unknown" - so I guess this was not successful after all. Why is this question marked as the right answer, and did you find out anything else since then? I'd like to set up network connection over the USB debug because adb cannot port forward UDP ports yet (it can port forward and reverse port forward TCP though). So I'd be super interested how to accomplish this – Csaba Toth Aug 8 '16 at 3:26
  • 1
    Even ip link set usb0 up yields Cannot find device "usb0" form me :/ – Csaba Toth Aug 8 '16 at 3:26
  • replace usb0 with your device name. You can find it by comparing the output of the command ip link before and after plugging in your Android device and activating USB tethering. After plugging in and activating USB tethering the last line should read something like 37: usb0: <BROADCAST,MULTICAST> .... The name right after the number should be the device you are looking for. – v.tralala Apr 27 '19 at 22:50
2

Add this to /etc/network/interfaces config file:

auto usb0
allow-hotplug usb0
iface usb0 inet dhcp

and after reboot

sudo ifconfig usb0 up

if you system is ubuntu after 16.04 you might need to change the name of the interface:

auto enusb01
allow-hotplug enusb01
iface enusb01 inet dhcp

and after reboot

sudo ifconfig enusb01 up

If none works try to see list with ifconfig -a | grep Link and and then try to mount the relevant one up or do the steps above an then mount that up.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.