I was wondering how to set a DNS server on Ubuntu to ever, with any network connection and any network device, use a predefined one.
So I "Duckduckgoed" a little bit and found some solutions.
I uncommented the following line in "/etc/dhcp/dhclient.conf":
prepend domain-name-servers x.x.x.x, y.y.y.y;
But, running Wireshark (after nm-tool and a reboot), I detected that my names still being solved by my default internet provider DNS server. =(
What I'm doing wrong? What am I supposed to do?
If you want to OVERRIDE the DHCP server's provided DNS, you need to modify the file 'dhclient.conf'.
# sudo nano /etc/dhcp/dhclient.conf
then add a line for 'supersede' like following:
supersede domain-name-servers 8.8.8.8; # replace the IP with wanted DNS server
You will then need to restart your network on bash:
# sudo service networking restart
# sudo service network-manager restart
Now you can check it as following:
# nmcli dev show | grep DNS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With