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
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to Install SHOUTCast Radio Server on Linux VPS?

This tutorial will assist you to install SHOUTcast Distributed Network Audio Server (DNAS 2.0) in...

Fix :: SSH Error: Starting sshd: Missing privilege separation directory: /var/empty/sshd

Problem Statement Could not connect to Linux machine through SSH. Error Message While starting...

How To install Nginx on CentOS 7?

Nginx is a Web server that can be installed on Linux Server. You may have heard about Apache Web...

How to install OPcache in cPanel/WHM?

OPcache is a PHP extension and it helps to improve the performance of your php Website. OPcache...

How to Install Tomcat 7 on Centos?

Tomcat is an open-source web server that is built in Java Servlet and JavaServer Pages...