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
Best Answer
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
andnslookup
commands use UDP by default, but in yourdig
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 yourdig
command.