Bind DNS not configuring on a Debian server / AWS Lightsail firewall

Webmin: 1.973
Virtualmin: 6.15
Debian 10

Error message:

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, turn off the BIND feature on the [Features and Plugins page, or disable the Check resolv.conf option on the Virtualmin Configuration page.

I try to add 127.0.0.1 to the list of servers but the change cannot be saved.

Your DNS servers may be getting applied by DHCP somewhere? This will override Webmin/Virtualmin settings.

you seen this as your server is configured to get ip from dhcp from your switch or router… you can add localhost ip to the list and just keep using it as normal with dhcp but its easy as well to configure your server to use ip statically server asking dhcp for same ip all the times without reboot, just tell your nic interfaces to use same ip, save it and apply you should be fine and msg should go away.

As suggested in: Either add 127.0.0.1 to the list of DNS servers [#17165] | Virtualmin #17
I added /etc/rc.local to my Debain 10 installation on AWS Lightsail
!/bin/sh -e
echo nameserver 127.0.0.1 >> /etc/resolv.conf
exit 0

I also tried to add "nameserver 127.0.0.1 to /etc/resolv.cong manually.
I rebooted and the entries were erased.

Can you tell me how to “configure your server to use ip statically server asking dhcp for same ip all the times without reboot”?

It sounds like your hosting provider is overwriting resolv.conf on reboot. One fix is to make that file immutable, as outlined here:

https://www.virtualmin.com/documentation/dns/faq
and
https://forum.virtualmin.com/t/dynamic-ip-troubles-hostname-and-dns-client-dns-client-options/108329/7

1 Like

I was able to solve the overwriting. Thanks.

But I am having trouble with the mail server being recognized.
I have two servers

example.com on Digital Ocean which works

System hostname host.example.com (127.0.0.1) (on webmin dashboard)

resolv.conf
nameserver 127.0.0.1
nameserver 67.207.67.3
nameserver 67.207.67.2
domain example.com
; Created by cloud-init on instance boot automatically, do not edit


example1.com on AWS Lightsail which does not work

System hostname host.example1.com (34.228.125.xxx) (on webmin dashboard)

resolv.conf
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 34.228.125.xxx
domain ec2.internal
search ec2.internal


I suspect that the I might need “127.0.0.1” instead of “34.228.125.xxx” for the system hostname and need to add “Local hostname” to the Resolution order for example1.com

But I am stumped how to do this or make other needed changes.

Help would be appreciated.

hi ill do, its just im about to sleep after night shift, is very simple but i cannot remember from to of my head, i will post solution roughly 8 hours from now. its just adding one line of tge text reboot and you should be fine.

hi ill do, its just im about to sleep after night shift, is very simple but i cannot remember from to of my head, i will post solution roughly 8 hours from now. its just adding one line of text reboot and you should be fine.

1 Like

Solved.

edit /etc/resolv.conf
add  nameserver 127.0.0.1       then save
sudo chattr +i /etc/resolv.conf
    (locks /etc/resolv.conf so the changes won't be overwriiten.   Sudo chattr -i /etc/resolv.conf will unlock the file if you need to make changes)

AWS Lightsail instances only opens 2 ports. This is why Bind was not working.
So I made note of all the ports open in Webmin… FirewallD. Then I clicked on my instance in AWS, then networking. I added all the ports I noted from FirewallD.

Voila.

This is not recommended solution to make /etc/resolv.conf immutable even though it works in your particular case.

A server configuration is recommended to have static IP setup. Besides, as mentioned by Jamie on the linked post above, you can disable Virtualmin’s check for 127.0.0.1 in resolv.conf on System Settings → Virtualmin Configuration → Advanced options page and its Check resolv.conf for this system option.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.