Netplan

The first fairly major change that I see compared to the last time that I set up an Ubuntu server is the networking.

In this case I have set up 2 virtual network interfaces. I would like one of them to use Network Address translation and be able to access the internet, but the other I would like to have only attached the the internal network in my virtual environment. In the past I would have edited the /etc/network/interfaces file, and left it looking something like the following;

# The primary network interface for the NAT network
auto enp0s3
iface enp0s3 inet dhcp

# The secondary network interface for the internal network
auto enp0s8
iface enp0s8 inet static
address 192.168.1.1
netmask 255.255.255.0

Using the new method, I created a yaml file in the /etc/netplan directory named 01-netcfg.yaml and edited it as follows;

netplan configuration

After editing the file it must be applied with

sudo netplan apply

To confirm that it has set your network in the desired configuration run ifconfig, which gives me the following;

ifconfig result

As we can see from this, we have two network adapters, enp0s3 and enp0s8. The first has the ip address of 10.0.2.15, which it is being assigned in VirtualBox’s NAT, and the other has the ip address of 192.168.1.1, which was specified in our yaml file.

For further information on Netplan, check out https://netplan.io