LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   70-persistent-net.rules renames only one interface (https://www.linuxquestions.org/questions/linux-networking-3/70-persistent-net-rules-renames-only-one-interface-4175459085/)

er.car 04-22-2013 02:07 AM

70-persistent-net.rules renames only one interface
 
Hi,

I’m running Slackware 14 on a test router with 8 interfaces and want to set custom names for interfaces eth2 to eth7, so I made the changes in the 70-persistent-net.rules files and rebooted. After the reboot only one of the interfaces is renamed as per the 70-persistent-net.rules file; all other interface retain their normal naming, i.e. eth2, eth3, and so on.

So I deleted the 70-persistent-net.rules file and rebooted again, it does not help. From what I see every time I delete the file any one of the interfaces is randomly renamed, but not more than one.

I checked dmesg and all I see over there is logs indicating all the interface have been bought up successfully, and after that one single entry “renamed network interface eth7 to xxx”. eth7 randomly changes every time I delete the 70-persistent-net.rules file and reboot.

In case it makes any difference, I’m running Slackware on Hyper-V with the interfaces configured as network adapters (not legacy).

Any tips on how to proceed?

er.car 04-22-2013 12:32 PM

Here is an update on this…

I know that the later Linux kernels have the hyper-v vm drivers integrated and also I can see in dmesg the hyper-v drivers are being loaded, apart from that the network cards work properly other than the problem of not being renamed as per 70-persistent-net.rules. So obviously this is not a driver problem; however, just to make sure it was not something related to the new synthetic devices in hyper-v I performed this test.

I added 2 legacy LAN cards and tried renaming them from the 70-persistent-net.rules file. So now my vm has this configuration…
2 legacy LAN cards
6 synthetic LAN cards
There are rules defined for all of them in 70-persistent-net.rules file; however, only 2 of the 8 interface get renamed, i.e. 1 legacy interface and 1 synthetic interface.

So it seems udev is renaming only one interface of each type. Is this what is supposed to happen if there are multiple NIC cards using the same driver? If no, how do I get the other interfaces renamed?

gdizzle 04-23-2013 06:01 PM

Hi we need more information on how you are setting the udev rules.

Can you paste the
Code:

/etc/udev/rules.d/70-persistent-net.rules
, so we can see what you have done, also you are using the Mac addresses of the NIC's to assign the udev rules right?

We also need an
Code:

ifconfig -a
of all the devices and the mac addresses so we can confirm the rules.

Udev can rename all the interfaces as needed with the right custom attributes.

You also need to state your questions clear, you are still after only eth2 and eth7 to be renamed right?
Also what do you wish to name them?

er.car 04-24-2013 10:01 AM

The behavior seems to be more random than what I initially thought it to be. I am trying to rename all of the interfaces. Here is the content of the files; it will give you a better idea of what exactly is happening…

Code:

# PCI device 0x1011:/sys/devices/pci0000:00/0000:00:0a.0 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:2a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="int0"

# PCI device 0x1011:/sys/devices/pci0000:00/0000:00:0a.1 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:21", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="int1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:a1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sa1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:a2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sa2"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:b1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sb1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:b2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sb2"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:c1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sc1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:c2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sc2"

Code:

eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:a1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.222.254  netmask 255.255.255.0  broadcast 192.168.222.255
        ether 00:15:5d:49:49:a2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth3: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:b2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth4: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:c1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth5: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:c2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

int0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:2a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 9  base 0x6000

int1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:21  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 9  base 0xe000

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sb1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:15:5d:49:49:b1  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


gdizzle 04-25-2013 12:27 AM

Hi after reviewing your udev entries things look correct:

Code:

# PCI device 0x1011:/sys/devices/pci0000:00/0000:00:0a.0 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:2a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="int0"

# PCI device 0x1011:/sys/devices/pci0000:00/0000:00:0a.1 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:21", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="int1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:a1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sa1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:a2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sa2"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:b1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sb1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:b2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sb2"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:c1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sc1"

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:c2", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="sc2"

eth0: ether 00:15:5d:49:49:a1
eth1: ether 00:15:5d:49:49:a2
eth3: ether 00:15:5d:49:49:b2
eth4: ether 00:15:5d:49:49:c1 
eth5: ether 00:15:5d:49:49:c2 
int0: ether 00:15:5d:49:49:2a = working
int1: ether 00:15:5d:49:49:21 = working
sb1:  ether 00:15:5d:49:49:b1 = working

However start going through:

Code:

udevadm info -a -p /sys/class/net/eth0
udevadm info -a -p /sys/class/net/eth1
udevadm info -a -p /sys/class/net/eth3
udevadm info -a -p /sys/class/net/eth4
udevadm info -a -p /sys/class/net/eth5

Try another custom attribute apart from the MAC address.

er.car 04-25-2013 08:53 AM

Hi,

I have tried setting the rules based on ifindex, however it still does not seem to work. I have set rules for all devices similar to this . . .

Code:

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:49:49:a1", ATTR{dev_id}=="0x0", ATTR{type}=="1", ATTR{ifindex}=="4", KERNEL=="eth*", NAME="sa1"

I'm not sure if this is related; but, I am running Slackware on Hyper-V, and the udev rules are not generated by default (at least not on Slackware, I’m not sure about other distros) for VMs running on Hyper-V or VMware. There is a check in the 75-persistent-net-generator.rules file which prevents the udev rules from generating.

Code:

# ignore VMWare virtual interfaces
# ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end"
# ignore Hyper-V virtual interfaces
# ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end"

I had to hash out these lines to force udev to create rules for my NICs. Does anyone know why VMware and Hyper-V virtual interfaces are skipped?

gdizzle 04-25-2013 05:25 PM

This might give you some more ideas to try:

http://www.linuxquestions.org/questi...-rules-907381/
http://www.linuxquestions.org/questi...es-4175459287/


All times are GMT -5. The time now is 03:43 PM.