LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   /etc/udev/rules.d/70-persistent-net.rules and 'ip link' rename (https://www.linuxquestions.org/questions/linux-networking-3/etc-udev-rules-d-70-persistent-net-rules-and-ip-link-rename-946670/)

rakeafake 05-24-2012 01:31 PM

/etc/udev/rules.d/70-persistent-net.rules and 'ip link' rename
 
I plugged in two TRENDnet TU-ET100C USB NICs;
CentOS6 was giving me the name eth5 for one of them;
I wanted this particular NIC to have the name eth3;
Eventually I edited /etc/udev/rules.d/70-persistent-net.rules by hand and it gave me the name I wanted;
That might have been the end of the issue, except I tried a test to see what I the ip command would do;
my commands was this:
Code:

ip link set eth5 name eth3
This seemed to cause odd duplicate naming to happen;
When I typed
Code:

ip link show
one of the NICs was called 'rename4';
After various spazzy other attempts to undo this, this is the state of my 70-persistent-net.rules file:
Code:

centos6> cat /etc/udev/rules.d/70-persistent-net.rules
# 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 0x8086:0x10bd (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:4f:bf:36:6a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x1229 (e100)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:02:b3:10:98:a6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x1229 (e100)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:02:b3:10:96:b1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# USB device 0x07a6:0x8511 (usb) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:d1:1f:e1:e7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# USB device 0x07a6:0x8511 (usb) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:d1:1f:da:fb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth4"

# USB device 0x07a6:0x8511 (usb) (custom name provided by external tool)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:d1:1f:da:fb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

My questions are these;
How do I remove the (custom name provided by external tool) entries?
Which 'external tool' is causing these entries?
How do I undo these changes?

I just want the two USB NICs to be eth3 and eth4 as they would be discovered normally. This is because currently eth4 is not being brought up at boot time.

Here is my ip link show after bootup:
Code:

centos6> ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 00:1e:4f:bf:36:6a brd ff:ff:ff:ff:ff:ff
3: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:14:d1:1f:e1:e7 brd ff:ff:ff:ff:ff:ff
4: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:14:d1:1f:da:fb brd ff:ff:ff:ff:ff:ff
5: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:02:b3:10:98:a6 brd ff:ff:ff:ff:ff:ff
6: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:02:b3:10:96:b1 brd ff:ff:ff:ff:ff:ff

Here is my ifconfig after bootup:
Code:

centos6> ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1E:4F:BF:36:6A
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:21 Memory:febe0000-fec00000

eth1      Link encap:Ethernet  HWaddr 00:02:B3:10:98:A6
          inet addr:10.0.15.241  Bcast:10.0.255.255  Mask:255.255.0.0
          inet6 addr: fe80::202:b3ff:fe10:98a6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5458 errors:0 dropped:0 overruns:0 frame:0
          TX packets:116 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:517619 (505.4 KiB)  TX bytes:16134 (15.7 KiB)

eth2      Link encap:Ethernet  HWaddr 00:02:B3:10:96:B1
          inet6 addr: fe80::202:b3ff:fe10:96b1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10760 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1046125 (1021.6 KiB)  TX bytes:368 (368.0 b)

eth3      Link encap:Ethernet  HWaddr 00:14:D1:1F:E1:E7
          inet6 addr: fe80::214:d1ff:fe1f:e1e7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:578 (578.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

I found some work-arounds using a rule set 71-persistent-net-myrules.rules, but I want to know how udev is adding these custom rules and how to configure it not to add them.

kbp 05-28-2012 11:49 PM

It looks like the last rule has the duplicate mac address (00:14:d1:1f:da:fb) and duplicate device name (eth3), I'd suggest you remove that and reboot.

rakeafake 06-01-2012 08:59 AM

Thanks kbp for the response. You have pinpointed the problem. I have edited the file and rebooted. I fixed-up the entries in /etc/sysconfig/network-scripts/ifcfg-eth4, as well. Everything seems good now. I still suspect there is some odd voodoo in there. :)

okcomputer44 06-05-2012 10:14 AM

Quote:

Originally Posted by rakeafake (Post 4692996)
I still suspect there is some odd voodoo in there. :)

Hi,

I play a lot with CentOS virtual machines. I have a master VM and I copy this and use the new image as a new VM.
Of course the new machine gets a new network interface because the HW address changed.
So when I boot it the network has to be fixed. (new eth name and new HW address must be changed including the interface's file name)
I issue the
Code:

ifconfig -a
and it tells me the real hardware address of the interface (or open the kvm to check it).
Then I open the 70-persistent-net.rules and replace the HW address with the appropriate interface name. (ethX)
Then I change the ifcfg-ethX to match with the 70-persistent-net.rules ethX name and HW address as well as the file name of course. (ifcfg-eth0 or ifcfg-eth1 and so on)
When it's all done I reboot the VM and I got the proper ethX up and running.

If something goes wrong the system automatically adds a new ethX interface to match with a new HW address.
It looked tricky for me too in the first place but it is not that complicate.

Laz

jtmoon 02-01-2016 08:34 PM

reported and fixed
 
Ubuntu bug #1470399.


All times are GMT -5. The time now is 02:00 AM.