# how to rename a nic... udev

## Cr0t

```
_rename   Link encap:Ethernet  HWaddr 00:50:8d:bb:e6:17  

          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:23 

bond0     Link encap:Ethernet  HWaddr 00:50:8d:bb:e6:17  

          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MASTER MULTICAST  MTU:7168  Metric:1

          RX packets:5321307 errors:0 dropped:0 overruns:0 frame:0

          TX packets:5403976 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:5280784322 (4.9 GiB)  TX bytes:3580621867 (3.3 GiB)

eth1      Link encap:Ethernet  HWaddr 00:50:8d:bb:e6:17  

          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:7168  Metric:1

          RX packets:5321307 errors:0 dropped:0 overruns:0 frame:0

          TX packets:5403976 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:5280784322 (4.9 GiB)  TX bytes:3580621867 (3.3 GiB)

          Interrupt:22 Base address:0xc000
```

One of my nics is called _rename. My issue is that forcing a rename of the NIC through udev doesn't work. I searched through the forum, but none of the listed solutions worked for me.

----------

## furanku

I'm not an expert on udev rules, but I have successfully renamed my wireless device to wlan0 with this udev rule, stored in /etc/udev/rules.d/03-network.rules

```
KERNEL=="eth*", SYSFS{vendor}=="0x1260", SYSFS{device}=="0x3890", NAME="wlan0"
```

Of course you have to adapt the vendor and device ids to your needs.

----------

## potatoface

same problem here:

this is my /etc/udev/rules.d/70-persistent-net.rules

```
# PCI device 0x11ab:0x4320 (skge)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:2f:d5:fa:a0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:2f:d5:e1:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"

# PCI device 0x10ec:0x8139 (8139too)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:7d:a8:09:a1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x10ec:0x8139 (8139too)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ba:5d:2a:06", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
```

ifconfig -a

```
_rename   Link encap:Ethernet  HWaddr 00:50:ba:5d:2a:06  

          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:17 Base address:0x4000                    

dummy0    Link encap:Ethernet  HWaddr 7e:ad:74:2d:ed:54

          BROADCAST NOARP  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:0

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:11:2f:d5:fa:a0

          inet addr:xxx.xxx.xxx.xxx  Bcast:84.112.28.255  Mask:255.255.255.0

          inet6 addr: fe80::211:2fff:fed5:faa0/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:11003682 errors:0 dropped:0 overruns:0 frame:0

          TX packets:4591843 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:3762673922 (3.5 GiB)  TX bytes:329013717 (313.7 MiB)

          Interrupt:17

eth1      Link encap:Ethernet  HWaddr 00:e0:7d:a8:09:a1

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          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:16 Base address:0x8000

eth3      Link encap:Ethernet  HWaddr 00:11:2f:d5:e1:56

          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0

          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:22 Base address:0xe000

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:135 errors:0 dropped:0 overruns:0 frame:0

          TX packets:135 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:12472 (12.1 KiB)  TX bytes:12472 (12.1 KiB)

sit0      Link encap:IPv6-in-IPv4

          NOARP  MTU:1480  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)

tunl0     Link encap:IPIP Tunnel  HWaddr

          NOARP  MTU:1480  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)
```

as you can see the card that i want to be eth2 is called eth1, the one that i want to be eth1 is called _rename (these are exactly the same cards).

at bootup i get this error

```
udevd-work[1401]: error changing netif name eth1 to _rename: File exists
```

and then something like

```
udev: Your system has problems assigning persistent net names

...
```

if i delete the /etc/udev/rules.d/70-persistent-net.rules file the error is gone but my cards are not in the right order   :Crying or Very sad: 

someone said on gentoo irc channel that udev 145 has many prolblems and i think that is true.

maybe anyone has a solution for the problem?

regards,

potatoface

----------

## cach0rr0

I read somewhere to downgrade udev for this

I can't find the source for the life of me, though - and it's been a recent find.

----------

## Cr0t

 *furanku wrote:*   

> I'm not an expert on udev rules, but I have successfully renamed my wireless device to wlan0 with this udev rule, stored in /etc/udev/rules.d/03-network.rules
> 
> ```
> KERNEL=="eth*", SYSFS{vendor}=="0x1260", SYSFS{device}=="0x3890", NAME="wlan0"
> ```
> ...

 How do you get the vendor and device ID? I know I have to read out the pci bus, but I am unable to get the information.

----------

## cach0rr0

lshw should show you. 

What I might do...feck i hate that i can't remember this, but i think it goes something like

-comment out existing stuff in the rules file

-fire off /lib64/udev/write_net_rules  (or whatever your path to write_net_rules is)

----------

## Cr0t

 *cach0rr0 wrote:*   

> lshw should show you. 
> 
> What I might do...feck i hate that i can't remember this, but i think it goes something like
> 
> -comment out existing stuff in the rules file
> ...

 

```
           *-network:0 DISABLED

                description: Ethernet interface

                product: RTL-8110SC/8169SC Gigabit Ethernet [10EC:8167]

                vendor: Realtek Semiconductor Co., Ltd. [10EC]

                physical id: 0

                bus info: pci@0000:05:00.0

                logical name: _rename

                version: 10

                serial: 00:50:8d:bb:e6:17

                size: 1GB/s

                capacity: 1GB/s

                width: 32 bits

                clock: 66MHz

                capabilities: pm bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=6.011.00-NAPI duplex=full firmware=N/A latency=32 link=yes maxlatency=64 mingnt=32 multicast=yes port=twisted pair speed=1GB/s

                resources: irq:23 ioport:be00(size=256) memory:fdbff000-fdbff0ff memory:fda00000-fda1ffff(prefetchable)

           *-network:1

                description: Ethernet interface

                product: RTL-8110SC/8169SC Gigabit Ethernet [10EC:8167]

                vendor: Realtek Semiconductor Co., Ltd. [10EC]

                physical id: 1

                bus info: pci@0000:05:01.0

                logical name: eth1

                version: 10

                serial: 00:50:8d:bb:e6:17

                size: 1GB/s

                capacity: 1GB/s

                width: 32 bits

                clock: 66MHz

                capabilities: pm bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

                configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=6.011.00-NAPI duplex=full firmware=N/A latency=64 link=yes maxlatency=64 mingnt=32 multicast=yes port=twisted pair slave=yes speed=1GB/s

                resources: irq:22 ioport:bc00(size=256) memory:fdbfe000-fdbfe0ff memory:fda20000-fda3ffff(prefetchable)
```

----------

## cach0rr0

10EC is the vendor ID

I can only assume 8167 is the device ID

10EC:8167

I would still try the write_net_rules first, just to see if it's intelligent enough do the guesswork for you

----------

## Cr0t

The issue is, that both cards have the same ID.

----------

## Cr0t

 *Cr0t wrote:*   

> The issue is, that both cards have the same ID.

 restarted the box... and suddenly it worked.

----------

## d2_racing

When I have this kind of problem, I blank the udev file and then I reboot my box.

----------

## cach0rr0

 *d2_racing wrote:*   

> When I have this kind of problem, I blank the udev file and then I reboot my box.

 

++this

----------

## Cr0t

 *cach0rr0 wrote:*   

>  *d2_racing wrote:*   When I have this kind of problem, I blank the udev file and then I reboot my box. 
> 
> ++this

 I tried that multiple times, but for some reason it didn't work.   :Crying or Very sad: 

----------

## potatoface

after messing around with the problem with udev 145 and my nics for nearly 2 weeks i think i found the root of all evil....

on my system the hotplug script was started at boot runlevel and i think it was fighting with udev. after i did a

```
rc-update del hotplug default
```

my problems are gone. i tried ~10 times to reboot without any 'changing netif eth1 to _rename' errors now...    :Rolling Eyes: 

regards,

potatoface

----------

## d2_racing

Hi, can you post your actual : /etc/udev/rules.d/70-persistent-net.rules

----------

## potatoface

today the problem was back, so it wasnt the fault of hotplug, has anybody any hints how to solve this?

anyway, here is my 70-persistent-net.rules file:

```
# PCI device 0x11ab:0x4320 (skge)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:2f:d5:fa:a0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:0x8139 (8139too)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:ba:5d:2a:06", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:0x8139 (8139too)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:e0:7d:a8:09:a1", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

# PCI device 0x10de:0x0066 (forcedeth)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:11:2f:d5:e1:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"
```

regards,

potatoface

----------

