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

Popular posts from this blog

using libguestfs virt-customize tool to modify qcow2 image and reset root password.

Running cockpit behind nginx reverse proxy with nginx ssl and cockpit non ssl

setting up openshift alert manager mail alerting based on critical and warning