The nslookup
command is used to perform forward DNS lookups, meaning it resolves hostnames to IP addresses. To perform a reverse DNS lookup, which resolves IP addresses to hostnames, you can use the host
command instead.
The host
command can perform both forward and reverse DNS lookups. To perform a reverse DNS lookup, simply provide an IP address as an argument to the host
command. For example, to perform a reverse DNS lookup for the IP address 8.8.8.8
, run the following command:
host 8.8.8.8
This will return the hostname associated with the IP address, if there is one. If there is no hostname associated with the IP address, the command will return an error.
You can also use the nslookup
command with the -x
option to perform a reverse DNS lookup. For example, to perform a reverse DNS lookup for the IP address 8.8.8.8
using nslookup
, run the following command:
nslookup -x 8.8.8.8
This will also return the hostname associated with the IP address, if there is one. However, as mentioned earlier, the host
command is the recommended tool for performing reverse DNS lookups.