How to add IP Address on Ubuntu 18.04 using netplan?

We can configure IP Address on ubuntu 18.04 using Netplan. It is a different method to add IP address than the older versions. Ubuntu 18.04 uses netplan to configure IP addresses. We will no longer use the /etc/sysconfig/network-interface to add IP addresses instead we will use a YAML file.  You will find the default configuration in /etc/netplan/ directory. 

  1. Find the default network configuration file using the below command.

    $ ls /etc/netplan/ 
  2. It is a default network configuration YAML file. Open it using the below command. 

    $ cat /etc/netplan/50-cloud-init.yaml
  3. You will see the ethernet card (enp0s1), you will need to configure the ip address here. 

  4. Take the backup of the 50-cloud-init.yaml file before making any changes.

    $ sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak
  5. Configure IP Address on ethernet card (enp0s1) with below details.

  • IP address for enp0s1 : (your ip address)

  • Gateway :

  • Netmask :

  • DNS servers : and

  1. You can use space to make the align properly as per image. 

  2. Save the file using Ctr+x.

  3. Now, apply the network configuration using below command. 

    $ sudo netplan apply
  4. Check your IP Address with the below command.

    $ ip addr

Related Articles

How to install IonCube Loader on CentOS 7 Manually?

Ioncube is a PHP module which protects the PHP application's source code from being viewed from...

Fix Exim error-exim dead but subsys locked

Problem Statement php mail scripts were not working in Linux VPS. Error Message exim dead but...

How to use the Rsync command in linux?

Rsync is an important command in Linux and used to synchronize or copy the files and directories...

How to reset/renew cPanel/WHM Self-signed Certificate?

You might be receiving an email with subject like “The SSL certificate for “[service like exim,...

The action Install for product MySQL Server 5.7.19 failed.

You may face this error while installing MySQL 5.7 or upgrading MySQL 5.6 to 5.7. Here, is the...

  • 0 Users Found This Useful

Was this answer helpful?