linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mikep <mikpolniak@adelphia.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: how to rename network interface?
Date: Mon, 10 May 2004 12:41:39 +0000	[thread overview]
Message-ID: <c7nta4$f1h$1@sea.gmane.org> (raw)
In-Reply-To: <c7lt0l$dr7$1@sea.gmane.org>

mikep wrote:
> Kay Sievers wrote:
> 
>> On Sun, 2004-05-09 at 14:24 -0400, mikep wrote:
>>
>>> 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.
> 
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:

 >>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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-05-10 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-09 18:24 how to rename network interface? mikep
2004-05-10  2:05 ` Kay Sievers
2004-05-10 11:30 ` mikep
2004-05-10 12:41 ` mikep [this message]
2004-05-11 10:41 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='c7nta4$f1h$1@sea.gmane.org' \
    --to=mikpolniak@adelphia.net \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).