Tips & Tricks: Find Linux DNS server IP address

I always wondered what my DNS server IP address assigned by my ISP was and today I finally  found out. Typically under a Linux machine using command prompt it really isn't that difficult.

Under Linux the resolver is used (set of routines in the C library) that provide access to the Domain Name System (DNS). The resolver configuration file is located inside the /etc folder and it contains information that is read by the resolver routines the first time they are invoked by a process. Using the grep command it should be as painless as:

@##des ~ $ sudo grep --color nameserver /etc/resolv.conf
nameserver 192.168.1.2
nameserver 192.168.1.3


However this was initially not possible on my Linux Mint 13 machine due to a missing symlink for the resolv.conf file, which was easily fixed with;

@##des ~ $ sudo dpkg-reconfigure resolvconf

and choosing 'yes' to the option to create a symlink.

In my case my primary DNS server is 192.168.1.2 while my secondary is 192.168.1.3 in dot notation. Currently name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no name server entries are present, the default is to use the local machine name server 127.0.0.1.

No comments:

Post a Comment