How to find the domain name of a server?

You should nslookup the IP. It will return. Example.

[nazu@healer ~]$ nslookup
> bro-ns-01
Server:         10.100.1.2
Address:        10.100.1.2#53

Name:   bro-ns-01.angelsofclockwork.net
Address: 10.100.1.2
> 10.100.1.2
Server:         10.100.1.2
Address:        10.100.1.2#53

2.1.100.10.in-addr.arpa name = bro-ns-01.angelsofclockwork.net.
> 

I'm assuming you're using dnsmasq or otherwise, because your server address is set to your localhost. If that's the case, it should still be transparent enough to pull the information.

You could also look at /etc/resolve.conf if you're on the same network. You're more than likely being given a reverse DNS entry that has the same domain suffix of static servers.

[nazu@healer ~]$ cat /etc/resolv.conf 
; generated by /usr/sbin/dhclient-script
search angelsofclockwork.net.
nameserver 10.100.1.2

You can use the following command:

dig -x 192.168.94.3

(put the correct IP address in, of course)

The answer section will list the domain name of the ip address.

-x makes it do a reverse lookup. If your DNS server isn't giving you good answers, you can specify the DNS server to use by putting something like '@ns1.afraid.org' before the -x.

nslookup was depreciated years ago, I was actually surprised to find that it's still around.


you can also use the host command: host -a 1.2.3.4

Tags:

Dns

Networking