### netplan get command Source: https://netplan.io/design Merges and displays all the current available configuration on the system. ```bash netplan get ``` -------------------------------- ### netplan info command Source: https://netplan.io/design Shows available feature flags of the currently installed version as YAML. ```bash netplan info ``` -------------------------------- ### Subiquity installer network config Source: https://netplan.io/design Example of a netplan configuration written by the Subiquity installer for a wired ethernet device with DHCP. ```yaml network: version: 2 ethernets: # configured by subiquity eno1: dhcp4: true ``` -------------------------------- ### Netplan Complex Configuration Example Source: https://netplan.io/design A comprehensive Netplan configuration showing a network-manager renderer, ethernet interfaces with match rules, WiFi access points, and a bridge with routes and nameservers. Includes comments explaining each section. ```yaml network: version: 2 # if specified globally, can only realistically have that value, as # networkd cannot render wifi/3G. This would be shipped as a separate # config.d/ by desktop images # it can also be specified by-type or by-device renderer: network-manager ethernets: # opaque ID for physical interfaces with match rules # only referred to by other stanzas id0: match: macaddress: 00:11:22:33:44:55 wakeonlan: true dhcp4: true addresses: - 192.168.14.2/24 - 2001:1::1/64 lom: # example for explicitly setting a backend (default would be networkd) match: driver: ixgbe # you are responsible for setting tight enough match rules # that only match one device if you use set-name set-name: lom1 dhcp6: true switchports: # all cards on second PCI bus # unconfigured by themselves will be added to br0 below match: name: enp2* mtu: 1280 wifis: all-wlans: # useful on a system where you know there is # only ever going to be one device match: {} access-points: "Joe's home": # mode defaults to "managed" (client), key type to wpa-psk password: "s3kr1t" # this creates an AP on wlp1s0 using hostapd # no match rules, thus ID is the interface name wlp1s0: access-points: "guest": mode: channel: 11 # no WPA config implies default of open bridges: # the key name is the name for virtual (created) interfaces; # no 'match' or 'set-name' attributes are allowed. br0: # IDs of the components # switchports expands into multiple interfaces interfaces: [wlp1s0, switchports] dhcp4: true routes: - to: 0.0.0.0/0 via: 11.0.0.1 metric: 3 nameservers: search: [foo.local, bar.local] addresses: [8.8.8.8] ``` -------------------------------- ### ifupdown legacy hook for post-up/post-down states (routable.d/50-ifup-hooks) Source: https://netplan.io/faq Script installed in /etc/networkd-dispatcher/routable.d/50-ifup-hooks to run existing ifup hooks for the 'up' and 'post-up' states using run-parts. Exits with status 0. ```shell #!/bin/sh for d in up post-up; do hookdir=/etc/network/if-${d}.d [ -e $hookdir ] && /bin/run-parts $hookdir done exit 0 ``` -------------------------------- ### ifupdown legacy hook for down/post-down states (off.d/50-ifdown-hooks) Source: https://netplan.io/faq Script installed in /etc/networkd-dispatcher/off.d/50-ifdown-hooks to run existing ifdown hooks for the 'down' and 'post-down' states using run-parts. Exits with status 0. ```shell #!/bin/sh for d in down post-down; do hookdir=/etc/network/if-${d}.d [ -e $hookdir ] && /bin/run-parts $hookdir done exit 0 ``` -------------------------------- ### netplan apply command Source: https://netplan.io/design Applies all configuration for the renderers, restarting them as necessary. ```bash netplan apply ``` -------------------------------- ### netplan help command Source: https://netplan.io/design Shows the help message. ```bash netplan help ``` -------------------------------- ### netplan try command Source: https://netplan.io/design Applies configuration and waits for user confirmation; rolls back if network is broken or no confirmation is given. ```bash netplan try ``` -------------------------------- ### netplan set command Source: https://netplan.io/design Adds a new setting by specifying a dotted key=value pair like ethernets.eth0.dhcp4=true. ```bash netplan set ``` -------------------------------- ### Backup and restore Netplan state to remove interface Source: https://netplan.io/faq Create a temporary backup of the Netplan YAML state, remove an interface from /etc/netplan, and then apply the original state. This is an alternative to manually removing the interface. ```bash mkdir -p /tmp/old_state/etc && cp -r /etc/netplan /tmp/old_state/etc/ ``` ```bash rm /etc/netplan/interface-to-delete.yaml ``` ```bash netplan apply --state /tmp/old_state ``` -------------------------------- ### netplan generate command Source: https://netplan.io/design Generates the required configuration for the renderers using /etc/netplan. ```bash netplan generate ``` -------------------------------- ### Apply Netplan configuration with sudo netplan apply Source: https://netplan.io/faq Apply the Netplan configuration after removing an interface from the YAML file. Note that netplan apply does not remove virtual devices like bridges and bonds. ```bash sudo netplan apply ``` -------------------------------- ### netplan ip command Source: https://netplan.io/design Retrieves IP information from the system. ```bash netplan ip ``` -------------------------------- ### Minimal Netplan YAML configuration with NetworkManager renderer Source: https://netplan.io/ Use this minimal configuration to enable DHCP on all ethernet devices via NetworkManager. Without any configuration, Netplan does nothing. This snippet hands over control to NetworkManager, which manages all devices in its default way (ethernet devices come up with DHCP once carrier is detected). ```yaml network: version: 2 renderer: NetworkManager ``` -------------------------------- ### Verify networkd backend configuration for addresses Source: https://netplan.io/troubleshooting Shows the netplan YAML addresses field and the corresponding generated systemd-networkd configuration. Use to verify that the backend configuration matches the netplan YAML when debugging networkd issues. ```yaml addresses: [ 10.10.10.10/24, 10.20.1.1/24 ] ``` ```ini [Network] Address=10.10.10.10/24 Address=10.20.1.1/24 ``` -------------------------------- ### Bring interface up or down with ip link set Source: https://netplan.io/faq Use the ip command to bring an interface up or down. This replaces the deprecated ifconfig command for manually modifying network devices. ```bash ip link set enp3s0 up ip link set enp3s0 down ``` -------------------------------- ### Verify NetworkManager configuration matches netplan addresses Source: https://netplan.io/troubleshooting Shows the netplan YAML addresses field and the corresponding NetworkManager system-configuration file content. Use to verify that the generated NetworkManager configuration matches the netplan settings when debugging the NetworkManager backend. ```yaml addresses: [ 10.10.10.10/24, 10.20.1.1/24 ] ``` ```ini [ipv4] method=manual address1=10.10.10.10/24 address2=10.20.1.1/24 ``` -------------------------------- ### Remove interface manually with ip link del Source: https://netplan.io/faq Manually remove an interface at runtime. This is needed because netplan apply does not remove virtual devices. ```bash ip link del dev ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.