0

Is it possible to configure systemd-networkd in a way like on Windows i nterms of DHCP and link-local address?

I mean:

  • if address can be obtained from DHCP, then fine - we are done.
  • if getting address from DHCP fails, then backfall to 169.254.x.x.

Also similar to RFC3927.

I am bit surprised how LinkLocalAddressing= option works. It just overrides DHCP. With settings like:

[Match]
Name=eth0
KernelCommandLine=!nfsroot

[Network]
DHCP=ipv4
LinkLocalAddressing=yes

I get:

Dec 17 15:10:43 my-system systemd-networkd[1276]: eth0: IPv6 successfully enabled
Dec 17 15:10:44 my-system systemd-networkd[1276]: eth0: Gained carrier
Dec 17 15:10:44 my-system systemd-networkd[1276]: eth0: DHCPv4 address 10.114.138.133/24 via 10.114.138.1
Dec 17 15:10:45 my-system systemd-networkd[1276]: eth0: Gained IPv6LL
Dec 17 15:10:57 my-system systemd-networkd[1276]: eth0: Configured
root@my-system:~#
root@my-system:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:44:44:00:04:17
          inet addr:169.254.184.36  Bcast:169.254.255.255
          Mask:255.255.0.0
  • Is not that the default behaviour? – Rui F Ribeiro Dec 17 '18 at 16:37
  • This seems to default behaviour on Debian stable/testing AFAICT. – Gen.Stack Mar 25 at 13:21
0

Try using "ip addr show" rather than ifconfig. I suspect that this will show you two IP addresses:

  1. the link local address; and
  2. the DHCP assigned IP address.

systemd-networkd is not "overriding" the DHCP assigned address with the link local address. Both addresses are active and working. It's just that ifconfig is only capable of showing a single IP address on the interface and it shows you the first address that it sees, ignoring any others.

ifconfig is already deprecated. It's time to switch to using the ip utility instead... Here's a cheat sheet that might help: https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf

  • You are right - both addresses are active and shown by 'ip a' – coulomb Dec 19 '18 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.