Artur Tyksinski - Sysadmin Blog

Artur Tyksinski - Sysadmin Blog

System Administration Blog by Artur Tyksinski. I talk about anything and everything technology. Mostly Virtualization, MSP, Cyber Security and Linux.




Configure Static IP on Ubuntu 18.04 LTS

This guide explains how to configure static IP on Ubuntu 18.04 with Netplan.

Artur TyksinskiArtur Tyksinski

Configuring Static IP with Netplan on Ubuntu

Below you will find the steps to configure a static IP address with Netplan on Ubuntu. The netplan config files are located at /etc/netplan and the default configuration file is /etc/netplan/01-netcfg.yaml

Open the network config file with an editor such as nano:

sudo nano /etc/netplan/01-netcfg.yaml

Netplan uses Python for it's configuration syntax so it's important that all line indentation is correct.

In the example below, we'll be using a static IP address of on the first network interface ens33 and a gateway IP of This configuration uses CloudFlare DNS in conjunction with Google DNS.

version: 2
renderer: networkd
dhcp4: no
dhcp6: no
addresses: []
addresses: [,]

Once all your changes have been made, you can apply them by running:

sudo netplan apply

Configuring a DHCP address with Netplan

If you'd like to configure your Ubuntu server to run on DHCP (on both ipv4 and ipv6) instead of a static IP address, see the configuration below.

This file describes the network interfaces available on your system

For more information, see netplan(5).

version: 2
renderer: networkd
dhcp4: yes
dhcp6: yes

Don't forget to run the command to apply the changes after you're done

View Comments