If you use the netplan command on Ubuntu, then It becomes easy to restart and change network settings. Netplan is also good for automation (humans and programs can read YAML). This write-up is focusing on how
Any Linux system administrator should be familiar with the “ip” command, a powerful tool for configuring network interfaces. It can be used to assign and delete addresses and routes, put up or down interfaces, control ARP cache, and more. To get a list of active network interfaces on your system, utilize the “a” option in the ip command:
This section will show you how to set a dynamic address on Ubuntu using the netplan command. But firstly, if the required YAML file does not exist in your system, then generate the renderer configuration file by writing out the below-given command in your terminal:
Now, verify its presence on your system by listing out the “/etc/netplan/” files:
Check the content of the network renderer configuration file:
Open up the “/etc/netplan/*.yaml” file in your nano editor:
Now write out the below-given code in the /etc/netplan/*.yaml” file. We are going to set a dynamic IP address for our “enp0s3” network interface:
In the above-given command:
Press “CTRL+O” to save the changes in this file:
To apply modified network settings, utilize the below-given command in your terminal:
Write out this command to confirm the IP address:
First of all, open up the “/etc/netplan/*.yaml” file in your nano editor:
Then, write out the following code in the “/etc/netplan/*.yaml” file for setting a static IP address on your system:
In the above-given command:
Press “CTRL+O” to save the changes we made in the file:
After that, apply the modified network settings by utilizing the below-given command:
Now, check out if the configured “enp0s3” is connected to the local network and have a static IP address which we assigned earlier:
To know more about the configuration options and information related to the netplan command, you can check out its man page:
Follow this link to check out more configuration examples.
Netplan was introduced in Ubuntu 17.10 and is active by default in the latest releases, including Ubuntu 20.04. The purpose of this tool is to use YAML configuration files to abstract network interface configurations. Those configurations are then translated into networkd setups and NetworkManager for the given renderer. I hope the usage of netplan command for setting the static and dynamic addresses on Ubuntu will be clear for you after reading this article. To know more about trendy technology topics, keep following Linux Hint.
Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…
Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…
The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…
I don’t like my prompt, i want to change it. it has my username and…
Introduction: A Fragile Trust The Ruby ecosystem relies heavily on RubyGems.org as the central platform…
Asset management is the process of managing and maintaining a company’s assets to maximize their…