You are not logged in.

#1 2013-08-27 21:38:20

whitethorn
Member
Registered: 2010-05-02
Posts: 153

[SOLVED] Can't rename network interfaces

Hi everyone,

I'm trying to setup a server.  It has 4 onboard nics. I have created a /etc/udev/rules.d/10-network.rules file. I have added the following.

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:25:90:21:ac:70", NAME="net15"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:25:90:21:ac:71", NAME="net30"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:25:90:21:ac:72", NAME="net40"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:25:90:21:ac:73", NAME="net20"

I am using netctl where I have setup profiles and enabled the above mentioned interfaces.

For some reason it's not loading the names I provided above. I am getting the following.

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:21:ac:70 brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x/24 brd x.x.x.x.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::225:90ff:fe21:ac70/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:21:ac:71 brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x/24 brd x.x.x.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::225:90ff:fe21:ac71/64 scope link
       valid_lft forever preferred_lft forever
4: netpharos: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:21:ac:72 brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x/24 brd x.x.x.255 scope global netpharos
       valid_lft forever preferred_lft forever
    inet6 fe80::225:90ff:fe21:ac72/64 scope link
       valid_lft forever preferred_lft forever
5: net20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:25:90:21:ac:73 brd ff:ff:ff:ff:ff:ff
    inet x.x.x.x/24 brd x.x.x.255 scope global net20
       valid_lft forever preferred_lft forever
    inet6 fe80::225:90ff:fe21:ac73/64 scope link
       valid_lft forever preferred_lft forever

I'm not sure what I missed.

Last edited by whitethorn (2013-08-29 19:41:20)

Offline

#2 2013-08-27 21:51:50

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] Can't rename network interfaces

I rename the network interfaces on my laptop because one of them is just super long with the predictable interface names, and if I use the normal kernel namespace, my broadcom wifi card and my ethernet card both register as eth*. 

I was finding that sometimes my interface names were not being registered properly on boot (and even still it sometimes happens, though very rarely).  So what I did was I masked the 80-net-slot-names.rules, which I am totally unsure is necessary or not, and then I made my custom names as 79-custom-names.rules (or something like that).

My thought here was that although I am not sure how the lexicographical numbering for udev rules are chosen, there must be a reason why upstream chooses 80 and not, say 04.  So by making it 79 it is as close to where the predicable names are as I can get… though with 80-net-slot-names.masked, I'm sure you could actually use 80 as well.  In fact, you could probably even use 80-net-slot-names.rules for your custom interface rules instead of having that file as a symlink to /dev/null.

So now things are pretty consistent.  Though when I was adjusting some things with my bootloader, I did notice once that it did end up as eth0 and eth1.  But fortunately, now that is the exception rather than the rule.

Offline

#3 2013-08-27 22:08:00

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] Can't rename network interfaces

You can check the journal for messages about the renaming (search for "systemd-udevd"). Netctl shouldn't have anything to do with the problem.

Also, the only interface which gets successfully renamed is the last one in your rules file. This may not be a coincidence.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2013-08-27 23:44:16

whitethorn
Member
Registered: 2010-05-02
Posts: 153

Re: [SOLVED] Can't rename network interfaces

Well that definitely pointed me in the right direction.

Here's a snippet from journalctl.

Aug 27 11:28:34 archgate systemd-udevd[288]: error changing net interface name eth1 to net30: Device or resource busy
Aug 27 11:28:34 archgate systemd-udevd[286]: error changing net interface name eth0 to net15: Device or resource busy
Aug 27 11:28:34 archgate systemd-udevd[290]: renamed network interface eth3 to net20
Aug 27 11:28:34 archgate systemd-udevd[285]: renamed network interface eth2 to netpharos

Looks like it's starting the network before udev has renamed the interfaces. I found some threads in this forum which provide some additional information and possibly a workaround (change to system network script). Not sure how it will work with netctl, at least I have something to go on. Will report back once I have access to the server again.

Edit :: Rolled back to a backup pre udev 197.

Will test this on a VM before updating again.

Last edited by whitethorn (2013-08-29 19:47:52)

Offline

Board footer

Powered by FluxBB