0
0
Linux CLIscripting~20 mins

nslookup and dig for DNS in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
DNS Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this nslookup command?
You run the command nslookup example.com. What type of information does this command return?
Linux CLI
nslookup example.com
AIt returns the mail servers (MX records) for example.com.
BIt returns the IP address associated with example.com.
CIt returns the DNS zone transfer data for example.com.
DIt returns the HTTP headers from example.com.
Attempts:
2 left
💡 Hint
Think about what nslookup does by default when given a domain name.
💻 Command Output
intermediate
1:30remaining
What does this dig command output?
You run dig +short MX gmail.com. What does this command output?
Linux CLI
dig +short MX gmail.com
AIt outputs the HTTP status code of gmail.com.
BIt outputs the IP addresses of gmail.com in a detailed format.
CIt outputs the mail exchange servers for gmail.com in a short format.
DIt outputs the DNS zone transfer data for gmail.com.
Attempts:
2 left
💡 Hint
The +short option simplifies the output, and MX queries ask for mail servers.
📝 Syntax
advanced
2:00remaining
Which dig command correctly queries the TXT records for example.com?
Choose the correct dig command to query TXT records for example.com.
Adig example.com TXT
Bdig -t TXT example.com
Cdig example.com -t TXT
Ddig -TXT example.com
Attempts:
2 left
💡 Hint
dig uses the syntax 'dig domain TYPE' to query specific record types.
🔧 Debug
advanced
2:00remaining
Why does this nslookup command fail?
You run nslookup -type=MX example.com but get an error. What is the cause?
Anslookup does not support querying MX records.
BThe option should be '-query=MX' instead of '-type=MX'.
CThe domain name is invalid.
DThe correct option is '-type MX' without the equals sign.
Attempts:
2 left
💡 Hint
Check the correct syntax for specifying query type in nslookup.
🚀 Application
expert
3:00remaining
How to automate checking DNS A records for multiple domains?
You have a list of domains in a file called domains.txt. Which bash script snippet correctly uses dig to print each domain with its A record IP address?
Awhile read domain; do dig +short A $domain; done < domains.txt
Bfor domain in $(cat domains.txt); do dig +short A $domain; done
Cwhile read domain; do dig +short $domain A; done < domains.txt
Dfor domain in $(cat domains.txt); do dig +short $domain A; done
Attempts:
2 left
💡 Hint
Remember the correct order of arguments for dig and how to read lines from a file.