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:

  1. Open the terminal.
  2. Create a new Netplan configuration file, for example “01-netcfg.yaml”, using a text editor like nano or vi.
  3. Open the file 01-netcfg.yaml in the directory /etc/netplan using the text editor nano with administrative privileges.
  4. Define network interfaces and their properties using the YAML syntax in the opened file, for example:
  5. network configuration:
    version: 2
    ethernets:
    enp0s3:
    enable dhcpv4: true
  6. This example sets up an Ethernet interface named enp0s3 and enables the DHCP client.
  7. Save and close the file.
  8. Apply the new configuration using the following command:
  9. Execute the command “sudo netplan apply” on the terminal.
  10. This will reload the network configuration and apply the changes.
  11. Check the status of the network interface to ensure that the configuration has been successfully applied.
  12. Display the IP address.
  13. 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.

bannerAds