Linux - Netplan

This new tool replaces the static interfaces (/etc/network/interfaces) on ubuntuĀ 18.04

DHCP

network:
 version: 2
 renderer: networkd
 ethernets:
   ens33:
     dhcp4: yes
     dhcp6: no

Static IP

network:
 version: 2
 renderer: networkd
 ethernets:
   ens33:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.2/24]
     gateway4: 192.168.1.1
     nameservers:
       addresses: [8.8.8.8,8.8.4.4]
   ens34:
     dhcp4: no
     dhcp6: no
     addresses: [192.168.1.3/24]

Apply changes

netplan apply

netplan apply does not require a service restart or a reboot

NetworkManager

Configuring with wifi nic

network:
  version: 2
  renderer: NetworkManager
  wifis:
          wlx7c8bca0d69b6:
                  dhcp4: no
                  addresses: [192.168.1.100/24]
                  gateway4: 192.168.1.1
                  nameservers:
                          addresses: [192.168.1.1,8.8.8.8]
                  access-points:
                          Raj:
                                  password: MyPass

Links:

https://netplan.io/