Set Static IP on Ubuntu 20.04 | 18.04

Table of Contents

How to set Static IP on Ubuntu 20.04 | 18.04




To set a static IP address, we will use a command-line utility. The utility is called Netplan and was developed by Canonical. Basically, Netplan configures network interfaces with YAML files. It’s possible to configure an interface using the same technique to get a dynamic IP or set a static IP with the same method.






In this article, we will explain how to set static IP on Ubuntu 20.04 | 18.04







Step 1: Getting your system up and running






  1. Sign in to your system or register a newly created one by logging in to your VPSie account
  2. Connect by SSH using the credentials we emailed you.
  3. Once you have logged into your Ubuntu instance, run these commands to update your system.
apt-get update && apt-get upgrade -y







Step 2: Set Static IP





Using Terminal, open the /etc/netplan directory. This is where you will find the YAML configuration file you will use to change the IP address.  




I have a YAML file named 00-installer-config.yaml. If you’re configuring a static IP address, copy the below configuration and paste it. The YAML file must also be padded correctly.




  version: 2
        dhcp4: false
        addresses: []
        gateway4: 1162,220.13.248
          addresses: [,,]





Run the netplan command after you have saved the file. This will make the changes permanent.



sudo netplan apply



If you would like to check the new IP address, you can use the below command, The IP address can also be checked in many other ways, Here we are using “ifconfig






That’s it!  Thanks for reading! I hope it was informative for you! 







Try VPSie for free today!



Share on