Ubuntu now uses YAML

At first I didn't like it.. probably because it was different but follow the next few steps and you will be on your way in under 2 minutes.

Getting the Network Interface ID with ifconfig

1. Run ifconfig to see the available network interfaces.

ifconfig

Assuming your output looks like below; The Interface ID shown below is enp0s25.

[email protected]:~# ifconfig
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.13  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 00:1e:68:79:52:66  txqueuelen 1000  (Ethernet)
        RX packets 3723942699  bytes 3142058009291 (3.1 TB)
        RX errors 2  dropped 455801  overruns 0  frame 1
        TX packets 1313784814  bytes 450364783033 (450.3 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xddfe0000-de000000

Now that we have the Interface ID and we can set the static IP to it.

Setting a Static IP

1. Edit the new network/interfaces file. It is now netplan/*.yaml.

sudo nano /etc/netplan/*.yaml

You should see the following contents in a default netplan file.

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
 version: 2
 renderer: networkd
 ethernets:
   enp0s25:
     dhcp4: yes
     dhcp6: yes

2. Let's assume you want to set the static IP to 192.168.1.31 and the gateway is 192.168.1.254. The configuration would need to be changed to the following. The changes are shown in bold.

network:
 version: 2
 renderer: networkd
 ethernets:
   enp0s25:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.31/24]
     gateway4: 192.168.1.254
     nameservers:
       addresses: [1.1.1.1,8.8.8.8]

3. Now reboot to activate the changes.

sudo reboot

Support Shinobi development by subscribing to Shinobi Honor for the cost of two chocolate bars (USD).