TCP端口测试简法

  1. telnet法
TCP端口开了
$ echo "" | telnet 123.1.2.3 8100
Trying 123.1.2.3...
Connected to 123.1.2.3.
Escape character is '^]'.
Connection closed by foreign host.

TCP端口关了
$ echo "" | telnet 123.1.2.3 8101
Trying 123.1.2.3...
telnet: connect to address 123.1.2.3: Connection refused

如果希望带源地址测试,可以

telnet -b source_ip destanation_ip port
  1. nc法
TCP端口开了
$ nc -nzv 123.1.2.3 7205       
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 123.1.2.3:7205.
Ncat: 0 bytes sent, 0 bytes received in 0.03 seconds.

TCP端口关了
$ nc -nzv 123.1.2.3 7206
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connection timed out.

如果希望带源地址测试,可以

nc -s source_ip -zv destanation_ip port
  1. nmap法
TCP端口开了
$ nmap -Pn -sT 123.1.2.3 -p 8100

Starting Nmap 6.40 ( http://nmap.org ) at 2019-09-29 12:12 CST
Nmap scan report for nothing.attdns.com (123.1.2.3)
Host is up (0.0067s latency).
PORT     STATE SERVICE
8100/tcp open  xprint-server

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

TCP端口关了
$ nmap -Pn -sT 123.1.2.3 -p 8101

Starting Nmap 6.40 ( http://nmap.org ) at 2019-09-29 12:12 CST
Nmap scan report for nothing.attdns.com (123.1.2.3)
Host is up.
PORT     STATE    SERVICE
8101/tcp filtered unknown

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

TCP端口开了啥
$ nmap -Pn -sT 123.1.2.3 -p 8000-8300

Starting Nmap 6.40 ( http://nmap.org ) at 2019-09-29 12:11 CST
Nmap scan report for nothing.attdns.com (123.1.2.3)
Host is up (0.0083s latency).
Not shown: 299 filtered ports
PORT     STATE SERVICE
8081/tcp open  blackice-icecap
8100/tcp open  xprint-server

Nmap done: 1 IP address (1 host up) scanned in 10.00 seconds
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值