Linux checks all ports open to the outside world

Linux checks all ports open to the outside world

Centos 8 view all ports open to the outside world
查看防火墙对对应的端口是否已开启
firewall-cmd --list-all

way 1

The port used by the known service to see if the service is listening

netstat -anlp | grep 3306

way two

Query the ports that all services listen on

Install the nmap tool to detect open ports

1. Download the installation package

http://nmap.org/dist/nmap-7.01.tar.bz2

2. Unzip

tar -xvf nmap-7.01.tar.bz2 

3. Enter the directory to execute

cd /nmap-7.12
./configure

若报错“configure: error: no acceptable C compiler found in $PATH”,
说明未安装gcc,gcc安装命令为#yum install gcc. 
执行#make 若报错“-bash: make: command not found”,
则执行#yum install g++或#yum install gcc-c++安装gcc。 

4、make

5、make install

6. Check whether the installation is successful

nmap -v

insert image description here

After installing the nmap tool, you can use the tool to query the port that is open to the outside world and listen to the service

implement:nmap 127.0.0.1

Starting Nmap 7.01 ( https://nmap.org ) at 2022-10-10 17:39 CST
Warning: File ./nmap-services exists, but Nmap is using /usr/local/bin/../share/nmap/nmap-services for security and consistency reasons.  set NMAPDIR=. to give priority to files in your local directory (may affect the other data files too).
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000010s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http

Guess you like

Origin blog.csdn.net/Tomcat_king/article/details/127248991