Setup Network Device on Ubuntu 18.04

To setup a network device on Ubuntu server 18.04, we need to use new network setup application netplan. Netplan allow us to configure new network adapter.

We encounter network setup issue when we need to add a second network adapter in VirtualBox for networking with host.

Using Ip Link

Before we use netplan, we can use the following command to show all device: 

ip link show

To temporary enable the device we can use the command below: (please replace eth0 with the network device that you want to configure):

sudo ip link set eth0 up

Use the following command to enable dhcp client.

sudo dhclient eth0

Using Netplan

To enable the network adapter permanently, we need to configure netplan. Use the following command to open the configuration file:

sudo nano /etc/netplan/50-cloud-init.yaml

On the configuration file, we add additional network device as follows. Please note that enp0s2 is the current default device and enp0s4 is the new device. Please also make sure that indentation are aligned correctly. This configuration file requires proper indentation. 


network:
    ethernets:
        enp0s2:
            addresses: []
            dhcp4: true
        enp0s4:
            addresses: []
            dhcp4: true
    version: 2

To test if the network setting is correct, use the following command:

sudo netplan try

If the test is successful, we can apply the setting using the command:

sudo netplan apply



***

Comments

Popular posts from this blog

Revive Old Mac Mini (2009) with Linux

Configure Unattended Upgrades on Raspberry Pi

Install and Configure RealVNC in Linux Ubuntu 18.04 LTS