How to configure networking on Ubuntu LTS 18.04 using Netplan

As of Ubuntu 18.04 the default network stack uses something called Netplan. To see which version of Ubuntu you have, do cat /etc/issue. If you have an older version see this article.

In order to do a Netplan configuration, follow the instructions below.

First determine your interface name with ip a

Then edit the Netplan configuration file:

cd /etc/netplan/
ls
vi 50-cloud-init-yaml

Example Netplan configuration file:

network:
    ethernets:
        eth0:
            dhcp4: no
            addresses: [192.168.0.20/24]
            gateway4: 192.168.0.1
            nameservers:
                addresses: [1.1.1.1, 8.8.4.4]
    version: 2

To test:

`sudo netplan try`

Enter to accept changes.

References:
https://www.linux.com/learn/intro-to-linux/2018/9/how-use-netplan-network-configuration-tool-linux

Share this article

Leave a Reply

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

Scroll to Top