Skip to main content
69 votes

Is `dig ptr` a valid way to perform a reverse DNS query?

dig -x is a form of "syntactic sugar" that was added to the program later. Reverse DNS records, or PTR records, for IPv4 addresses are stored in the DNS in the reversed format that you see in the ...
ferthalangur's user avatar
33 votes
Accepted

how to extract just the IP address from a DNS query

I believe dig +short outputs two lines for you because the domain you query, smtp.mydomain.net is a CNAME for smtp.ggs.mydomain.net, and dig prints the intermediate resolution step. You can probably ...
dhag's user avatar
  • 15.8k
26 votes
Accepted

How does dig find my WAN-IP-address? What is "myip.opendns.com" doing?

First to summarize the general usage of dig: it requests the IP assigned to the given domain from the default DNS server. So e.g. dig google.de would request the IP assigned to the domain google.de. ...
tr01's user avatar
  • 596
22 votes

How does dig find my WAN-IP-address? What is "myip.opendns.com" doing?

Google provides the same service. For IPv4: dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com For IPv6: dig -6 TXT +short o-o.myaddr.l.google.com @ns1.google.com where TXT is a DNS record ...
Mafketel's user avatar
  • 321
15 votes
Accepted

Why does dig -6 google.com not work for me?

-4/-6 tells dig to only use IPv4/IPv6 connectivity to carry your query to the nameserver - it doesn't change whether to query for A records(IPv4) or AAAA records(IPv6) if that's what you intended. If ...
maxf's user avatar
  • 1,629
14 votes

How to install dig on Cygwin?

The correct package name for Cygwin at least is: bind-utils: As you can see I've already installed it. Also to note, there was nothing to configure for dig to work right after installation.
Vlastimil Burián's user avatar
13 votes
Accepted

How to install dig on Cygwin?

To find the proper package that contains a specific file, you can always use cygcheck -p to ask the Cygwin server: $ cygcheck -p bin/dig Found 6 matches for bin/dig bind-debuginfo-9.11.5-2.P4 - bind-...
matzeri's user avatar
  • 961
12 votes
Accepted

Why doesn't systemd-resolved use my local DNS server?

So, changing my wired eth0 interface to be managed solved this issue for me. Changing ifupdown to managed=true in /etc/NetworkManager/NetworkManager.conf [ifupdown] managed=true Then restart ...
Civing's user avatar
  • 409
11 votes
Accepted

Finding out what DNS server are being used

You can use the +trace option to dig to see the entire sequence of queries, from your system to root servers, all the way down to the authoritative servers.
John's user avatar
  • 17.1k
10 votes

Why does dig -6 google.com not work for me?

Yes, that suggests that you do not have IPv6 connectivity. If you want to obtain an IPv6 address for google rather than using IPv6 to obtain an address for google, you want dig -t aaaa google.com ...
user4556274's user avatar
  • 9,045
9 votes

Why doesn't systemd-resolved use my local DNS server?

My guess is that your systemd-resolved service is configured correctly, but it never gets to see the request. The .local domain is treated specially by systems running mDNS. avahi-daemon, which ...
ErikF's user avatar
  • 4,107
8 votes

how to extract just the IP address from a DNS query

@dhag's answer sounds good; if you do not want to “rely on the last line from dig's output being the IP” you can use grep to extract just the numerical IP address: dig +short smtp.mydomain.net | grep ...
Renardo's user avatar
  • 304
7 votes

How to install dig on CentOS?

On legacy systems you'll have to use yum instead: $ yum install bind-utils
Mikael Dúi Bolinder's user avatar
7 votes
Accepted

How do I figure out where wrong local dns results are coming from?

Resolvconf is pointing it out to a local software running in port 53 in the local machine. To find it out which one: sudo netstat -anlp | grep :53 As we have found out, it is the avahi daemon. To ...
Rui F Ribeiro's user avatar
6 votes
Accepted

resolve my ip with dig returns empty string

For some reason opendns is also not working for me at work. e.g. your command is not at fault, it is simply that opendns is not answering to that specific query to find the public IP address in some ...
Rui F Ribeiro's user avatar
5 votes
Accepted

dig -x www.google.com

Notice in the response that you got back status: NXDOMAIN and ANSWER: 0. This means there was no record found matching your query. The -x option to dig is merely a convenience for constructing a PTR ...
phemmer's user avatar
  • 72.1k
5 votes

Why does dig utility hang indefinitely even with timeout specified?

As for using aplicational timeouts in some utilities, when there are connectivity issues, it is not always guaranteed the application will stop on it's own with some outside "coercion". I would use ...
Rui F Ribeiro's user avatar
5 votes

`dig -4` returns IPv6 address

This is you not doing things properly. ☺ The reported -c IN effect is because you didn't do that right. Both queries were clearly IN, as that is the default class anyway. But notice that the one that ...
JdeBP's user avatar
  • 69.3k
4 votes
Accepted

How does root(DNS) server could answer about twitter.com?

Unable to replicate: $ dig @a.root-servers.net twitter.com +norecurse ; <<>> DiG 9.8.3-P1 <<>> @a.root-servers.net twitter.com +norecurse ; (1 server found) ;; global options:...
DopeGhoti's user avatar
  • 76.7k
4 votes
Accepted

How can I get my bash script to remove the first n and last n lines from a variable?

sed takes its input from stdin, not from the command line, so your script won't work either theoretically or practically. sed -i 1,10d $dr does not do what you think it does...sed will treat the ...
cas's user avatar
  • 79k
4 votes
Accepted

dig / nslookup cannot resolve, but ping can

This is not a problem of a more basic protocol not working, but rather that there are multiple name service resolution protocols being used; ping here understands multicast DNS (mDNS) and is able to ...
thrig's user avatar
  • 35.1k
4 votes

How shall I understand the output of `dig`?

$ dig @a.edu-servers.net robot.cs.washington.edu You asked a.edu-servers.net to find the A records for robot.cs.washington.edu for you. ;; WARNING: recursion requested but not available But it ...
telcoM's user avatar
  • 99.2k
4 votes

How to get dig without bind

You can install the dnsutils package containing dig or nslookup, and leave alone the bind9 package containing the BIND daemon which you do not need. (Thanks to @telcoM for adding this info in a ...
dr_'s user avatar
  • 30k
4 votes

Extract A record and query time from dig output

Pretty trivial with awk, the exact matching conditions may be tweaked based on the possible patterns that may appear: dig @1.1.1.1 google.com +noall +answer +stats | \ awk '$3 == "IN" && $...
user000001's user avatar
  • 3,645
3 votes

Resolve local host without any DNS server?

You're using /etc/hosts correctly but nslookup ignores the hosts file. It is doing a DNS lookup not a lookup of how the hostname resolves in your configured environment. Try pinging the hostname ...
B Layer's user avatar
  • 5,171
3 votes

DNS caching problem

DNS is cached by design. When you update a record, you need to set a new serial number, and then servers with the old one will notice once the old TTL expires. Your question demonstrates no ...
tripleee's user avatar
  • 7,753
3 votes
Accepted

Bash print current line, line's output, and linebreak to file

To avoid running one dig and read per line of the file, you could do: dig -f domains.txt mx +noall +answer Which would give an output like: stackexchange.com. 300 IN MX 5 alt1....
Stéphane Chazelas's user avatar
3 votes
Accepted

Unable to run DNS queries when response is bigger than 512 Bytes and truncated

"Can anyone please provide some insight about why this works like this and help with some solution, if any?" SHORT ANSWER: A default Azure VM is created with broken DNS: systemd-resolved ...
F1Linux's user avatar
  • 2,554
3 votes

Why does dig +trace take seconds to complete?

The 4s come from bash time utility. It reports the total runtime of the dig binary. The 12ms, 68ms, ... are the times dig itself reports. Documentation on dig is a bit sparse (which is probably what ...
Jann Poppinga's user avatar
3 votes
Accepted

Understanding the dig's DNS query: Does dig set non zero value for Z field?

There are no multiple variants of DNS, but RFC 1035 on this subject was amended by RFC2535 "DNS Security Extensions". Its section 6.1 shows the message format: ...
Patrick Mevzek's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible