Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active June 1, 2024 19:42
Show Gist options
  • Save plembo/1b1980f36500bbbac0552c6b7d226f4f to your computer and use it in GitHub Desktop.
Save plembo/1b1980f36500bbbac0552c6b7d226f4f to your computer and use it in GitHub Desktop.
Force new systemd-networkd config without reboot

How to force a new systemd-networkd config without reboot

Reference: Stack Exchange: systemd-networkd - how to force new configuration without reboot? (Answer by user 156350). February 13, 2016.

Originally had a Ubuntu 18.04 LTS server configured with a bridge interface called "br0".

Decided to remove it as an unnecessary complexity (it was originally there to service multiple IPs on the same physical interface, but I now only need one IP).

First rewrote /etc/netplan/01-netcfg.yaml to remove bridge and put everything under the ethernet iface, so it looked something like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: false
      addresses:
        - 172.16.12.32/24
      gateway4: 172.16.12.1
      nameservers:
        addresses: [172.16.3.4,8.8.8.8]
        search: [mydomain.com]

Then issued the following commands:

$ sudo netplan apply
$ sudo ip link set down br0
$ sudo ip link del dev br0
$ sudo systemctl restart systemd-networkd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment