This is an old revision of the document!
Table of Contents
Ubuntu - Networking - Netplan - Configure networking with Netplan
Netplan is based on YAML based configuration system that makes configuration process very simple.
Netplan has replaced the old configuration file /etc/network/interfaces that we previously used for configuring network interfaces in Ubuntu.
Configuration Files
Netplan configuration files are at /etc/netplan/*.yaml.
- Ubuntu server defaults to using system-networkd with the configuration file named 01-netcfg.yaml,
- Ubuntu desktop generates a configuration file for Network-Manager named 01-network-manager-all.yaml.
NOTE: If you have multiple interfaces, use 02-network-manager-all.yaml for the second interface.
Netplan applies the configuration in the numerical order; i.e. the 01 file will be applied before the 02 file.
Find the name of the active network interfaces that you want to configure
ip a
NOTE: Note the interface name that you want to configure using Netplan.
Edit the netplan file.
- /etc/netplan/01-network-manager-all.yaml
network: Version: 2 Renderer: NetworkManager/ networkd ethernets: DEVICE_NAME: Dhcp4: yes/no Addresses: [IP_ADDRESS/NETMASK] Gateway: GATEWAY Nameservers: Addresses: [NAMESERVER_1, NAMESERVER_2]
Test
Before applying any changes, test the configuration file:
sudo netplan try
Apply Configuration
sudo netplan apply
NOTE: In case you see any error, try debugging to investigate the problem.
To run debug:
sudo netplan –d apply
Restart the network service
On Ubuntu Desktop
sudo systemctl restart network-manager
On Ubuntu Server
sudo systemctl restart system-networkd
Verify IP Address
ip a