01.08.2023

Configuring the network interface in Ubuntu 18.04

Network interface configuration in Ubuntu 18.04 via netplan


Network configuration in Ubuntu 18.04 has been changed quite a lot compared to previous versions of Ubuntu. The configuration file /etc/network/interfaces has not gone away, but it has become insignificant, now it contains only the text that files related to network settings are now located in the /etc/netplan directory:

Let's look at this:

ls /etc/netplan

Then take a look at the file structure:

cat /etc/netplan/50-cloud-init.yaml

The netplan settings is described in YAML (Yet Another Markup Language). Let's look inside:

ifconfig -a

To activate new settings, run this:

netplan apply

Network configuration without netplan

Before the setup, I advice you to clarify which interfaces are really present in the system:

ifconfig -a

In the screenshot above, you can see that there are two interfaces without assigned IP's present, cause the machine is waiting for settings from the DHCP server. In a situation where there is no such DHCP-server in the network segment, you should assign the IP manually. So, change the config-file so that it looks like the one shown in the picture:

sudo nano /etc/network/interfaces

Let's talk about the parameters:

To confirm the changes, you should run this:

sudo /etc/init.d/networking restart

After the service restart, the computer should be available via assigned IP address. If not, reboot the server entirely, it will help.

Conclusion

This article describes two ways to configure a network in Ubuntu 18.04, both with and without netplan.