How to setup static ip and static nameserver in ubuntu 18.04 LTS and 20.04 LTS remove netplan
Install packages for network and dns
$ apt install ifupdown resolvconf -y
remove cloud-init
$ apt remove cloud-init -y
delete netplan config
$ rm -rf /etc/netplan/*
$ reboot
$ vim /etc/network/interfaces
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
address 192.168.1.154
netmask 255.255.252.0
gateway 192.168.1.1
dns-nameservers 192.168.1.30
$ vim /etc/resolvconf/resolv.conf.d/head
nameserver 8.8.8.8
nameserver 8.8.4.4
save and reboot
now check dns entries
$ cat /etc/resolv.conf
Comments
Post a Comment