configuration

Netplan YAML — Network renderer configuration

Netplan translates YAML configuration into backend definitions for systemd-networkd or NetworkManager. It is not a universal Linux network configuration format. Files from /lib/netplan, /etc/netplan and /run/netplan are merged lexicographically; same-name files in /run override /etc, which overrides /lib. Later scalar values override, sequences may concatenate and mappings merge. Renderer default is networkd unless configured otherwise; dhcp4 defaults false. YAML indentation and value types matter. Use routes and nameservers under appropriate device; avoid copying fictional device names to real systems. Protect YAML containing credentials. netplan generate writes backend configuration, so use an alternate root for offline validation. Real network changes can sever remote access; use console and approved netplan try where supported, then verify connectivity and routing. Restore previous YAML, regenerate and reconcile backend state if needed.

Formal Syntax & Structure

linux syntaxlinux
network:  version: 2  renderer: networkd  ethernets:    enp0s1:      dhcp4: true

Parameters & Attributes

NameTypeDescription
network.versiondirectiveSchema version 2
rendererdirectiveBackend selection
ethernetsdirectiveEthernet device definitions
dhcp4directiveIPv4 DHCP selection
routesdirectiveRoute declarations
nameserversdirectiveResolver settings

Return Value

configuration or inspection

Generated backend configuration, not active network state.

Working Example

Example Snippetlinux
set -eud=$(mktemp -d)trap 'rm -rf -- "$d"' EXITmkdir -p "$d/etc/netplan"cat > "$d/etc/netplan/90-bm.yaml" <<'EOF'network:  version: 2  renderer: networkd  ethernets:    bm-demo0:      dhcp4: trueEOFchmod 0600 "$d/etc/netplan/90-bm.yaml"netplan generate --root-dir "$d"test -d "$d/run/systemd/network"printf 'private backend configuration generated\n'
Linux Reference