In this article, we will review the Nmap software program and multiple commands. Nmap is an open-source mainstream tool used by network administrators to scan ports and map networks. Nmap commands are primarily used to identify which ports certain software is running on our system. It is also used to discover available hosts and what services they are offering and detecting potential security risks. Using Nmap, you can check a single host or a complete network. In this tutorial, we will cover several basic as well as advanced Nmap commands in the “Pro Tips and Tricks” section of the article.

Category, Requirements, and Software Version Used

OS UsedCentOS 7

User Type: Root

Software: Nmap

Task Difficulty: Medium

Other: The server we will use in this tutorial is an unmanaged CentOS 7 server without a control panel.

Nmap Installation

New servers usually do not have the nmap tool installed. To install nmap, we use a simple yum command.

[root@host ~]# yum install nmap

The output of that command will look similar to this.

Loaded plugins: 
fastestmirror, priorities Loading mirror speeds from cached hostfile * base: mirror.umd.edu * extras: mirror.wdc1.us.leaseweb.net * 
updates: mirrors.usinternet.com 
Resolving Dependencies --> 
Running transaction check ---> Package nmap.x86_64 2:6.40-19.el7 will be installed --> 
Processing Dependency: nmap-ncat = 2:6.40-19.el7 for package: 2:nmap-6.40-19.el7.x86_64 --> 
Processing Dependency: libpcap.so.1()(64bit) for package: 2:nmap-6.40-19.el7.x86_64 --> Running transaction check ---> Package libpcap.x86_64 14:1.5.3-11.el7 will be installed ---> Package nmap-ncat.x86_64 2:6.40-19.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved 
=================================================== 
Package Arch Version Repository Size 
=================================================== 
Installing: nmap x86_64 2:6.40-19.el7 base 3.9 M Installing for dependencies: libpcap x86_64 14:1.5.3-11.el7 base 138 k nmap-ncat x86_64 2:6.40-19.el7 base 206 k Transaction Summary 
=================================================== 
Install 1 Package (+2 Dependent packages) Total download size: 4.3 M Installed size: 17 M Is this ok [y/d/N]: y 

Downloading packages: 
(1/3): libpcap-1.5.3-11.el7.x86_64.rpm | 138 kB 00:00:00 
(2/3): nmap-ncat-6.40-19.el7.x86_64.rpm | 206 kB 00:00:00 
(3/3): nmap-6.40-19.el7.x86_64.rpm | 3.9 MB 00:00:00 
-------------------------------------------------------------------------- Total 6.9 MB/s | 4.3 MB 00:00:00 
Running transaction check 
Running transaction test Transaction test succeeded 
Running transaction Installing : 
  14:libpcap-1.5.3-11.el7.x86_64 
1/3 Installing : 2:nmap-ncat-6.40-19.el7.x86_64 
2/3 Installing : 2:nmap-6.40-19.el7.x86_64 
3/3 Verifying : 2:nmap-ncat-6.40-19.el7.x86_64 
1/3 Verifying : 14:libpcap-1.5.3-11.el7.x86_64 
2/3 Verifying : 2:nmap-6.40-19.el7.x86_64 
3/3 Installed: nmap.x86_64 2:6.40-19.el7 
Dependency Installed: 
libpcap.x86_64 14:1.5.3-11.el7 
nmap-ncat.x86_64 2:6.40-19.el7

Nmap is now installed and ready for use, so let’s begin with some basics.

Basic Nmap Commands

The most basic nmap command is with an IP address. For example:

[root@host ~]# nmap 8.8.8.8

And you will get output similar to this:

Starting Nmap 6.40 ( http://nmap.org ) at 2020-04-06 14:21 EDT Nmap scan report for dns.google (8.8.8.8) 
Host is up (0.023s latency). 
Not shown: 998 filtered ports 
PORT STATE SERVICE 53/tcp open domain 443/tcp open https 
Nmap done: 1 IP address (1 host up) scanned in 5.03 seconds

Using this command, we scanned Google’s DNS resolvers, and as you can see, the output provides various info such as what is actually scanned, which ports are open, what services are listening on them, and how long scan took. The same command can be used for our server.

[root@host ~]# nmap localhost

Nmap

This output will provide us the same information, but only for our server. This is one of the quickest ways to find out which ports are opened on your server and which services are using those ports.

#centos #network #port state #sql #nmap #neural networks

Using Nmap: Pro Tips and Tricks
1.45 GEEK