You are not logged in.

#1 2014-03-11 12:04:44

gava
Member
Registered: 2014-02-26
Posts: 14

networkd + eth0

This new networkd is giving me a headache.
Apparently all the examples that allow the old naming convention disable networkd completely and i dont want that.

I'd like to configure networkd to name the first found wired connection with a specific name (I dont care about the names of the other connections, just the first one).
On reboot this name is assigned to the new first connection which might not be the same as the previous one.
Is this possible?

I configure the system in a different pc than the one we deploy with. Since I need to assign a static ip to the wired connection found in the other pc I need to know how it will be named in advance.

Offline

#2 2014-03-11 12:48:33

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: networkd + eth0

Just follow the wiki [1] using a wildcard for the device name, something like...

[Match]
Name=en*

[Network]
Address=192.168.0.15/24
Gateway=192.168.0.1

[1] https://wiki.archlinux.org/index.php/Ne … d-networkd


Edit - This may only work if the machine only has one NIC, I'm not sure what happens if there are multiple matches.

Last edited by Slithery (2014-03-11 12:50:02)


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2014-03-11 15:37:20

gava
Member
Registered: 2014-02-26
Posts: 14

Re: networkd + eth0

Thanks for the example+link.
I dont know what happens if more than one NIC is available but I guess that they will all be assigned the same ip.
Since I have a single interface that shouldnt affect me right now but I'd rather have the rest not get assigned anything but that's for later.
The thing is that I need to know the exact name. A service that runs on systemd needs to read the mac address of the available interface
(I didn't mention this in the original post, sorry). Since the mac is in /sys/class/net/<interface name>/address whithout the exact name I'd
need to search the folder for any en* directories, etc. I can build a script for that but I was just reading the new udev naming rules.
Can't I create a link rule for udev so that the names for wired connections are really predictable? maybe en0, en1, en2, etc in the order they are discovered?
I've failed at finding an example that names acording to a rule, they all use static names like:

[Match]
Type=wlan

[Link]
Name=wireless0

This is for wireless but the name seems static, if two are found I dont know what would happen.
I'll keep digging.

Offline

#4 2014-03-13 12:42:32

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,489

Re: networkd + eth0

You are mixing up the "Name=" declaration for the interface (in Match) and the link-name.

An interface name like "enp0s25" is persistent, no matter how many cards you add. Have a look again up and down the wiki link slithery posted. All you want to ensure is described there.

Offline

#5 2014-03-13 12:52:30

progandy
Member
Registered: 2012-05-17
Posts: 5,280

Re: networkd + eth0

gava wrote:

I configure the system in a different pc than the one we deploy with. Since I need to assign a static ip to the wired connection found in the other pc I need to know how it will be named in advance.

You know the target pc in advance, so simply clone your network configuration and modify the device name. current versions of systemd-udev derive the name from the hardware path which will never change as long as the network card stays in the same hardware slot. (except for usb devices).

Last edited by progandy (2014-03-13 12:53:28)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB