Ubuntu 18.04 Set Static IP

Ubuntu 18.04 Set Static IP

Ubuntu 18.04 LTS Server using new IP addresses configuring method. For network configuration Ubuntu 18.04 uses Netplan
Netplan’s configuration files use the YAML format.
Netplan configuration files can be found in: /etc/netplan/ directory.
In this tutorial we will configure static IP address in Ubuntu 18.04 LTS server.

Default network configuration file 50-cloud-init.yaml can found in /etc/netplan/ directory:

network configuration file

In this case my network card eno1 interface configured to obtain IP address from the DHCP server:

# vi /etc/netplan/50-cloud-init.yaml

Ubuntu 18.04 Dynamic IP configuration


Configure Static IP Address

Lets configure static IP address on eno1 interface. For example I will set:

IP address -
Netmask -
Gateway -
DNS Servers -,

In netplan we should combine IP address and netmask into one line. For example:

addresses: []

/etc/netplan/50-cloud-init.yaml file configuration example:

                 dhcp4: false
                 addresses: []
                         addresses: [,]
     version: 2

Static IP configuration Ubuntu 18.04

Save edited file, and apply new network configuration by netplan apply command:

# netplan apply


Check IP address

Now time to check the IP address by command:
# ip addr

Check IP address



In case if you have errors you can investigate by command and find out syntactical  errors:

# netplan --debug generate


# netplan --debug apply

Example output:

netplan --debug apply


Leave a Reply