Linux查看所有对外开放的端口
Centos 8查看所有对外开放的端口
查看防火墙对对应的端口是否已开启
firewall-cmd --list-all
方式1
已知服务使用的端口,查看服务是否在监听
netstat -anlp | grep 3306
方式二
查询所有服务监听的端口
安装 nmap工具检测开放端口
1、下载安装包
http://nmap.org/dist/nmap-7.01.tar.bz2
2、解压
tar -xvf nmap-7.01.tar.bz2
3、进入目录执行
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、查看是否安装成功
nmap -v
文章来源:https://www.toymoban.com/news/detail-527238.html
安装nmap工具之后,可以通过工具查询对外开放,并在监听服务的端口
执行:nmap 127.0.0.1
文章来源地址https://www.toymoban.com/news/detail-527238.html
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
到了这里,关于Linux查看所有对外开放的端口的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!