Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

192.168.1.1 is my router NetGear. It has 8.8.8.8 and 8.8.4.4 set as DNS. from windows:

nslookup google.com 192.168.1.1  // works OK

from ubuntu:

me@ubuntu:/etc/mail# dig @192.168.1.1 google.com +tcp
;; Connection to 192.168.1.1#53(192.168.1.1) for google.com failed: connection refused.

I think this shouldn't go on port 53, right? If yes, what can be the reason to dig translating my DNS query to asking NetGear on wrong port?

I cannot query 8.8.8.8:

dig @8.8.8.8 google.com

; <<>> DiG 9.9.2-P2 <<>> @8.8.8.8 google.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
root@ubuntuamd:/etc/mail# dig @8.8.8.8 google.com +tcp

however can with +tcp:

dig @8.8.8.8 google.com +tcp

; <<>> DiG 9.9.2-P2 <<>> @8.8.8.8 google.com +tcp
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59432
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     88  IN  A   46.28.247.93
google.com.     88  IN  A   46.28.247.119
//etc

;; Query time: 33 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Wed May  8 00:20:06 2013
;; MSG SIZE  rcvd: 295

at the end this: here 127.0.1.1 (dnsmasq right?) responds:

 dig  google.com

; <<>> DiG 9.9.2-P2 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34747
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     300 IN  A   208.117.224.29
//etc

;; Query time: 3 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Wed May  8 00:04:44 2013
;; MSG SIZE  rcvd: 284

nm tool:

me@ubuntu:/etc/mail# nm-tool | tail -n 8   IPv4 Settings:
    Address:         192.168.1.3
    Prefix:          24 (255.255.255.0)
    Gateway:         192.168.1.1

    DNS:             192.168.1.1
share|improve this question

migrated from serverfault.com May 7 '13 at 22:18

This question came from our site for professional system and network administrators.

3  
Port 53 is the DNS port. What makes you think it's wrong? –  Michael Hampton May 7 '13 at 22:06
    
but for listening. My query shouldn't go on routers 53 but some random port, isn't it? if it is OK then why it is refused? –  bits_international May 7 '13 at 22:06
    
Your query should come from a random port (in a range) TO the designed server port of 53. –  Jeff Ferland May 7 '13 at 22:15
    
Is your Ubuntu machine even connected to the network correctly? –  Michael Hampton May 7 '13 at 22:24
    
yes, I am on it currenntly –  bits_international May 7 '13 at 22:26

3 Answers 3

Port 53 is indeed the port that a DNS server listens on for requests.

However, by default it's UDP port 53, and TCP port 53 is not often used.

Your dig and nslookup commands use UDP by default, but in your dig command you specified to use TCP with +tcp, and since the router is only listening on UDP, the request fails.

To resolve the issue, query with UDP by removing +tcp from your dig command.

share|improve this answer
    
no, this doesn't work –  bits_international May 7 '13 at 22:21
    
Then provide the output. –  Michael Hampton May 7 '13 at 22:22
    
dig @192.168.1.1 google.com ; <<>> DiG 9.9.2-P2 <<>> 192.168.1.1 google.com ; (1 server found) ;; global options: +cmd ;; connection timed out; no servers could be reached –  bits_international May 7 '13 at 22:23

DNS runs on Port 53.

Port 53 is the IANA assigned port for DNS.

dig does a DNS lookup. nslookup does a DNS lookup. Thus they both use Port 53.

As to your real question, which is:

then why it is refused?

Well, that could be for any number of reasons. Maybe your Ubuntu computer is on a different network. Maybe its network cable is unplugged. Maybe you have firewall rules blocking outbound DNS except to some specific IP addresses.

Is there a specific problem you're trying to solve by doing this dig command?

share|improve this answer
    
yes, I cannot query 8.8.8.8 directly –  bits_international May 7 '13 at 22:19
    
please see the update –  bits_international May 7 '13 at 22:20
    
Try again without the +tcp –  Darth Android May 7 '13 at 22:22
    
@DarthAndroid have you any idea why doesn't work without +tcp? on windows it works without +tcp –  bits_international May 7 '13 at 22:35
2  
@restart.localhost.localdomain The default DNS port is 53 UDP. Sometimes, DNS servers simply aren't listening for a TCP connection because they're expecting UDP. –  Darth Android May 7 '13 at 22:43

You should install bind and use 127.0.1.1. This might help and resolve your problems.

share|improve this answer
    
thanks, I consider this a t the moment –  bits_international May 10 '13 at 15:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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