From 61f24f3d6140b746e29cc8309ed9c91a4ac221d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Wed, 26 Jun 2024 17:14:08 +0200 Subject: [PATCH] templates: Update FAQ about deconfiguring interfaces, using --state parameter (#286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: https://github.com/canonical/netplan.io/issues/268 Co-authored-by: Robert Krátký --- templates/faq.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/faq.html b/templates/faq.html index cf24c9ee..529a5fe7 100644 --- a/templates/faq.html +++ b/templates/faq.html @@ -48,7 +48,9 @@

Find the current DNS servers

To determine the current DNS servers used by the system run systemd-resolve --status (or resolvectl in 18.04 and higher) and look for the 'DNS Servers:' entry to see what DNS server is used.

Deconfigure an interface

To deconfigure an interface, remove the configuration for the device from the netplan .yaml file and run sudo netplan apply.

-

If the interface is not configured in a .yaml file in /etc/netplan, it will not be configured at boot. To remove addresses manually, a user can run ip address del <address> dev <interface>.

+

Note: netplan apply does not remove virtual devices, such as bridges and bonds, that have been created, even if they are no longer described in the Netplan configuration. That is because Netplan operates statelessly and is not aware of the previously defined virtual devices.

+

If the interface is not configured in a .yaml file in the /etc/netplan directory, it is not configured at boot. To remove an interface manually at runtime, run ip link del dev <interface>.

+

Alternatively, create a temporary backup of the YAML state in /etc/netplan: mkdir -p /tmp/old_state/etc && cp -r /etc/netplan /tmp/old_state/etc/. After creating such state, remove the interface from /etc/netplan using, for example: rm /etc/netplan/interface-to-delete.yaml, and then apply the original state: netplan apply --state /tmp/old_state

Use pre-up, post-up, etc. hook scripts

Users of ifupdown may be familiar with using hook scripts (e.g pre-up, post-up, etc.) in their interfaces file. Netplan configuration does not currently support hook scripts in its configuration definition.

Instead to achieve this functionality with the networkd renderer users can use networkd-dispatcher. The package provides users and legacy packages hook points when specific network states are reached to aid in reacting to network state. Below is a table mapping networking states and hooks available: