Ubuntu: Correct way to set DNS



Question:

I have a DNS server running on my computer, and I want Ubuntu to use it to resolve addresses. I've setup mydomain.com as a custom domain

I went into Network settings, switched to manual in 'Wired', entered my IP, Gateway, Mask. And then I entered my IP in the DNS field.

How do I cause this to take effect? dig @myiphere mydomain.com works, but dig mydomain.com doesn't return any address.

If I edit /etc/resolv.conf by hand and change the first line from 127.0.1.1 to myiphere, then everything starts to work.

But this doesn't seem to be the right way to do things as resolv.conf warns against manual changes by hand.

So how do I PROPERLY and reliably change DNS?


Solution:1

I would expect your network manager settings to apply and take care of resolv.conf.

You can alternatively manage this interface from /etc/network/interfaces, with a configuration similar to this one (example taken from "man resolvconf"):

iface eth0 inet static                 address 192.168.1.3                 netmask 255.255.255.0                 gateway 192.168.1.1                 dns-nameservers 192.168.1.254 8.8.8.8                 dns-search foo.org bar.com  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »