In this article we will try to teach you how to Set Static IP Address in Ubuntu Linux. A static or fixed IP address is an IP address that does not change. Regardless of whether you reboot your device or your home router, your device with a static IP address will get the same IP address. The opposite of a static IP address is the dynamic IP address. A device without a static IP address is assigned a dynamic IP address by the DHCP (Dynamic Host Configuration Protocol) server, which can change from time to time.
By default, a device connected to your home router, whether it’s using a cable or connected via WiFi, will most likely get a dynamic IP address. And if you are also using your Ubuntu Managed VPS as an FTP server or web server, you will want to configure a static IP address for it so that you can reach the server with the same IP address. Below we have mention the steps to configure Static IP address in Ubuntu 20.04.
How to Configure Static IP Address in Ubuntu 20.04
How to Set Static IP Address on Ubuntu Server Using Netplan
Step 1: Open your terminal and head over to the /etc/netplan directory. You will find a YAML configuration file which you will use to configure the IP address.
Step 2: In our case the YAML file is 01-network-manager-all.yaml with the default settings as shown.
Step 3: For the Ubuntu server, the YAML file is 00-installer-config.yaml and these are the default settings.
Step 4: To configure a static IP, copy and paste the configuration below. Be mindful of the spacing in the YAML file.
network:version: 2ethernets:enp0s3:dhcp4: falseaddresses: [192.168.2.100/24]gateway4: 192.168.2.1nameservers:addresses: [8.8.8.8, 8.8.4.4]
Step 5: Next, save the file and run the netplan command below to save the changes.
$ sudo netplan apply
Step 6: You can thereafter confirm the IP address of your network interface using the ifconfig command.
$ ifconfig
Final Words
We hope our article on how to How to Configure Static IP Address on Ubuntu 20.04 will help you and resolve all your problems. Ubuntu is a Linux-based operating system. It is designed for computers, smartphones and network servers. The system is made by a UK based company called Canonical Ltd. developed. All the principles used to develop the Ubuntu software are based on the principles of open source software development. If you want to know how to set Static IP Address on Ubuntu Linux then follow the steps mentioned above.
I hope you understand this article, How to Set a Static IP Address in Ubuntu.