linux

Netplan – How To Configure Static IP Address in Ubuntu 18.04 using Netplan

$ cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.orig

 

$ vi /etc/netplan/01-netcfg.yaml

 

Find current IP address

$ ifconfig

Replace the content with the following

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
addresses: [192.168.1.45/24 ]
gateway4: 192.168.1.1
nameservers:
search: [static01.skayal.com]
addresses: [192.168.1.1]

 

Generate the required configuration for the renderers.

$ netplan generate

 

Apply all configuration and restart renderers.

$ netplan apply