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

  • 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? – Rui F Ribeiro Jun 10 '18 at 19:33
  • Please edit the question for those outputs. – Rui F Ribeiro Jun 10 '18 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 '18 at 20:12
  • Explore it, you have got much more interesting options in there. – Rui F Ribeiro Jun 10 '18 at 21:10
  • Why do you have IPADDR="192.168.48.10" if you're expecting your host to serve DNS from 192.168.64.1? – roaima Jun 10 '18 at 22:21
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.