nslookup

From RaySoft

nslookup is a program to query Internet domain name servers. nslookup has two modes: interactive and non-interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain.[1]

Documentation

Syntax

nslookup [PARAMETER ...] [NAME] [SERVER]

Examples

Look up the IP address for 'raysoft.ch'
nslookup 'raysoft.ch' '8.8.8.8'

Output:

Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   raysoft.ch
Address: 217.26.52.37
Look up the DNS server for 'raysoft.ch'
nslookup -query='NS' 'raysoft.ch' '8.8.8.8'

Output:

Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
raysoft.ch      nameserver = ns.hostpoint.ch.
raysoft.ch      nameserver = ns2.hostpoint.ch.
Look up the mail server for 'raysoft.ch'
nslookup -query='MX' 'raysoft.ch' '8.8.8.8'

Output:

Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
raysoft.ch      mail exchanger = 10 mx1.mail.hostpoint.ch.
raysoft.ch      mail exchanger = 10 mx2.mail.hostpoint.ch.
Use interactive mode
nslookup
> server 8.8.8.8
Default server: 8.8.8.8
Address: 8.8.8.8#53
> raysoft.ch
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   raysoft.ch
Address: 217.26.52.37
> set query=NS
> raysoft.ch
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
raysoft.ch      nameserver = ns2.hostpoint.ch.
raysoft.ch      nameserver = ns.hostpoint.ch.
> set query=MX 
> raysoft.ch
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
raysoft.ch      mail exchanger = 10 mx2.mail.hostpoint.ch.
raysoft.ch      mail exchanger = 10 mx1.mail.hostpoint.ch.
> exit
Get the FQHN using nslookup
nslookup 'xeon' | awk --field-separator ':  *' '/Name/{print $2}'

Output:

xeon.raysoft.loc

References

  1. man 1 'nslookup'