nmap (Network Mapper) is a free and open source utility. Here, we will use it to see the ports open on your Centos server.
Install nmap on centos server
yum install nmap
To check if nmap installed:
nmap localhost
To check nmap version
# nmap --version
Scan For Unused IP Address
# nmap -T4 -sP 192.168.0.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
Get Info About Remote Host Ports And OS Detection
# nmap -sS -P0 -sV -O 192.168.1.1
Get List of Servers With A Specific Port Open (change -p value to your desire)
# nmap -sT -p 80 -oG - 192.168.0.* | grep open
Scan Network for Rogue APs
# nmap -A -p1-85,113,443,8080-8100 -T4 --min-hostgroup 50 --max-rtt-timeout 2000 --initial-rtt-timeout 300 --max-retries 3 --host-timeout 20m --max-scan-delay 1000 -oA wapscan 192.168.1.1/8
Find All Active IP Addresses In A Network
# nmap -sP 192.168.0.*
Use A Decoy IP While Scanning Ports
# sudo nmap -sS targetIP -D fakeIP
Check how Many Linux And Windows Devices On Your Network
# sudo nmap -F -O 192.168.0.1-255 | grep "Running: " > /tmp/os; echo "$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo "$(cat /tmp/os | grep Windows | wc -l) Window(s) devices"
UDP Scanning
# sudo nmap -sU -P0 -T Aggressive -F targetIP
To scan a range of IP addresses
# nmap 192.168.1.1-50
To scan an entire subnet
# nmap 192.168.1.0/24
Ping only scan
# nmap -sP 192.168.1.1
TCP SYN scan
# nmap -sS 192.168.1.1
UDP scan
# nmap -sU 192.168.1.1
IP protocol scan
# nmap -sO 192.168.1.1
Scan port 80, 25, 443, and 110
# nmap -p 80,25,443,110 192.168.1.1
Scan port ranges 1024-2048
# nmap -p 1024-2048 192.168.1.1
Operating system detection
# nmap -O --osscan-guess 192.168.1.1