2

I am attempting to run my host machine as a DNS server, it will also function as the gateway.

My /etc/named.conf is as follows:

    options {
    directory "/var/named/";
    allow-query {127.0.0.1; 192.168.64.0/24;};
    forwarders { 192.168.48.2; };
};
zone "localhost" {
    type master;
    file "named.localhost";
};
zone "huh.dod" {
    type master;
    file "mydb-huh-dod";
};

My /var/named/mydb-huh-dod:

$TTL    3D
@       IN      SOA     host.huh.dod.      hostmaster.huh.dod.(
            2018042901       ; Serial
            8H      ; Refresh
            2H      ; Retry
            1W      ; Expire
            1D      ; Negative Cache TTL
);
@       IN      NS      host.huh.dod.
host    IN      A       192.168.64.1

I set my hostname as host and configured domain name through the /etc/sysconfig/network-scripts/ifcfg-eth0 file SEARCH parameter:

DNS1="192.168.64.1"
IPADDR="192.168.48.10"
NETMASK="255.255.255.0"
GATEWAY="192.168.48.2"
SEARCH="huh.dod"

so the /etc/resolv.conf looks like:

# Generated by NetworkManager
search huh.dod
nameserver 192.168.64.1

Attempts at using the host command are refused:

host host
host.huh.dod has address 192.168.64.1
Host host.huh.dod not found: 5(REFUSED)
Host host.huh.dod not found: 5(REFUSED)


host host.huh.dod
host.huh.dod has address 192.168.64.1
Host host.huh.dod not found: 5(REFUSED)
Host host.huh.dod not found: 5(REFUSED)

I am not sure what the problem is.

Perhaps something to do with my iptables firewall?

Output of netstat -anlp | grep 53 | grep LISTEN

tcp        0      0 192.168.64.1:53         0.0.0.0:*               LISTEN      942/named           
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      942/named           
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      942/named           
tcp6       0      0 ::1:953                 :::*                    LISTEN      942/named       

named is running

4
  • is named up and running? seen logs? give us the output of netstat -anlp | grep 53 | grep LISTEN in the question. is not a listen directive missing in your options? Jun 10, 2018 at 19:33
  • Please edit the question for those outputs. Jun 10, 2018 at 19:50
  • @RuiFRibeiro adding listen-on port 53 { 192.168.64.1; }; to named.conf seems to have done the trick I get the output of host.huh.dod has address 192.168.64.1 thank you
    – J.Doe
    Jun 10, 2018 at 20:12
  • Explore it, you have got much more interesting options in there. Jun 10, 2018 at 21:10

2 Answers 2

1

Upon a cursory visual inspection, your options {} section seems spartan.

It is missing inside it the listen-on directive as in:

options {
   listen-on port 53 { 192.168.64.1; 127.0.0.1; };
    .....
};

Without that directive, BIND won't listen on in the intended interfaces.

1

According to the netstat output, BIND is running on the host thas IP address 192.168.64.1.

The client host, the one where the ifcfg-eth0 file is from, has

DNS1="192.168.64.1"
IPADDR="192.168.48.10"
NETMASK="255.255.255.0"
...

So the DNS server address is correct, but the client's own address is 192.168.48.10... which doesn't match any of the values in the allow-query configuration option:

allow-query {127.0.0.1; 192.168.64.0/24;};

With this configuration, the BIND on 192.168.64.1 will reject any queries except ones coming from the 192.168.64.* network and from the BIND server host itself. The client's address 192.168.48.10 is outside the specified network, so of course it will get rejected.

If you want only this one particular client to work outside the 192.168.64.* network, this allow-query setting in BIND configuration would do it:

allow-query { 127.0.0.1; 192.168.64.0/24; 192.168.48.10; };

Or if you want to allow access from the entire 192.168.48.* network too:

allow-query { 127.0.0.1; 192.168.64.0/24; 192.168.48.0/24; };

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .