LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   network interface being renamed - how to prevent that? (https://www.linuxquestions.org/questions/linux-networking-3/network-interface-being-renamed-how-to-prevent-that-946662/)

totaluser 05-24-2012 01:19 PM

network interface being renamed - how to prevent that?
 
Hello everybody,
I am running Ubuntu 12.04 x64 LTS (upgrade from 11.10, not fresh install)
my problem is that some of my USB network adapters have the same MAC address, but since they are being initialized in the order by which USB ports are identified (3,4,5,6), it is not a problem and I can deterministically tell which is which

so here is the dmesg output

Code:

[    3.643473] r8169 0000:02:00.0: eth0: RTL8168d/8111d at 0xffffc90005784000, e0:cb:4e:9d:fd:30, XID 083000c0 IRQ 54
[    3.643476] r8169 0000:02:00.0: eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[    3.648644] eth1: D-Link DFE-580TX 4 port Server Adapter at 000000000001ec00, 00:0d:88:cd:6a:50, IRQ 17.
[    3.649413] eth1: MII PHY found at address 1, status 0x7829 advertising 01e1.
[    3.961958] eth2: D-Link DFE-580TX 4 port Server Adapter at 000000000001e880, 00:0d:88:cd:6a:51, IRQ 18.
[    3.962690] eth2: MII PHY found at address 1, status 0x7829 advertising 01e1.
[    4.275398] eth3: D-Link DFE-580TX 4 port Server Adapter at 000000000001e800, 00:0d:88:cd:6a:52, IRQ 19.
[    4.276158] eth3: MII PHY found at address 1, status 0x7829 advertising 01e1.
[    4.588583] eth4: D-Link DFE-580TX 4 port Server Adapter at 000000000001e480, 00:0d:88:cd:6a:53, IRQ 16.
[    4.589314] eth4: MII PHY found at address 1, status 0x7829 advertising 01e1.
[  31.242882] ADDRCONF(NETDEV_UP): eth0: link is not ready
[  31.242889] ADDRCONF(NETDEV_UP): eth1: link is not ready
[  31.242896] ADDRCONF(NETDEV_UP): eth2: link is not ready
[  31.242902] ADDRCONF(NETDEV_UP): eth3: link is not ready
[  31.242908] ADDRCONF(NETDEV_UP): eth4: link is not ready
[  33.503535] dm9601 1-1.3:1.0: eth5: register 'dm9601' at usb-0000:00:1a.0-1.3, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58
[  33.517899] dm9601 1-1.4:1.0: eth6: register 'dm9601' at usb-0000:00:1a.0-1.4, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58
[  33.532398] dm9601 1-1.5:1.0: eth7: register 'dm9601' at usb-0000:00:1a.0-1.5, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58
[  33.546647] dm9601 1-1.6:1.0: eth8: register 'dm9601' at usb-0000:00:1a.0-1.6, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58
[  34.650576] udevd[564]: renamed network interface eth7 to rename9
[  34.674350] udevd[568]: renamed network interface eth5 to rename7
[  34.702415] udevd[566]: renamed network interface eth8 to rename10


I know that rules are stored here
Code:

/etc/udev/rules.d/70-persistent-net.rules
Code:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e0:cb:4e:9d:fd:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1186:0x1002 (sundance)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0d:88:cd:6a:51", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x1186:0x1002 (sundance)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0d:88:cd:6a:50", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1186:0x1002 (sundance)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0d:88:cd:6a:52", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x1186:0x1002 (sundance)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0d:88:cd:6a:53", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# USB device 0x0bda:0x8187 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:c0:ca:1f:fa:88", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"



# USB device 0x0fe6:0x9700 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth8"

# USB device 0x0fe6:0x9700 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth7"

# USB device 0x0fe6:0x9700 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth5"

# USB device 0x0fe6:0x9700 (usb)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:4c:53:44:58", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth6"


if I remove the last 4 entries and reboot, system names the interfaces correctly (eth5 eth6 eth7 eth8)
immediately after it boots, it adds those last 4 entries to the rules file and after reboot it show interfaces as renameX and not as ethX


so the solution is not to have entries for those NICs in the 70-persistent-net.rules file

one solution would be to run a script that would remove those entries, but I hope there is some other solution like excluding those 4 NICs from being processed by rules file

how to remove those last 4 entries for good and prevent them from being added after boot?

when I was using Ubuntu 11.10, I just removed them and after reboot they weren't added anymore so I had no problems

thanks for your input in advance

totaluser 05-24-2012 02:06 PM

OK, I figured it out by now

reding the file /lib/udev/rules.d/75-persistent-net-generator.rules
and adding lines
Code:

# ignore Davicom USB NICs with the same MAC address
ENV{MATCHADDR}=="00:e0:4c:53:44:58", GOTO="persistent_net_generator_end"

so now it is not added to the rules file and no renaming is happening


I am posting the solution just in case anybody in the future happens to have the same or similar problem

deke2000 08-03-2012 11:37 AM

I had a very similar problem. I had my /etc/udev/rules.d/70-persistent-net.rules setup to organize the naming so the eth* numbers matched the order they are physically numbered on the back of the system. All was well with all the stars in alignment. Unicorns pranced and jumped over rainbows. Then, I installed/setup KVM/qemu.

I thought that I had turned off NetworkManager. I suspect that the installation or maybe use of virt-manager automagically turned it back on.

After beating my head against the wall, I searched for an answer online but only found people reporting that I merely need to remove my 70-persistent-net.rules file! That's all fine and dandy if you accept whatever udev throws at you. I had a "bond" setup with three NICs. It was not fine and dandy with me.

[LOOK HERE FOR THE SOLUTION]
I finally found that NetworkManager had put the HWADDR (MAC) address in the /etc/sysconfig/network-scripts/ifcfg-* files. THIS was contrary to what I had in my 70-persistent-net.rules. Apparently, udev will look in these files and write rules to try to accomodate the ifcfg-* files.

Correcting this, solved my issue. Oh, and NetworkManager is off.


All times are GMT -5. The time now is 06:48 PM.