How to Install nslookup on CentOS 7: [5 Easy Steps]

Introduction

In this tutorial, we will learn about how to install nslookup on CentOS 7 using 5 easy steps. nslookup is one of the networking tool used in Linux mostly for the DNS-related task query and troubleshooting purpose. There are plenty of options available with nslookup tool which helps you to dig more into the DNS related issues and troubleshoot. In the upcoming sections, we will understand the basic of this tool along with how to install nslookup in CentOS system. Let’s get started

 

How to Install nslookup on CentOS 7: [5 Easy Steps]

nslookup Overview

nslookup which stands for ‘name server lookup‘ is a command-line tool available in Linux and other Unix-like operating systems. It allows us to query DNS(Domain Name Server) servers to obtain information about domain names, IP addresses and DNS records. You can use nslookup commands to do various DNS-related taske. Some of such tasks are:

Resolving Hostnames to IP Addresses:  You can use command nslookup <domain-name> to find the IP address related to a particular domain

Reverse DNS Lookup: You can use command nslookup <IP-address> to find the associated domain name. This is called reverse DNS lookup

Quering Specific DNS Servers: You can use command nslookup -querytype=<query_type> <domain-name> <dns-server> to specify which DNS server to query.

 

How to Install nslookup on CentOS 7: [5 Easy Steps]

Also read: How to Install Performance Co-Pilot on CentOS 7: [4 Easy Steps]

Prerequisite:

  • CentOS 7 operating system Installed
  • Must have root privilege.

 

Step-1: Update Repository

In this step, we will update the repository so that the latest version of all the packages are updated for download.

[[email protected] ~]# yum update -y
Last metadata expiration check: 8:15:59 ago on Sun 03 2023 01:43:05 AM EDT.
Dependencies resolved.
Nothing to do.
Complete!

 

Step-2: Search Package in Repository

In this step, we will search the bind-utils package in yum repository. nslookup tool is part of bind-utils utility.

[[email protected] ~]# yum search bind-utils
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
* base: ftp.funet.fi
* centos-qemu-ev: ftp.funet.fi
* epel: www.nic.funet.fi
* extras: ftp.funet.fi
* updates: ftp.funet.fi
============================================================== N/S matched: bind-utils ===============================================================
bind-utils.x86_64 : Utilities for querying DNS name servers

Name and summary matches only, use "search all" for everything.

 

Step-3: Install the Package

In this step, we will install the bind-utils utility using below command. If there are no issues during the installation, it will print complete as the end as shown below.

[[email protected] ~]# yum install -y bind-utils
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
* base: ftp.funet.fi
* centos-qemu-ev: ftp.funet.fi
* epel: www.nic.funet.fi
* extras: ftp.funet.fi
* updates: ftp.funet.fi
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.11.4-26.P2.el7_9.14 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
bind-utils x86_64 32:9.11.4-26.P2.el7_9.14 updates 262 k

Transaction Summary
======================================================================================================================================================
Install 1 Package

Total download size: 262 k
Installed size: 584 k
Downloading packages:
bind-utils-9.11.4-26.P2.el7_9.14.x86_64.rpm | 262 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 32:bind-utils-9.11.4-26.P2.el7_9.14.x86_64 1/1
Verifying : 32:bind-utils-9.11.4-26.P2.el7_9.14.x86_64 1/1

Installed:
bind-utils.x86_64 32:9.11.4-26.P2.el7_9.14

Complete!

Upon successful installation, you can check if utility  is installed in the system using below command.

[[email protected] ~]# rpm -qa | grep bind-utils
bind-utils-9.11.4-26.P2.el7_9.14.x86_64

 

Step-4:  Verify the Installation

In this step, we will run a basic nslookup command to resolve the domain name to IP address using below command.

[[email protected] ~]# nslookup google.com
Server: 10.171.0.1
Address: 10.171.0.1#53

Non-authoritative answer:
Name: google.com
Address: 216.58.211.238
Name: google.com
Address: 2a00:1450:4026:808::200e

As you see the command output, domain name `google.com` returns the IP address `216.58.211.238` associated with it.

 

Step-5: Remove the bind-utils Package

In this step, once you are done with all your work and want to remove nslookup utility,  use below given command.

[[email protected] ~]# yum remove -y bind-utils
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.11.4-26.P2.el7_9.14 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Removing:
bind-utils x86_64 32:9.11.4-26.P2.el7_9.14 @updates 584 k

Transaction Summary
======================================================================================================================================================
Remove 1 Package

Installed size: 584 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : 32:bind-utils-9.11.4-26.P2.el7_9.14.x86_64 1/1
Verifying : 32:bind-utils-9.11.4-26.P2.el7_9.14.x86_64 1/1

Removed:
bind-utils.x86_64 32:9.11.4-26.P2.el7_9.14

Complete!

 

Also read: How to Install Cockpit on CentOS 7: [7 Easy Steps]

Summary

nslookup is just one tool that comes with bind-utils. There are several other tools available with bind-utils which also helps to work with DNS related problems. Some of them are dig, delv, host etc. You can also manually download the bind-utils package for different Linux distros and install from pkgs.org.

Leave a Comment