1

I have four Huawei E3372h-607 4G modems in HiLink mode which means they are detected as 4 ethernet adapters:

...
[ 1378.768228] cdc_ether 2-1:1.0 eth0: register 'cdc_ether' at usb-0000:00:14.0-1, CDC Ethernet Device, 0c:5b:8f:27:9a:64
...
[ 1378.803419] cdc_ether 2-1:1.0 enx0c5b8f279a64: renamed from eth0
...
[ 1409.056051] cdc_ether 2-2:1.0 eth0: register 'cdc_ether' at usb-0000:00:14.0-2, CDC Ethernet Device, 0c:5b:8f:27:9a:64
...
[ 1409.076039] cdc_ether 2-2:1.0 rename9: renamed from eth0
...
[ 1409.056051] cdc_ether 2-3:1.0 eth0: register 'cdc_ether' at usb-0000:00:14.0-3, CDC Ethernet Device, 0c:5b:8f:27:9a:64
...
[ 1409.076039] cdc_ether 2-3:1.0 rename10: renamed from eth0
...
[ 1409.056051] cdc_ether 2-4:1.0 eth0: register 'cdc_ether' at usb-0000:00:14.0-4, CDC Ethernet Device, 0c:5b:8f:27:9a:64
...
[ 1409.076039] cdc_ether 2-4:1.0 rename11: renamed from eth0

$ lsusb
Bus 001 Device 002: ID 8087:8000 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 010: ID 12d1:14dc Huawei Technologies Co., Ltd.
Bus 002 Device 008: ID 12d1:14dc Huawei Technologies Co., Ltd.
Bus 002 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd.
Bus 002 Device 004: ID 12d1:14dc Huawei Technologies Co., Ltd.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

$ ip link
...
17: enx0c5b8f279a64: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
18: rename18: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
19: rename19: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff
20: rename20: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 0c:5b:8f:27:9a:64 brd ff:ff:ff:ff:ff:ff

There are two problems:

  1. They have the same MAC addresses which cause problems when I want to bridge them to be used in a KVM virtual machine (OpenMPTCProuter VM).
  2. The name are changing for the second ethernet onwards after unplugging and replugging.

Based on systemd.link's MACAddressPolicy, I wrote the following /etc/systemd/network/01-huawei-e3372h.link file:

[Match]
MACAddress=0c:5b:8f:27:9a:64
Driver=cdc_ether

[Link]
Description=Huawei E3372h-607 in HiLink mode
NamePolicy=path
MACAddressPolicy=random

EDIT:

$ ip link
...
14: enp0s20u4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether ea:af:69:01:3e:0d brd ff:ff:ff:ff:ff:ff
15: enp0s20u3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 76:4a:48:f0:bb:a6 brd ff:ff:ff:ff:ff:ff
20: enp0s20u1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether f6:2e:3d:9a:49:b0 brd ff:ff:ff:ff:ff:ff
21: enp0s20u2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether d6:33:ba:8a:08:95 brd ff:ff:ff:ff:ff:ff

Ok, so after checking ip link, the random MAC actually works. And after following this answer:

sudo ln -s /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/80-net-setup-link.rules

The rename also works. This question can be closed.

0 Answers0