Score:0

BIND9 DNS Issue : connection timed out; no servers could be reached from outside network

in flag

I am learning Bind9 and have setup Bind9 on Ubuntu 20.04.3 LTS

Here is named.conf file

options {
    directory "/var/cache/bind";

    listen-on { any; };

    listen-on port 53 { any; };

    allow-query { any; };

    forward only;
    
    forwarders {
        1.1.1.1;
        1.0.0.1;
    };
    response-policy {
        zone "example.co";
    };
    
};

logging {
        channel rpzlog {
        file "/var/log/named/rpz.log" versions unlimited size 100m;
            print-time yes;
            print-category yes;
            print-severity yes;
            severity info;
        };
    category rpz { rpzlog; };
};

zone "example.co" {
      type master;
      file "/etc/bind/db.example.co";
      allow-query { any; };
      allow-transfer { any; };
};

db.example.co file

$TTL 1w    ; default TTL = 1w
           ; TODO: should be adjusted to frequency of list updates

@   IN  SOA ns64.domaincontrol.com. root.ns64.domaincontrol.com. (
            2019102401      ; serial yyyymmddvv
            1w              ; refresh (match default TTL)
            1w              ; retry (match default TTL)
            1w              ; expiry (match default TTL)
            1d              ; negative caching
        )
@   IN  NS  ns64.domaincontrol.com.
@   IN  NS  ns63.domaincontrol.com.

; ***** START OF BLOCKLIST *****
wizhumpgyros.com CNAME .
*.wizhumpgyros.com CNAME .
coccyxwickimp.com CNAME .
*.coccyxwickimp.com CNAME .
n2019cov.000webhostapp.com CNAME .
*.n2019cov.000webhostapp.com CNAME .
webmail-who-int.000webhostapp.com CNAME .
*.webmail-who-int.000webhostapp.com CNAME .

If I do nslookup in local network, (like if I connected with same network) then it will work fine

Here 180.19.161.147 is my public IP.

nslookup google.com 180.19.161.147

output is:

Server:     180.19.161.147
Address:    180.19.161.147#53

Non-authoritative answer:
Name:   google.com
Address: 142.251.12.102
Name:   google.com
Address: 142.251.12.113
Name:   google.com
Address: 142.251.12.138
Name:   google.com
Address: 142.251.12.139
Name:   google.com
Address: 142.251.12.100
Name:   google.com
Address: 142.251.12.101
Name:   google.com

But I connect with another network

nslookup google.com 180.19.161.147

output will be like

;; connection timed out; no servers could be reached

from router side my port 53 is open

if I use below command

sudo ss -lntp | grep 53

output is like

LISTEN 0      10                          192.168.2.237:53         0.0.0.0:*     users:(("named",pid=32020,fd=55),("named",pid=32020,fd=54),("named",pid=32020,fd=53),("named",pid=32020,fd=52),("named",pid=32020,fd=51))
LISTEN 0      10                              127.0.0.1:53         0.0.0.0:*     users:(("named",pid=32020,fd=46),("named",pid=32020,fd=45),("named",pid=32020,fd=44),("named",pid=32020,fd=43),("named",pid=32020,fd=42))
LISTEN 0      4096                        127.0.0.53%lo:53         0.0.0.0:*     users:(("systemd-resolve",pid=566,fd=13))                                      
LISTEN 0      4096                            127.0.0.1:953        0.0.0.0:*     users:(("named",pid=32020,fd=36))                                              
LISTEN 0      10     [fe80::24a3:8c4f:dd63:8238]%wlp1s0:53            [::]:*     users:(("named",pid=32020,fd=74),("named",pid=32020,fd=73),("named",pid=32020,fd=72),("named",pid=32020,fd=71),("named",pid=32020,fd=70))
LISTEN 0      10                                  [::1]:53            [::]:*     users:(("named",pid=32020,fd=65),("named",pid=32020,fd=64),("named",pid=32020,fd=63),("named",pid=32020,fd=62),("named",pid=32020,fd=61))
LISTEN 0      4096                                [::1]:953           [::]:*     users:(("named",pid=32020,fd=75))        

This might be duplicate question of Bind9 not responding to outside dns queries while port 53 is open but I did not get any solution from there as well.

Please help me, thanks in advance.

Patrick Mevzek avatar
cn flag
Make sure to open both UDP and TCP on port 53
Siddhpura Amit avatar
in flag
Yes it is both open
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.