$ ls /sys/class/net
enp0s31f6 lo
enp0s31f6
is the ethernet to be set.
sudo vim /etc/netplan/50-cloud-init.yaml
Then, change /etc/netplan/50-cloud-init.yaml
like the followings:
network:
ethernets:
enp0s31f6:
addresses: [<static-ip>/24]
gateway4: <gateway-ip>
nameservers:
addresses: [8.8.8.8,8.8.4.4]
dhcp4: no
version: 2
The most important things to be set are ethenet names and dhcp4: no
.
sudo netplan apply
ip addr
ip route
nslookup google.com