How to Install nslookup on CentOS 6.3

nslookup is part of the bind-utils package. Please note that the host, dig and nslookup are also part of the bind utilities. Without bind-utils package installed, you will get the following error when you try to nslookup any domain:

[root@centos63 ~]# nslookup
-bash: nslookup: command not found.3

To install the nslookup in CentOS 6.3, simply run this command :

[root@centos63 ~]# yum install bind-utils -y
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: ossm.utm.my
 * extras: ossm.utm.my
 * updates: ossm.utm.my
CentOS6.3-Repository                                                         | 4.0 kB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.8.2-0.10.rc1.el6_3.2 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.10.rc1.el6_3.2 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: liblwres.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisccfg.so.82 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisccc.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libisc.so.83 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libdns.so.81 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Processing Dependency: libbind9.so.80 for package: 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.8.2-0.10.rc1.el6_3.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package              Arch           Version                                Repository         Size
====================================================================================================
Installing:
 bind-utils           i686           32:9.8.2-0.10.rc1.el6_3.2              updates           180 k
Installing for dependencies:
 bind-libs            i686           32:9.8.2-0.10.rc1.el6_3.2              updates           882 k

Transaction Summary
====================================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.7 M
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.0 M
(1/2): bind-libs-9.8.2-0.10.rc1.el6_3.2.i686.rpm                             | 882 kB     00:09
(2/2): bind-utils-9.8.2-0.10.rc1.el6_3.2.i686.rpm                            | 180 kB     00:01
----------------------------------------------------------------------------------------------------
Total                                                                97 kB/s | 1.0 MB     00:10
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.10.rc1.el6_3.2.i686                                         1/2
  Installing : 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686                                        2/2
  Verifying  : 32:bind-utils-9.8.2-0.10.rc1.el6_3.2.i686                                        1/2
  Verifying  : 32:bind-libs-9.8.2-0.10.rc1.el6_3.2.i686                                         2/2

Installed:
  bind-utils.i686 32:9.8.2-0.10.rc1.el6_3.2

Dependency Installed:
  bind-libs.i686 32:9.8.2-0.10.rc1.el6_3.2

Complete!

Now you can start use nslookup:

[root@centos63 ~]# nslookup
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 209.85.175.147
Name:   www.l.google.com
Address: 209.85.175.103
Name:   www.l.google.com
Address: 209.85.175.104
Name:   www.l.google.com
Address: 209.85.175.105
Name:   www.l.google.com
Address: 209.85.175.106
Name:   www.l.google.com
Address: 209.85.175.99

How to Check MX Record Using nslookup Command on Windows

nslookup is a command-line tool for network administrator and system administrator that available in many computer operating systems such as linux and windows for querying the Domain Name System (DNS). nslookup can obtain domain name or IP address or for any other specific DNS record. In this post, i will share how nslookup command will useful to check MX record on windows command prompt.

Open windows command prompt and enter “nslookup” command :

C:\>nslookup
Default Server:  google-public-dns-a.google.com
Address:  8.8.8.8

> set type=mx

or
Alternatively, you can run “set q=mx” which will return you the same result with “set type=mx” command :

C:\>nslookup
Default Server:  google-public-dns-a.google.com
Address:  8.8.8.8

> set q=mx

After entering “set typ=mx” or “set q=mx”, you can proceed to enter the domain name that you want to check it’s mx records. In this example, i will share the mx records for gmail.com, yahoo.com and bloggermy.com.

Check MX records for gmail.com

> gmail.com
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
gmail.com       MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com
gmail.com       MX preference = 5, mail exchanger = gmail-smtp-in.l.google.com
gmail.com       MX preference = 40, mail exchanger = alt4.gmail-smtp-in.l.google.com
gmail.com       MX preference = 20, mail exchanger = alt2.gmail-smtp-in.l.google.com
gmail.com       MX preference = 10, mail exchanger = alt1.gmail-smtp-in.l.google.com

Check MX records for yahoo.com

> yahoo.com
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
yahoo.com       MX preference = 1, mail exchanger = mta5.am0.yahoodns.net
yahoo.com       MX preference = 1, mail exchanger = mta6.am0.yahoodns.net
yahoo.com       MX preference = 1, mail exchanger = mta7.am0.yahoodns.net

Check MX records for bloggermy.com

> bloggermy.com
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
bloggermy.com   MX preference = 5, mail exchanger = ALT1.ASPMX.L.GOOGLE.com
bloggermy.com   MX preference = 5, mail exchanger = ALT2.ASPMX.L.GOOGLE.com
bloggermy.com   MX preference = 10, mail exchanger = ASPMX2.GOOGLEMAIL.com
bloggermy.com   MX preference = 10, mail exchanger = ASPMX3.GOOGLEMAIL.com
bloggermy.com   MX preference = 0, mail exchanger = bloggermy.com
bloggermy.com   MX preference = 1, mail exchanger = ASPMX.L.GOOGLE.com

How to Install nslookup on CentOS

nslookup is part of the bind-utils package. Without bind-utils package installed, you will get the following error when you try to nslookup any domain:

[root@centos6 ~]# nslookup
-bash: nslookup: command not found

To install the nslookup in CentOS, simply run this command :

[root@centos6 ~]# yum install bind-utils
Loaded plugins: fastestmirror
Determining fastest mirrors
CentOS6.2-Repository                                                  | 1.3 kB     00:00 ...
CentOS6.2-Repository/primary                                          | 1.2 MB     00:00 ...
CentOS6.2-Repository                                                               3042/3042
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.7.3-8.P3.el6 will be installed
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: liblwres.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccfg.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccc.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisc.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libdns.so.69 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libbind9.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.7.3-8.P3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package           Arch        Version                     Repository                   Size
=============================================================================================
Installing:
 bind-utils        i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        177 k
Installing for dependencies:
 bind-libs         i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        849 k

Transaction Summary
=============================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Is this ok [y/N]: n
Exiting on user Command
[root@centos6 ~]# nslookup
-bash: nslookup: command not found
[root@centos6 ~]# yum install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.i686 32:9.7.3-8.P3.el6 will be installed
--> Processing Dependency: bind-libs = 32:9.7.3-8.P3.el6 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: liblwres.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccfg.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisccc.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libisc.so.62 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libdns.so.69 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Processing Dependency: libbind9.so.60 for package: 32:bind-utils-9.7.3-8.P3.el6.i686
--> Running transaction check
---> Package bind-libs.i686 32:9.7.3-8.P3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package           Arch        Version                     Repository                   Size
=============================================================================================
Installing:
 bind-utils        i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        177 k
Installing for dependencies:
 bind-libs         i686        32:9.7.3-8.P3.el6           CentOS6.2-Repository        849 k

Transaction Summary
=============================================================================================
Install       2 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Is this ok [y/N]: y
Downloading Packages:
---------------------------------------------------------------------------------------------
Total                                                        6.1 MB/s | 1.0 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.7.3-8.P3.el6.i686                                          1/2
  Installing : 32:bind-utils-9.7.3-8.P3.el6.i686                                         2/2

Installed:
  bind-utils.i686 32:9.7.3-8.P3.el6

Dependency Installed:
  bind-libs.i686 32:9.7.3-8.P3.el6

Complete!

Now you can start use nslookup:

[root@centos6 ~]# nslookup
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 209.85.175.105
Name:   www.l.google.com
Address: 209.85.175.106
Name:   www.l.google.com
Address: 209.85.175.147
Name:   www.l.google.com
Address: 209.85.175.99
Name:   www.l.google.com
Address: 209.85.175.103
Name:   www.l.google.com
Address: 209.85.175.104
> set type=ns
> www.google.com
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.

Authoritative answers can be found from:
l.google.com
        origin = ns1.google.com
        mail addr = dns-admin.google.com
        serial = 1473322
        refresh = 900
        retry = 900
        expire = 1800
        minimum = 60
>