nslookup
nslookup is a program available in Linux that you can use to send queries to query a DNS. The nslookup program can operate in two modes:
- Interactive mode
- Non-interactive mode
The syntax for the nslookup program is as follows:
nslookup [ -option ... ] [ host-to-locate | - [ server ]]
The two modes are discussed in the following sections.
Interactive Mode
Interactive mode allows a user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. In interactive mode, users can query name servers for information, such as hosts in a domain. Interactive mode is the default mode used when no arguments are given in the command line. This mode allows a user to enter commands while the nslookup program is running. After executing the program in interactive mode, a user can press the Ctrl+C combination keys to enter a number of commands. A few commonly used commands are discussed in the following sections.
host [servername]
If the host command is used without the [servername] parameter, the lookup is done for the default server, as mentioned in the resolv.conf configuration file. Otherwise, the lookup is done using the servername as mentioned in the host command.
If the host is an Internet address and the query type is A or PTR, the name of the host is returned. However, if host is a name and does not contain a trailing period, the default domain name is appended to the name. This behavior depends on the state of the set options domain, srchlist, defname, and search.To look up a host not in the current domain, append a period to the name. The host name returned is an IP address and the query is of either A or PTR type. On the other hand, if only the host name is returned, the domain name is added to the host name.
server <servername>
The server command is used to change the default server to that specified in the command.
finger [hostname]
The finger command is to connect to a finger server on the host computer and retrieve finger information for that host. If a finger daemon is not running, information cannot be retrieved for any other reason and the command returns an error.
ls [option] domainname
The ls command is used to return host names and Internet address information for a particular domain. The command retrieves this information from a DNS server. A few options that you can use with this command are listed here:
- -t querytype. This parameter is used to specify that the list information should be retrieved only for a particular type. The types include A, CNAME, HINFO, MINFO, MX, NS, PTR, SOA, TXT, UINFO, WKS, ANY, AXFR, MB, MD, MF, and NULL. The default type is A.
- -a. This parameter is used to retrieve alias names for a particular host in a domain.
- -d. This parameter is used to list all available records for a domain.
- -h. This parameter is used to find hardware and operating system information for a host.
- -s. This parameter is used to display all services that are being run in a host. The parameter can list only a limited number of services that are being run in the host computer.
- ?. This parameter is used to display help. It also includes sections to display the list of available commands.
- exit. This parameter is used to exit the program.
Non-Interactive Mode
In non-interactive mode, the program prints the name and the requested name for a host or domain. The program operates in non-interactive mode when the first argument is the host name to be looked up and the second optional argument is a host name or a name server.
In this tutorial:
- Linux Other Network Servers
- Setting the FTP User Account
- Configurations File for FTP Server
- ftpusers
- Anonymous FTP
- Using Proper Password and Group Files
- Anonymous FTP Warnings
- Sendmail
- Sendmail Security
- Domain Name Service
- Domain Name Space
- Services Offered By a DNS Server
- DNS Transactions
- BIND
- BIND Configuration
- Resource Records (RR)
- Start of Authority (SOA)
- nslookup
- BIND Security
- Host Name Spoofing
- Running BIND with Least Privileges
- DNS Security Extensions (DNSEC)
- SAMBA
- SMB Protocol
- Mounting the SMB File System
- SAMBA Security
- Server-Level Security