How to set IP address using netplan

Today we are going to see how we can set an IP address using netplan utility in Ubuntu linux.

Ubuntu 18.04 LTS comes with netplan utility installed and recommend to make changes in IP settings using netplan utility.

Netplan uses YAML format script to configure interfaces. and from this scripts it will generate all necessary configuration files.

Netplan reads scripts from /etc/netplan/*.yaml

Check for .yaml file in /etc/netplan/ and edit it using text editor like vi, vim or nano.

If file is not there you can generate using

sudo netplan generate

Now edit file,

$ sudo nano /etc/netplan/1-network-manager-all.yaml

and paste below code in the file.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
 version: 2
 renderer: networkd
     dhcp4: no
     dhcp6: no
     addresses: []
       addresses: [,]

Make sure to replace “addresses”, “gateway4” “addresses” under “nameservers” according to your preference.

Exit and apply changes using below command.

sudo netplan apply

You can check ip settings using


To know more about netplan visit

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.