0

everytime that I use the Ethernet over USB connection I need to change the MAC address of the interface to achieve the connection

macchanger -r enp0s20f0u1

After the change the connection is automattic, but If I disconnect and connect again I need to change the MAC address again.

Technical details

  • OS: Debian buster (10.3) Kernel: 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
  • NetworkManager: 1.14.6
  • KDE: 5.14.5
12
  • Do you change to a specific mac address or doesn't it matter to which one? Can you check the DHCP server if the original address has been blocked for any reason? Mar 24, 2020 at 15:44
  • I change to random MAC address. I cannot find how to get the blocked MAC address.
    – gvd
    Mar 24, 2020 at 23:10
  • Do you know what the address is before you change it? What does lsusb tell you about your usb device? Mar 25, 2020 at 7:08
  • Before change it 00:00:00:00:00:00 (XEROX CORPORATION). lsusb Bus 001 Device 039: ID 04e8:6863 Samsung Electronics Co., Ltd Galaxy series, misc. (tethering mode)
    – gvd
    Mar 25, 2020 at 12:02
  • OK, so the problem is that there isn't an address at all. Mar 25, 2020 at 12:29

2 Answers 2

1

I'm running buster 10.4 and possible caveats is I'm running the NetworkManager at all.

In order to get Ethernet over USB to work correctly, I added

  g_ether 

to /etc/modules and rebooted with the device connected with a USB cable.

To my surprise, when I typed

  ifconfig -a 

there were now two Ethernet interfaces - the original Ethernet interface

 enp0s25

and second Ethernet interface.

  enx00e02277cd85

with a MAC address of 00:e0:22:77:cd:85.

I simply added the second interface to /etc/network/interfaces as

    iface enx00e02277cd85 inet static
    address 192.168.2.11
    netmask 255.255.255.0
    network 192.168.2.0
    gateway 192.168.2.1

where the gateway address is the IP address of the device I need to access using a USB cable - and rebooted.

And added the IP address to /etc/hosts using the name pluto for convenience.

Also, if you type ifconfig at the right moment after you plug in the USB device, the new device starts out as eth0 but is renamed to enx00e02277cd85.

My only requirement is to be able to ssh into the device which is ADALM-PLUTO SDR - a full-duplex RF device.

1
  • It doesn't work.
    – gvd
    Aug 23, 2020 at 21:35
0

With a udev rule and a small script, it is possible to assign a fixed Mac Address when the usb tethering is established, as Mon Bloc-Notes explains.

Find the serial of your device (in the article it is usb0, yours is eth0 if I'm not mistaken).

udevadm info -a -p /sys/class/net/eth0

Create or add a new rule to /etc/udev/rules.d/90-local.rules

ACTION=="add", DRIVERS=="usb", ATTRS{serial}=="xxxx", RUN+="/etc/udev/scripts/android"

Create an executable script /etc/udev/scripts/android

#!/bin/bash
ifconfig eth0 down
ifconfig eth0 hw ether 02:11:22:33:44:55
ifconfig eth0 192.168.42.1
ifconfig eth0 up

Finally, prevent networkmanager from managing that device (see link).

1
  • My interface is rename from eth0 to enp0s20f0u1 as new debian does. I tried the solution in the post, but unfortunately it did not work.
    – gvd
    Mar 26, 2020 at 14:08

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.