https://www.tecmint.com/configure-network-static-ip-address-in-ubuntu/
ifconfig -a
Set Static IP Address in Ubuntu 18.04
In this example, we will configure a static IP for the enp0s8 ethernet network interface. Open the netplan configuration file using your text editor as shown.
Important: In case a YAML file is not created by the distribution installer, you can generate the required configuration for the renderers with this command.
$ sudo netplan generate
In addition, auto generated files may have different filenames on desktop, servers, cloud instantiations etc (for example 01-network-manager-all.yaml or 01-netcfg.yaml), but all files under /etc/netplan/*.yaml will be read by netplan.
$ sudo vim /etc/netplan/01-netcfg.yaml
Then add the following configuration under the ethernet section.
enp0s8:
dhcp4: no
dhcp6: no
addresses: [192.168.56.110/24, ]
gateway4: 192.168.56.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Where:
enp0s8 – network interface name.
dhcp4 and dhcp6 – dhcp properties of an interface for IPv4 and IPv6 receptively.
addresses – sequence of static addresses to the interface.
gateway4 – IPv4 address for default gateway.
nameservers – sequence of IP addresses for nameserver.
sudo netplan apply