# udev 197 predictable network names

## pakjebakmeel

Question,

I would like to move along and delete the /lib/udev/rules.d/80-net-name-slot.rules file so I get predictable network names. Only remark is that the box is completely headless and I don't feel like grabbing a keyboard and monitor. I want to do this remote without loosing connectivity.

My plan is to update the symlink in /etc/init.d/net.eth0 to /etc/init.d/net.(predictablename) and ammend /etc/conf.d/net, delete the file and reboot.

My question is what will the new predictable name be? I ran this script:

```
for i in /sys/class/net/*; do

  echo "==$i"

  udevadm test-builtin net_id "$i";

  echo

done 2>/dev/null

```

the relevant portion of output is:

```
==/sys/class/net/eth0

ID_NET_NAME_MAC=enx00224d7c586a

ID_NET_NAME_PATH=enp1s0

```

Would the new name become enx00224d7c586a or enp1s0? Which one would udev use? I've searched but cannot find the anwser.

So, I will update the symlink

```
lrwxrwxrwx 1 root root    6 Dec  7 11:44 net.eth0 -> net.lo
```

to:

```
lrwxrwxrwx 1 root root    6 Dec  7 11:44 net.enp1s0 -> net.lo
```

Next I should update the /etc/conf.d/net from:

```
config_eth0="192.168.10.10/24"

routes_eth0="default via 192.168.10.1"
```

to:

```
config_enp1s0="192.168.10.10/24"

routes_enp1s0="default via 192.168.10.1"
```

The delete this file:

```
/lib/udev/rules.d/80-net-name-slot.rules
```

and reboot.. fingers crossed and I should be ok right?

----------

## SamuliSuominen

 *pakjebakmeel wrote:*   

> 
> 
> The delete this file:
> 
> ```
> ...

 

Where did you find the information that you should delete /lib/udev/rules.d/80-net-name-slot.rules? Nothing should be deleted from /lib/udev/rules.d!

If you want the new scheme you delete /etc/udev/rules.d/80-net-name-slot.rules OR copy the /lib/udev/rules.d/80-net-name-slot.rules to /etc/udev/rules.d/

In first option, when deleted from /etc, the file from /lib takes over. In second option the content of the file from /lib is copied to /etc and the /etc one stays in control. Both achieving the same result, the new scheme being used.

By definition, all of /usr, /lib, /lib32, /lib64, /bin, /sbin are all static directories allowed to be touched only by the Package Manager (portage)

I suppose you better read the migration news item and the wiki page again.

----------

## pakjebakmeel

 *ssuominen wrote:*   

>  *pakjebakmeel wrote:*   
> 
> The delete this file:
> 
> ```
> ...

 

Thank you for that, I will confirm I get the right file in /etc/udev/rules.d/80-net-name-slot.rules deleted. I actually read both the news and the wiki but did not have it in front of me when typing this post and messed up the files. I will re-read the news/wiki to make sure I refer to the correct file.

But apart from that, the main question still remains; would udev use enx00224d7c586a or enp1s0?

```
gentoo rules.d # udevadm test-builtin net_id /sys/class/net/eth0 2> /dev/null

ID_NET_NAME_MAC=enx00224d7c586a

ID_NET_NAME_PATH=enp1s0
```

----------

## SamuliSuominen

 *pakjebakmeel wrote:*   

> 
> 
> But apart from that, the main question still remains; would udev use enx00224d7c586a or enp1s0?
> 
> ```
> ...

 

Looks correct to me and the other threads seem to concur. Google for "udevadm test-builtin net_id" and you'll find it has worked for others too.

----------

## derk

udev can use either name you get to pick  .. which you prefer ..

created a bash shell script from code in original comment  see bug 455822 for general use

----------

## dmpogo

What actually is the reason to use predictable names on a headless server,  which probably does not vary its hardwareand  ?.  Did you 'non-predictable' 

jump a lot ?

----------

## SamuliSuominen

 *dmpogo wrote:*   

> What actually is the reason to use predictable names on a headless server,  which probably does not vary its hardwareand  ?.  Did you 'non-predictable' 
> 
> jump a lot ?

 

If the box only has one network card, it'll always be eth0 and this won't be any of issue -- except you can still use the new predicatable names for just heck of it... or for consistency to match other boxes.

----------

## pakjebakmeel

 *derk wrote:*   

> udev can use either name you get to pick  .. which you prefer ..
> 
> created a bash shell script from code in original comment  see bug 455822 for general use

 

Thanks, that was the answer I was looking for.. Uhm I did try and find the bug you mention but no success. When I try and google for it using different terms I keep ending up in this topic, no other useful results. What's this bug about? Have you got a link?

----------

## derk

https://bugs.gentoo.org/show_bug.cgi?id=453494   use this one                              ..  as this https://bugs.gentoo.org/show_bug.cgi?id=455822  is obsolete

----------

## SamuliSuominen

 *derk wrote:*   

> https://bugs.gentoo.org/show_bug.cgi?id=453494   use this one                              ..  as this https://bugs.gentoo.org/show_bug.cgi?id=455822  is obsolete

 

Just to mention the obvious: The correct bug is mentioned in the issued news item, as well as in the 80-net-name-slot.rules example file we install, which is also at /usr/share/doc/udev-197-r<hit tab>/gentoo/ directory in case you have deleted it or something.

So people have now multiple options to go with, use the init script from the bug and rename the interfaces before udev starts to keep using eth*, script to tell which ones will be the new interfaces for proper migration, ...

And I think the documentation is good enough too, although seeing so many threads here about the same issue hints that it might not be. :-/

----------

## wcg

How does udev choose between ID_NET_NAME_MAC and

ID_NET_NAME_PATH?

----------

## derk

udev does not distinguish between them so far as I know .. they both point to the same device .. only one name  is based on the hardware address on the PCI bus and the other name on the mac address .. use whichever you prefer

the mac address name  form is useful when you have multiple net interfaces of the same type and wish to specify by mac address which card is which ..

----------

## pakjebakmeel

 *ssuominen wrote:*   

>  *derk wrote:*   https://bugs.gentoo.org/show_bug.cgi?id=453494   use this one                              ..  as this https://bugs.gentoo.org/show_bug.cgi?id=455822  is obsolete 
> 
> Just to mention the obvious: The correct bug is mentioned in the issued news item, as well as in the 80-net-name-slot.rules example file we install, which is also at /usr/share/doc/udev-197-r<hit tab>/gentoo/ directory in case you have deleted it or something.
> 
> So people have now multiple options to go with, use the init script from the bug and rename the interfaces before udev starts to keep using eth*, script to tell which ones will be the new interfaces for proper migration, ...
> ...

 

I think the documents is quite ok but what I couldn't get a clear answer on is which name udev is going to use. From what I see now you can use both but that isn't really clear in the docs.

----------

## pakjebakmeel

That worked fine yes.. Thanks!

```
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255

        ether 00:22:4d:7c:58:6a  txqueuelen 1000  (Ethernet)

        RX packets 1098  bytes 214828 (209.7 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 1856  bytes 237312 (231.7 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device interrupt 16  memory 0xd0120000-d0140000
```

----------

