Good day to all!
The essence of the question is as follows. I have two USB WI-FI network cards. By default, UDEV assigns them the names wlan0 and wlan1, respectively. If I change the USB port for any of these network cards, then after the reboot, the names of the network interfaces may also change. I need each network card to always have the same network interface name, regardless of which USB port it is connected to.
I tried using the MAC address to identify network interfaces:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="wifi2g"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="wifi5g"
Then I tried using “idVendor” and “idProduct”:
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="vid1", ATTRS{idProduct}=="pid1", NAME="wifi2g"
SUBSYSTEM=="net", ACTION=="add", ATTRS{idVendor}=="vid2", ATTRS{idProduct}=="pid2", NAME="wifi5g"
In both cases, the UDEV rule only works for one network card, namely “wifi5g”. And the name of the second network card always remains “wlan1”, so that I do not undertake.
Why is this happening? What else can be done?
In addition
I also checked the output of dmesg|grep wlan.
And that’s what I saw:
[ 16.771747] RTW: rtw_ndev_init(wlan0) if1 mac_addr=1c:bf:ce:4b:90:05
[ 16.799590] rtl88x2bu 1-3.1:1.0 wifi5g: renamed from wlan0
[ 16.980804] rt2800usb 1-2:1.0 wifi2g: renamed from wlan0
[ 292.403577] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
Why does the system initially try to bind both rtl88x2bu and rt2800usb drivers to the wlan0 interface???
Although the output of the “iw dev” command shows:
phy#1
Interface wlan1
It confused me in general.