Network Configuration Using netplan - Zacham17/my-tech-journal GitHub Wiki
Configuring netplan on Ubuntu
Netplan is the default network manager that Ubuntu uses. To configure a static network configuration on Ubuntu using netplan, follow these steps:
- Use the command
ls /etc/netplan
to return the name of the configuration file with the .yaml extension, which in the case of these instructions I will us 01-network-manager-all.yaml. Make sure you use the name of your .yaml file in the commands in future steps. - Before making any changes to this file, make sure to create a backup copy of it, using the command,
sudo cp /etc/netplan/01-network-manager-all.yaml 01-network-manager-all.yaml.bak
- Edit the netplan configuration file. I used vi, using the command
sudo vi /etc/netplan/01-network-manager-all.yaml
- Then add the following lines by replacing the interface name, IP address, gateway, and DNS information that fit your networking needs.
network:
version: 2
ethernets:
ens33:
dhcp4: False
addresses:
- 10.0.5.12/24
gateway4: 10.0.5.2
nameservers:
search: [morris.local]
addresses:
- 10.0.5.5
- Once done, save and close the file.
- To test the new configuration use the command,
sudo netplan try
- Note: If it validates the configuration, you will receive the configuration accepted message; otherwise, it rolls back to the previous configuration.
- Run the following command to apply the new configurations:
sudo netplan apply
- After applying the configurations, check that your IP configuration was applied using the command,
ip a