Skip to contentSkip to conversation

how to rename network interface?

DISCUSSION mikep 2 participants 5 messages May 9, 2004 – May 11, 2004

lore
Share & tools
lore

mikep

author
#0 lore raw

Using udev-025 i am trying to rename eth0 with these rules in 50-udev.rules:

BUS="pci", SYSFS{device}="0x8169", NAME="eth0"
BUS="pci", SYSFS{device}="0x8139", NAME="eth1"

udev-logging doesn't show any errors.

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · mikep

Using udev-025 i am trying to rename eth0 with these rules in 50-udev.rules:

BUS="pci", SYSFS{device}="0x8169", NAME="eth0"
BUS="pci", SYSFS{device}="0x8139", NAME="eth1"

What does udevinfo show?
udevinfo -p /class/net/eth0 -a

Quoted 1 line

udev-logging doesn't show any errors.

You need to compile it with 'make DEBUG=true' to get a very detailed log.

good luck,
Kay

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#2 lore raw
In reply to mikep
Quoted 11 lines · Kay Sievers
Quoted 4 lines · mikep

Using udev-025 i am trying to rename eth0 with these rules in 50-udev.rules:

BUS="pci", SYSFS{device}="0x8169", NAME="eth0"
BUS="pci", SYSFS{device}="0x8139", NAME="eth1"

What does udevinfo show?
udevinfo -p /class/net/eth0 -a

7:16 >>udevinfo -p /class/net/eth0 -a

looking at class device '/sys/class/net/eth0':

     SYSFS{addr_len}="6"
     SYSFS{address}="00:01:0a:10:a7:3b"
     SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
     SYSFS{features}="0x29"
     SYSFS{flags}="0x1003"
     SYSFS{ifindex}="2"
     SYSFS{iflink}="2"
     SYSFS{mtu}="1500"
     SYSFS{tx_queue_len}="1000"
     SYSFS{type}="1"

follow the class device's "device"
looking at the device chain at
'/sys/devices/pci0000:00/0000:00:08.0/0000:01:07.0':

     BUS="pci"
     ID="0000:01:07.0"
     SYSFS{class}="0x020000"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x8139"
     SYSFS{irq}="5"
     SYSFS{subsystem_device}="0x8139"
     SYSFS{subsystem_vendor}="0x1436"
     SYSFS{vendor}="0x10ec"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:08.0':

     BUS="pci"
     ID="0000:00:08.0"
     SYSFS{class}="0x060400"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x006c"
     SYSFS{irq}="0"
   SYSFS{subsystem_device}="0x0000"
     SYSFS{subsystem_vendor}="0x0000"
     SYSFS{vendor}="0x10de"

looking at the device chain at '/sys/devices/pci0000:00':

     BUS=""
     ID="pci0000:00"
     SYSFS{detach_state}="0"

And udevinfo for eth1 shows:

looking at class device '/sys/class/net/eth1':

     SYSFS{addr_len}="6"
     SYSFS{address}="00:08:54:d1:a0:d5"
     SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
     SYSFS{features}="0x0"
     SYSFS{flags}="0x1002"
     SYSFS{ifindex}="3"
     SYSFS{iflink}="3"
     SYSFS{mtu}="1500"
     SYSFS{tx_queue_len}="1000"
     SYSFS{type}="1"

follow the class device's "device"
looking at the device chain at
'/sys/devices/pci0000:00/0000:00:08.0/0000:01:08.0':

     BUS="pci"
     ID="0000:01:08.0"
     SYSFS{class}="0x020000"
     SYSFS{detach_state}="0"
     SYSFS{device}="0x8169"
     SYSFS{irq}="11"
     SYSFS{subsystem_device}="0x8169"

......................................
I also tried these rules without success:

KERNEL="eth*", SYSFS{address}="00:08:54:d1:a0:d5", NAME="eth0" KERNEL="eth*", SYSFS{address}="00:01:0a:10:a7:3b", NAME="eth1"

If i use 'nameif' in the hotplug script net.agent it works. But i prefer to rename the interface by device type rather than address.

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#3 lore raw
In reply to mikep
Quoted 82 lines · mikep
Quoted 5 lines · Kay Sievers
Quoted 3 lines · mikep

Using udev-025 i am trying to rename eth0 with these rules in 50-udev.rules:

Quoted 8 lines
Quoted 2 lines

BUS="pci", SYSFS{device}="0x8169", NAME="eth0"
BUS="pci", SYSFS{device}="0x8139", NAME="eth1"

What does udevinfo show?
udevinfo -p /class/net/eth0 -a

7:16 >>udevinfo -p /class/net/eth0 -a

looking at class device '/sys/class/net/eth0':

    SYSFS{addr_len}="6"
    SYSFS{address}="00:01:0a:10:a7:3b"
    SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
    SYSFS{features}="0x29"
    SYSFS{flags}="0x1003"
    SYSFS{ifindex}="2"
    SYSFS{iflink}="2"
    SYSFS{mtu}="1500"
    SYSFS{tx_queue_len}="1000"
    SYSFS{type}="1"

follow the class device's "device"
looking at the device chain at
'/sys/devices/pci0000:00/0000:00:08.0/0000:01:07.0':

    BUS="pci"
    ID="0000:01:07.0"
    SYSFS{class}="0x020000"
    SYSFS{detach_state}="0"
    SYSFS{device}="0x8139"
    SYSFS{irq}="5"
    SYSFS{subsystem_device}="0x8139"
    SYSFS{subsystem_vendor}="0x1436"
    SYSFS{vendor}="0x10ec"

looking at the device chain at '/sys/devices/pci0000:00/0000:00:08.0':

    BUS="pci"
    ID="0000:00:08.0"
    SYSFS{class}="0x060400"
    SYSFS{detach_state}="0"
    SYSFS{device}="0x006c"
    SYSFS{irq}="0"
  SYSFS{subsystem_device}="0x0000"
    SYSFS{subsystem_vendor}="0x0000"
    SYSFS{vendor}="0x10de"

looking at the device chain at '/sys/devices/pci0000:00':

    BUS=""
    ID="pci0000:00"
    SYSFS{detach_state}="0"

And udevinfo for eth1 shows:

looking at class device '/sys/class/net/eth1':

    SYSFS{addr_len}="6"
    SYSFS{address}="00:08:54:d1:a0:d5"
    SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
    SYSFS{features}="0x0"
    SYSFS{flags}="0x1002"
    SYSFS{ifindex}="3"
    SYSFS{iflink}="3"
    SYSFS{mtu}="1500"
    SYSFS{tx_queue_len}="1000"
    SYSFS{type}="1"

follow the class device's "device"
looking at the device chain at
'/sys/devices/pci0000:00/0000:00:08.0/0000:01:08.0':

    BUS="pci"
    ID="0000:01:08.0"
    SYSFS{class}="0x020000"
    SYSFS{detach_state}="0"
    SYSFS{device}="0x8169"
    SYSFS{irq}="11"
    SYSFS{subsystem_device}="0x8169"
Quoted 9 lines

......................................
I also tried these rules without success:

KERNEL="eth*", SYSFS{address}="00:08:54:d1:a0:d5", NAME="eth0" KERNEL="eth*", SYSFS{address}="00:01:0a:10:a7:3b", NAME="eth1"

If i use 'nameif' in the hotplug script net.agent it works. But i prefer to rename the interface by device type rather than address.

Some more info as I added the rules to a new file: 10-udev.rules ##Rename network interfaces
BUS="pci", SYSFS{device}="0x8169", NAME="eth0" BUS="pci", SYSFS{device}="0x8139", NAME="eth1" KERNEL="eth*", SYSFS{address}="00:08:54:d1:a0:d5", NAME="eth0" KERNEL="eth*", SYSFS{address}="00:01:0a:10:a7:3b", NAME="eth1"

and syslog shows that the rules are applied:

udev[7620]: configured rule in '/etc/udev/rules.d//10-udev.rules' at line 3 applied, 'eth0' becomes 'eth1'

udev[7621]: configured rule in '/etc/udev/rules.d//10-udev.rules' at line 2 applied, 'eth1' becomes 'eth0'

However, the end result is that device 0x8139 is still configured as eth0 as ifconfig shows:

Quoted 1 line
Quoted 1 line

ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:01:0A:10:A7:3B
inet addr:192.168.0.5 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
.....................

I am using Gentoo linux.

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to mikep
Quoted 10 lines · mikep

and syslog shows that the rules are applied:

udev[7620]: configured rule in '/etc/udev/rules.d//10-udev.rules' at line 3 applied, 'eth0' becomes 'eth1'

udev[7621]: configured rule in '/etc/udev/rules.d//10-udev.rules' at line 2 applied, 'eth1' becomes 'eth0'

However, the end result is that device 0x8139 is still configured as eth0 as ifconfig shows:

Are you sure the the interface is not in use, while udev tries to rename it. Maybe your network script is faster than udev?

Kay

Quoted 4 lines
Quoted 1 line
Quoted 1 line

ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:01:0A:10:A7:3B
inet addr:192.168.0.5 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel