As many might know, Ubuntu 18.04 LTS uses Netplan for network configuration. Which was added in Ubuntu 17.10 in unpopular move by Canonical. The issue behind it was a bad implementation of ifupdown, which crashed the desktop environment whenever the networking service was restarted.

The new interface files are located in /etc/netplan directory. There are 2 renderers you might be familiar with, NetworkManager and networkd. NetworkManager is usually used in desktop environments while networkd in server. We will be working with networkd only in this example.

Below is a sample file:

Biggest caveat is the spacing in yaml, there should be exactly 4 space intervals, in the example above, properties of network are 4 spaces from start of the line, properties of ethernets are 4 spaces away as well.

Now we need to edit /etc/netplan/50-cloud-init.yaml file and configure our static IP. Open it up in your favorite text editor, we will use nano in our example.

Then we need to add your static IP to the config like so:

Save your changes and exit. Next, we apply the current config.

The server now should have new IP configured for interface enp0s3. If there are any errors, you can use the following command to narrow down the reason for the error.

If you want to apply multiple IPs to the interface, all you need to do is add another IP to addresses separated by comma, like so:

That’s it, we are all done.