Netplan Ubuntu Configuration Guide
Ubuntu Netplan is a tool used for configuring network interfaces, utilizing YAML syntax to define network configuration files.
Here are the steps for configuring Ubuntu network interfaces using Netplan:
- Open the terminal.
- Create a new Netplan configuration file, for example “01-netcfg.yaml”, using a text editor like nano or vi.
- Open the file 01-netcfg.yaml in the directory /etc/netplan using the text editor nano with administrative privileges.
- Define network interfaces and their properties using the YAML syntax in the opened file, for example:
- network configuration:
version: 2
ethernets:
enp0s3:
enable dhcpv4: true - This example sets up an Ethernet interface named enp0s3 and enables the DHCP client.
- Save and close the file.
- Apply the new configuration using the following command:
- Execute the command “sudo netplan apply” on the terminal.
- This will reload the network configuration and apply the changes.
- Check the status of the network interface to ensure that the configuration has been successfully applied.
- Display the IP address.
- This will display detailed information about the network interface, including the IP address and configuration.
Important tip: After making changes to the Netplan configuration file, apply the changes using the command sudo netplan apply. Do not edit the /etc/network/interfaces file directly as Netplan will ignore this file.