dig performs DNS lookups and displays records matching the specified IP address or domain name.
Questions tagged [dig]
213 questions
1
vote
1 answer
coredns doesnt give IP but just name
By running a dig command for a service in my kubernetes cluster, coredns just gives service name but not the IP. Does anyone know why this is happening?

Divya Myntra
- 21
- 4
1
vote
1 answer
why server can't find pihole.service.consul: NXDOMAIN and how can I fix this?
I have following configuration for consul.
{
"service": {
"name": "pihole",
"Address": "192.168.0.15",
"tags": [
"pi"
],
"port": 8165,
"check": {
"args": [
"curl",
"192.168.0.15"
],
…

Ciasto piekarz
- 7,853
- 18
- 101
- 197
1
vote
1 answer
Adding filename/domain name before result of cat
When i run below command I got result like
dig +short ns kinoafisha.info | awk -v RS='' '{gsub("\n", ", "); print}' >> test.csv
dig +short ns linux.com | awk -v RS='' '{gsub("\n", ", "); print}' >> test.csv
Result
ns2.kinoafisha.info.,…

Amit Singh
- 188
- 9
1
vote
2 answers
Bash script if/then with multiple conditions
I want to print out the hostname and CNAME only if DNS status is: "NXDOMAIN" OR "SERVFAIL" AND has a "CNAME".
Conditions:
dig @8.8.8.8 -t A ${hstnm} | grep -q 'NXDOMAIN'
dig @8.8.8.8 -t A ${hstnm} | grep -q 'SERVFAIL'
dig @8.8.8.8 -t CNAME $hstnm…

catek
- 13
- 3
1
vote
3 answers
nslookup/dig/drill commands on a file that contains websites to add ip addresses
UPDATE : Still open for solutions using nslookup without parallel, dig or drill
I need to write a script that scans a file containing web page addresses on each line, and adds to these lines the IP address corresponding to the name using nslookup…

JonBjatBun
- 39
- 5
1
vote
1 answer
How to make relative path DNS query with dig?
I want to make a relative path DNS query with dig. I have referenced the following documentation for dig(1) and resolv.conf(5).
dig(1) says:
+ndots=D
Set the number of dots that have to appear in name to D for it to be considered absolute. The…

Jingguo Yao
- 7,320
- 6
- 50
- 63
1
vote
1 answer
Why DNS responses differents?
I have code in python.
from dns import message, query, flags, rdatatype
q = message.make_query("bancontact.node1.web1.prod.kunstmaan.com", rdatatype.NS, want_dnssec=True)
q.flags |= flags.AD
res = query.udp(q, "170.252.72.92")
and dig query
dig…

Anton
- 1,051
- 1
- 9
- 21
1
vote
1 answer
What would be an optimal way to perform DNS query from bash in python3?
I have this simple bash script that I'm thinking about incorporating into my python project as I couldn't figure out a graceful way to do this in python3 compared to this single bash oneliner. Is there a better way to do this in python3 or a library…

MrPMillz
- 15
- 6
1
vote
1 answer
How do I make dig use a source IP other than localhost while querying a DNS server running locally on my machine?
I am trying to run a coredns plugin https://github.com/coredns/demo that returns 1.1.1.1 for 172.0.0.0/8 or 127.0.0.0/8 and 8.8.8.8 for everything else.
I run the binary and try to make a request from dig using dig example.org @localhost -p1053…

Palash Nigam
- 1,653
- 3
- 14
- 26
1
vote
2 answers
Speed up dig -x in bash script
I have to run as an exercise at my university a bash script to reverse lookup all their DNS entries for a B class network block they own.
This is the fastest I have got but takes forever. Any help optimising this…

The Shidoshi
- 13
- 2
1
vote
1 answer
dig returns wrong record type
This seems like I am either missing something obvious, or it would have been asked before. When I query dig using the -t parameter to specify a DNS record type, the result seems to contain an answer even if the record returned is a different record…

chris
- 588
- 5
- 16
1
vote
1 answer
Testing for a bash Variable the right way
I have seen plenty of remarks on how to do this right, but somehow it does not work for me, and I am not sure why, some help would be appreciated.
Example Code:
#!/bin/bash
echo -en "\ec"
echo "."
#Dig MX Record
DIG="$(which dig --skip-alias)"
…

Adesso
- 928
- 2
- 13
- 27
1
vote
1 answer
Bash expand variable within another variable in a single line command
I'm trying to extract FQDN for a CentOS 7.3 host. This is the script I use:
hostname=$(dig +short -x 10.10.10.10)
hostname=${hostname%.}
The reason for the 2nd line is the dig output returns a dot . at the end for e.g. abc@def.com.. And hence the…

Sandeep Kanabar
- 1,264
- 17
- 33
1
vote
1 answer
How does dig any work?
My general question is how does "dig any" work?
In particular, I would like to compare the use of dig to naive sending of multiple equivalent requests (a, txt, mx, ...).
Does a single DNS query is sent? Is the use of dig more efficient?
Is it…

Gari BN
- 1,635
- 2
- 17
- 31
1
vote
1 answer
Two hostnames sharing the same IP
I noticed that one of Google's mail servers (alt4.aspmx.l.google.com) points to 74.125.200.26, but when I do a reverse DNS lookup on that IP I see that the hostname associated with it is sa-in-f26.1e100.net. My limited understanding of DNS is that…

Rrmm
- 53
- 2
- 7