set system dns server ubuntu code example
Example 1: add dns in ubuntu permanently
sudo apt update
sudo apt install resolvconf
sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service
sudo vim /etc/resolvconf/resolv.conf.d/head
and add the following lines in it:
nameserver 8.8.8.8
nameserver 8.8.4.4
sudo systemctl start resolvconf.service
Example 2: ubuntu dns server
# /etc/resolv.conf. A couple of quick entries like
# so would have my machine reaching the outside world like a champ:
nameserver 8.8.4.4
nameserver 8.8.8.8