brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: link-local: [] turns off link-local addresses in netplan

Netplan
~/tips/tip-netplan-link-local-empty

link-local: []

Without the key netplan enables only IPv6 link-local addresses, and an empty list switches both kinds off.

A freshly configured interface often has an address you never asked for, the fe80:: one. That is IPv6 link-local, and netplan has a key to decide about it.

network:
  version: 2
  ethernets:
    enp1s0:
      dhcp4: true
      link-local: []

The link-local key takes a list that can hold ipv4, ipv6 or both. The reference says that if the key is not defined, only IPv6 link-local addresses are enabled. An empty list disables both. To turn on IPv4 link-local as well, write link-local: [ ipv4, ipv6 ].

A related key is accept-ra, which controls whether Router Advertisements are accepted. When you leave it out, the kernel default of the host applies. And optional-addresses lets you say that certain address types, such as ipv4-ll or dhcp6, are not required before the interface counts as online.

The caveat: with the NetworkManager renderer, link-local has no effect when DHCP is enabled. So the key is mostly useful with networkd. Check the addresses afterwards with ip addr show enp1s0.

The same reference describes accept-ra as accepting a Router Advertisement that would have the kernel configure IPv6 by itself. It is a separate switch from link-local, so changing one does not touch the other. Change one key at a time and keep console access to the machine in case the network goes away.

Further reading: Netplan YAML reference

More Netplan tips – to: 192.168.3.0/24 hidden: true lacp-rate: fast wakeonlan: true ls -l /etc/netplan/ All Netplan tips (21) All topics

Link