linux查看端口

天涯浪子 提交于 2020-03-25 09:58:43

如果你有权限操作:

ss  netstat  lsof  fuser  nmap  

如果没有权限的话:

nmap  nc  ssh  telnet

nmap  -sV -p 22  192.168.1.1

# nmap  -sS -p 8080  localhost

Starting Nmap 6.40 ( http://nmap.org ) at 2020-03-24 04:14 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00016s latency).
Other addresses for localhost (not scanned): 127.0.0.1
PORT     STATE SERVICE
8080/tcp open  http-proxy

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

 

nc -v -w 1 10.4.7.100 3306

# nc -v -w 1 10.4.7.100 3306
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 10.4.7.100:3306.
J
5.7.27螆35ÿ냿Vkd'}e}mysql_native_password# nc -v -w 1 10.4.7.100 8080Ncat: Version 7.50 ( https://nmap.org/ncat )Ncat: Connected to 10.4.7.100:8080.
^C#端口不存活会直接拒绝[root@localhost ~]# nc -v -w 1 10.4.7.100 8090Ncat: Version 7.50 ( https://nmap.org/ncat )Ncat: Connection refused.
 

 

ssh -v -p 8080 root@localhost

# ssh -v -p 8080 root@localhost
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to localhost [::1] port 8080.
debug1: connect to address ::1 port 8080: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 8080.
debug1: Connection established.

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!