You are not logged in.

#1 2022-04-08 23:20:17

DragonOfWar
Member
Registered: 2021-10-16
Posts: 10

Android USB Tethering - device MAC is all 0's

For a long time, I've been having this problem where USB tethering wouldn't work. I would connect my phone via USB and switch it's USB mode to USB tethering, and I wouldn't get any internet connection. I thought it was my USB cable, but tethering worked normally on Windows. After digging a bit, I ran the command "ip addr" to see my network interfaces. I found my connected device listed as enp1s0f0u9, but for some reason, it's MAC address was shown as 00:00:00:00:00:00. This is the output:

4: enp1s0f0u9: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

So after reading MAC address spoofing, I've changed it's MAC address to the one shown on my phone's About setting, and it worked. But I have to do this every time I connect my phone.
Why does this happen? Is there a way to fix it?
I've tested on all USB ports. I've followed the Android tethering tutorial, and it still sets the MAC address to 0. I haven't tested a different USB cable because I don't have another one. If I get one, I will test it.

Phone model: SAMSUNG Galaxy J8
Android version: 10
Kernel Version: 5.17.1-arch1-1
DE: KDE Plasma

Last edited by DragonOfWar (2022-04-08 23:21:55)

Offline

#2 2022-04-09 05:54:13

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Android USB Tethering - device MAC is all 0's

I suggest you try to use udev or a systemd unit to set a permament/random mac address.

From some blog posts it seems like windows just sets a random mac for rndis / tethering devices.

Last edited by progandy (2022-04-09 05:54:40)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2022-04-09 09:21:56

-thc
Member
Registered: 2017-03-15
Posts: 499

Re: Android USB Tethering - device MAC is all 0's

I used Android USB tethering in the past and tested it recently - it works (with a random MAC) without any configuration.

So maybe there is a problem with the device detection (udev) and/or network management.
Can you post a link to the output of a recent journal?

sudo journalctl -b

Offline

#4 2022-04-09 17:20:04

DragonOfWar
Member
Registered: 2021-10-16
Posts: 10

Re: Android USB Tethering - device MAC is all 0's

-thc wrote:

I used Android USB tethering in the past and tested it recently - it works (with a random MAC) without any configuration.

So maybe there is a problem with the device detection (udev) and/or network management.
Can you post a link to the output of a recent journal?

sudo journalctl -b

Here's what it outputs when I activate usb tethering in my phone:

abr 09 14:08:01 dragonofwar kernel: usb 1-9: new high-speed USB device number 6 using xhci_hcd
abr 09 14:08:01 dragonofwar kernel: usb 1-9: New USB device found, idVendor=04e8, idProduct=6864, bcdDevice= 4.00
abr 09 14:08:01 dragonofwar kernel: usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
abr 09 14:08:01 dragonofwar kernel: usb 1-9: Product: SAMSUNG_Android
abr 09 14:08:01 dragonofwar kernel: usb 1-9: Manufacturer: SAMSUNG
abr 09 14:08:01 dragonofwar kernel: usb 1-9: SerialNumber: acbf900e
abr 09 14:08:01 dragonofwar kernel: rndis_host 1-9:1.0 eth0: register 'rndis_host' at usb-0000:01:00.0-9, RNDIS device, 00:00:00:00:00:00
abr 09 14:08:01 dragonofwar NetworkManager[536]: <info>  [1649524081.5043] manager: (eth0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/4)
abr 09 14:08:01 dragonofwar mtp-probe[2498]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-9"
abr 09 14:08:01 dragonofwar mtp-probe[2498]: bus: 1, device: 6 was not an MTP device
abr 09 14:08:01 dragonofwar audit[536]: USYS_CONFIG pid=536 uid=0 auid=4294967295 ses=4294967295 msg='op=statistics interface="eth0" ifindex=4 args=500 pid=927 uid=1000 result=success exe="/usr/bin/NetworkManager" hostname=? addr=? ter>
abr 09 14:08:01 dragonofwar NetworkManager[536]: <info>  [1649524081.5171] audit: op="statistics" interface="eth0" ifindex=4 args="500" pid=927 uid=1000 result="success"
abr 09 14:08:01 dragonofwar kernel: audit: type=1111 audit(1649524081.516:87): pid=536 uid=0 auid=4294967295 ses=4294967295 msg='op=statistics interface="eth0" ifindex=4 args=500 pid=927 uid=1000 result=success exe="/usr/bin/NetworkMan>
abr 09 14:08:01 dragonofwar audit[536]: USYS_CONFIG pid=536 uid=0 auid=4294967295 ses=4294967295 msg='op=statistics interface="eth0" ifindex=4 args=500 pid=927 uid=1000 result=success exe="/usr/bin/NetworkManager" hostname=? addr=? ter>
abr 09 14:08:01 dragonofwar NetworkManager[536]: <info>  [1649524081.5216] audit: op="statistics" interface="eth0" ifindex=4 args="500" pid=927 uid=1000 result="success"
abr 09 14:08:01 dragonofwar kernel: audit: type=1111 audit(1649524081.519:88): pid=536 uid=0 auid=4294967295 ses=4294967295 msg='op=statistics interface="eth0" ifindex=4 args=500 pid=927 uid=1000 result=success exe="/usr/bin/NetworkMan>
abr 09 14:08:01 dragonofwar colord-sane[2484]: io/hpmud/pp.c 627: unable to read device-id ret=-1
abr 09 14:08:01 dragonofwar systemd-udevd[2481]: Using default interface naming scheme 'v250'.
abr 09 14:08:01 dragonofwar kernel: rndis_host 1-9:1.0 enp1s0f0u9: renamed from eth0
abr 09 14:08:01 dragonofwar NetworkManager[536]: <info>  [1649524081.6002] device (eth0): interface index 4 renamed iface from 'eth0' to 'enp1s0f0u9'
abr 09 14:08:01 dragonofwar NetworkManager[536]: <info>  [1649524081.6070] device (enp1s0f0u9): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
abr 09 14:08:01 dragonofwar NetworkManager[536]: <warn>  [1649524081.6074] platform-linux: do-change-link[4]: failure changing link: failure 99 (Cannot assign requested address)
abr 09 14:08:01 dragonofwar dbus-daemon[526]: [system] Activating via systemd: service name='org.freedesktop.Avahi' unit='dbus-org.freedesktop.Avahi.service' requested by ':1.271' (uid=969 pid=2512 comm="/usr/lib/colord-sane")
abr 09 14:08:01 dragonofwar dbus-daemon[526]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.Avahi.service': Unit dbus-org.freedesktop.Avahi.service not found.
abr 09 14:08:01 dragonofwar mtp-probe[2521]: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:01.2/0000:01:00.0/usb1/1-9"
abr 09 14:08:01 dragonofwar mtp-probe[2521]: bus: 1, device: 6 was not an MTP device
abr 09 14:08:01 dragonofwar dhcpcd[531]: dhcpcd_prestartinterface: Cannot assign requested address
abr 09 14:08:01 dragonofwar dhcpcd[531]: enp1s0f0u9: waiting for carrier
abr 09 14:08:01 dragonofwar dhcpcd[531]: dhcpcd_prestartinterface: Cannot assign requested address
abr 09 14:08:01 dragonofwar dhcpcd[531]: enp1s0f0u9: waiting for carrier
abr 09 14:08:01 dragonofwar colord-sane[2512]: io/hpmud/pp.c 627: unable to read device-id ret=-1

I've noticed that the idVendor shown in the output is different from the one I wrote in /etc/udev/rules.d/90-android-tethering.rules (I made this file when I was following the tutorial from Android tethering), so I changed it. But it didn't fix the issue. Here's how my 90-android-tethering.rules is currently set up:

# Execute pairing program when appropriate
ACTION=="add|remove", SUBSYSTEM=="net", ATTR{04e8}=="18d1" ENV{ID_USB_DRIVER}=="rndis_host", SYMLINK+="android"

Offline

#5 2022-04-09 18:41:13

-thc
Member
Registered: 2017-03-15
Posts: 499

Re: Android USB Tethering - device MAC is all 0's

I'm not a developer, so this is nothing more but an educated guess:

The udev subsystem recognizes your device, but the driver assigns an all-zero-MAC.
NetworkManager does not like this and refuses to bring the device up.

I didn't follow the Wiki instructions - so I neither have "usb_modeswitch" installed nor created an udev rule.

What happens when you roll back those changes on your system?

Offline

#6 2022-04-30 00:12:34

DragonOfWar
Member
Registered: 2021-10-16
Posts: 10

Re: Android USB Tethering - device MAC is all 0's

progandy wrote:

I suggest you try to use udev or a systemd unit to set a permament/random mac address.

From some blog posts it seems like windows just sets a random mac for rndis / tethering devices.

Thank you! After searching around on how to create udev rules, I finally fixed my issue. I've removed the udev rule I created when I was following the Android Tethering tutorial, and created a new one.

/etc/udev/rules.d/10-network-persistent-custom-mac-address.rules

SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="$vendoridhere PROGRAM="/sbin/ip link set %k address $macaddresshere"

Replace $macaddresshere with any valid MAC address
Replace $vendoridhere with the vendor id of the phone, that can be found by running:

udevadm info /sys/class/net/$devicenamehere

The vendor id will be value of ID_VENDOR_ID. Replace $devicenamehere with the USB tethering network device, that can be found with:

ip addr

It should be the one starting with enp.

This post in serverfault helped me to figure out how to execute a command using a udev rule based on a network device being added.

Offline

Board footer

Powered by FluxBB