The hoster of my server supplies IP by DHCP to server (both public IPs and local RPN ones). But when I check configuration of my server it states me that:
Virtualmin is configured to setup DNS zones, but this system is not setup to use itself as a DNS server. Either add 127.0.0.1 to the list of DNS servers, or turn off the BIND feature on the module config page. It appears that DHCP is being used to dynamically configure your network interfaces, which can cause the DNS servers to be set based on settings provided by the DHCP server. Using a static IP address is strongly recommended with Virtualmin.
If I add 127.0.0.1 in resolv.conf it’s automatically deleted by system and I have to keep network port in DHCP or it’s going to get a problem with the hoster of servers (Online in France, ex Dédibox).
Not sure what OS but this quick and little trick should work on any OS:
- Add at the bottom
/bin/cp /root/.resolv/resolv.conf /etc/resolv.conf
- Be sure you left one empty line at the end of
- Save and close
- Check if
rc.local is executable (755)
- Now create the file in
/root/.resolv/resolv.conf (or whatever location did you select)
- Fill in and keep in this order
search domain1.tld domain2.tld domain3.tld <---- This is optional, it should work without this line
nameserver 127.0.0.1 <---- Must have
nameserver 184.108.40.206 <---- Must have, google public DNS
nameserver 220.127.116.11 <---- Must have, google public DNS
nameserver xxx.xxx.xxx.xxx <---- This is your server IP
- Save and close
- Restart your server and check if it works
This little trick will copy
resolv.conf every time when you restart your server and it will happen after DHCP make the changes but before anything else, e.g. starting up bind.
Thanks for the trick and I was thinking about something but don’t find it really nice
In the meantime I found nearly the way to do it in correct way
Edit the /etc/dhcp/dhclient.conf (Ubuntu 16.04) and I added these two lines:
supersede domain-name “mydomain.com”;
supersede domain-name-servers 18.104.22.168;
My only issue is I’m confused by syntax for DNS servers. It’s supposed to accept each DNS separated by a comma but in my case it only considers first dns listed and that’s it
Eh Ubuntu, maybe is the best if you wait for @unborn to jump in this topic. If i’m not mistaken he is the “Ubuntu guy”.
So lost as I tried different syntaxes without much success and confused as syntax with commas looks the good one…
Desperate to resolve that stupid issue Made lot of searches on internet and tried lot of things without success