You are not logged in.
Hello everybody, I could use some help with the situation described below.
I have a computer with several ethernet ports. Only two of them are relevant for this post, named eno8303 and eno8403. eno8303 is linked to a slot in the wall and connects to the outside world. eno8403 is linked to a switch and provides connectivity to a local network.
At boot, here is the situation :
[root@jasminum ~]# ip address
5: eno8303: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether d0:46:0c:70:94:fe brd ff:ff:ff:ff:ff:ff
altname enp4s0f0
altname enxd0460c7094fe
inet 10.101.88.16/22 brd 10.101.91.255 scope global eno8303
valid_lft forever preferred_lft forever
inet6 fe80::d246:cff:fe70:94fe/64 scope link proto kernel_ll
valid_lft forever preferred_lft forever
7: eno8403: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether d0:46:0c:70:94:ff brd ff:ff:ff:ff:ff:ff
altname enp4s0f1
altname enxd0460c7094ff
eno8303 is up and working because I installed and enabled 'dhclient' as below
systemctl enable dhclient@eno8303
eno8403 is down. I do not need dhclient on eno8403. I prefer static addresses in the local network.
I can bring eno8403 up by entering two commands
[root@jasminum ~]# ip address add 192.168.1.1/24 broadcast + dev eno8403
[root@jasminum ~]# ip link set up dev eno8403
[root@jasminum ~]# ip address
7: eno8403: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether d0:46:0c:70:94:ff brd ff:ff:ff:ff:ff:ff
altname enp4s0f1
altname enxd0460c7094ff
inet 192.168.1.1/24 brd 192.168.1.255 scope global eno8403
valid_lft forever preferred_lft forever
inet6 fe80::d246:cff:fe70:94ff/64 scope link tentative proto kernel_ll
valid_lft forever preferred_lft forever
My question: which is the best way to reach this configuration after boot, without having to enter two commands manually ?
Thank you
Note: this is a follow-up of another question, ethernet interface not recognized, and will be followed by (at least) one more, about iptables and forwarding.
Last edited by barbaros (2025-03-07 11:22:06)
Offline
My question: which is the best way to reach this configuration after boot, without having to enter two commands manually ?
One option is to use one of network managers.
Another option is to write udev rule for particular interface and run commands or script with RUN+= (i.e. write your own primitive "network manager").
Offline
Note: this is a follow-up of another question, ethernet interface not recognized, and will be followed by (at least) one more, about iptables and forwarding.
https://wiki.archlinux.org/title/Router
I personal have tested and prefer the systemd way for both the external and internal interface
Offline
I am learning how to write udev rules.
I learn slowly, so it will take some time.
I will keep you informed.
Thank you
Offline
I tried a different approach. Gave up dhclient and turned to systemd-networkd :
systemctl enable systemd-networkd
systemctl enable systemd-resolved
Created file '/etc/systemd/network/20-wired.network' containing
[Match]
Name=eno8303
[Link]
RequiredForOnline=routable
[Network]
DHCP=yes
After reboot, I get connection to the outside world. However, I get a dynamically assigned IP number which is not the one I expect. My institution reserved a specific IP number to be used for accessing this particular computer. Before, when I used dhclient, I always got this specific IP number. Now I get some random IP number, different from boot to boot.
I tried adding the option below, with no avail.
LinkLocalAddressing=yes
Things are OK if I specify the reserved IP number as a static IP, using the configuration below. But that's awkward, systemd-networkd with DHCP enabled should recognize the reserved IP number (which dhclient did).
[Match]
Name=eno8303
[Link]
RequiredForOnline=routable
[Network]
Address=10.101.88.16/22
Gateway=10.101.88.1
DNS=10.121.52.19
Another solution would be to use dhclient for eno8303 and systemd-networkd for eno8403, but that does not sound very nice ...
Any suggestions ?
Thank you. Cristian
Last edited by barbaros (2025-02-28 22:57:26)
Offline
My institution reserved a specific IP number to be used for accessing this particular computer.
Is reservation expected on LAN (eno8403) or WAN (eno8303) interface? Is reservation based on MAC address? Does the interface obtaining "wrong" address has the same MAC address from boot to boot?
Offline
I can be wrong but systemd-networkd by default should not randomize the mac so it's up to the dhcp server how to lease reserved assignments
I would contact the dhcp server admin how reservation is done and to check the logs why it fails
usually reservations are done by mac - but there're others like hostname or client identifier (used for pxe)
Offline
Isn't eno8303 the dynamically asigned NIC?
You should™ not have to tell it about any static IPs, they're supposed to be reserved in the dhcp *server* (your router or so)
Also https://wiki.archlinux.org/title/Dhcpcd#Static_profile
The difference in the assignment is likely duid vs. clientid, dhcpcd allows you to configure which one to use, i think dhclient defaults to clientid (it has a "-i" option for duid)
No idea about systemd-networkd
Last edited by seth (2025-02-28 20:43:38)
Online
Is reservation expected on LAN (eno8403) or WAN (eno8303) interface?
eno8303 (which links to the wall outlet and provides connection to the outside world) is supposed to work with DHCP and to get the reserved IP 10.101.88.16
On eno8403 (which links to a switch which will serve other computers) everything will be static.
Is reservation based on MAC address?
I'm not sure about that. When I asked for a reserved IP number I had to provide both the MAC address and the hostname.
Does the interface obtaining "wrong" address has the same MAC address from boot to boot?
MAC addresses are always the same.
I would contact the dhcp server admin how reservation is done and to check the logs why it fails
I'm not quite comfortable to do that. They would probably answer "just stick to ubuntu, it works fine". And it's true, I have ubuntu on a different partition of the same machine and it does all this stuff right out of the box.
Last edited by barbaros (2025-03-01 10:16:13)
Offline
"Ubuntu" will likely boil down to "networkmanager" and if your IT cannot tell you what data is used to reserve IPs, they make too much money (even on minimal wage or if they pay to be allowed to do the job)
Have you tried whether duid ./. clientid is the relevant difference?
https://man.archlinux.org/man/extra/dhc … n#clientid (don't overcomplicate that by adding custom strings/id's - it's gonna be one of the autogenerated ones)
Online
When I asked for a reserved IP number I had to provide both the MAC address and the hostname.
I'm not quite comfortable to do that. They would probably answer "just stick to ubuntu, it works fine". And it's true ubuntu does all this stuff right out of the box.
well - there's already something weird with this:
asking for a MAC makes the most sense as that's what they will likely configure their network and dhcp on - and in the end that's how requesting an ip via dhcp works: the client sends a broadcast; as the server needs some target to reply back the ip - which is the mac of the requesting nic - it sets that as origin
asking for a hostname is pretty much pointless - as there can easy be collisions - and if there're some issues it's more important who operates which device and where to locate it - asking for a hostname doesn't help anything here
what a hostname helps with is to set a local DNS A record so others can reach your system by a dns name rather than the IP
"just use ubuntu" isn't a valid reply as it doesn't matter - one can use systemd-networkd, networkmanager, dhclient or whatever on both arch and ubuntu - so the only proper way to investigate this issue is by the IT guys looking into the dhcp logs if they get random requests from your system - then it's up to you to investigate further - or if their server is acting weird and not properly uses the mac to re-lease you the assigned IP
I just doubt that there's any difference between using systemd-networkd and networkmanager in terms of mac randomization which would result in different IPs - in fact: from what I know for systemd-networkd you have to actively activate some privacy stuff for mac randomization while networkmanager has a habbit of having that as default option - so, if at all, one could expect the opposite: systemd-networkd working without issues while networkmanager acting up due to its defaults
Offline
asking for a hostname is pretty much pointless
I guess it's just for their own records.
any difference between using systemd-networkd and networkmanager in terms of mac randomization
MAC addresses do not change between boots.
Have you tried whether duid ./. clientid is the relevant difference?
Not yet. I intend to.
Offline
Have you tried whether duid ./. clientid is the relevant difference?
YES YES it works !
According to the manual page of systemd-networkd, we can include in the configuration file a section [DHCPv4] for providing additional options for dhcp. The relevant option for my case is 'ClientIdentifier' which, if not specified, defaults to 'duid'. I set it to 'mac' and yes, I now get the correct IP number.
By the way, the manual page is misleading, it seems to state that the section name is [DHCPV4]. Luckily, the command 'systemctl status systemd-networkd' repports 'unknown section DHCPV4'. The correct name of the section is [DHCPv4]
Thank you !
Last edited by barbaros (2025-03-08 17:22:32)
Offline
How do I edit the subject line ?
I want to add 'SOLVED' but I cannot find the link
Last edited by barbaros (2025-03-07 11:23:38)
Offline