平常测试当前主机到远程端口连通性使用telnet命令


# 端口开放返回
❯ telnet 152.136.21.101 80
Trying 152.136.21.101...
Connected to 152.136.21.101.
Escape character is '^]'.
^CConnection closed by foreign host.

# 未连通状态
❯ telnet 152.136.21.101 801
Trying 152.136.21.101...
telnet: connect to address 152.136.21.101: Connection refused

由于未知原因telnet没有安装,还有其他命令也可以测试

wget

# 端口开放返回
❯ wget 152.136.21.101:80
--2021-04-20 15:50:50--  http://152.136.21.101/
Connecting to 152.136.21.101:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://16yang.cn/ [following]
--2021-04-20 15:50:50--  https://16yang.cn/
Resolving 16yang.cn (16yang.cn)... 152.136.21.101
Connecting to 16yang.cn (16yang.cn)|152.136.21.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
# 端口未开放
❯ wget 152.136.21.101:801
--2021-04-20 15:56:39--  http://152.136.21.101:801/
Connecting to 152.136.21.101:801... failed: Connection refused.

ssh

# 端口开放返回
❯ ssh -v -p 80 152.136.21.101
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 152.136.21.101 [152.136.21.101] port 80.
debug1: Connection established.

# 端口未开放返回
❯ ssh -v -p 801 152.136.21.101
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 152.136.21.101 [152.136.21.101] port 801.
debug1: connect to address 152.136.21.101 port 801: Connection refused
ssh: connect to host 152.136.21.101 port 801: Connection refused

curl

# 端口开放返回
❯ curl 152.136.21.101:22
SSH-2.0-OpenSSH_7.4
curl: (56) Recv failure: Connection reset by peer
# 端口未开放返回
❯ curl 152.136.21.101:222
curl: (7) Failed connect to 152.136.21.101:222; Connection refused

nc


❯ nc -vv 152.136.21.101 80
Ncat: Version 7.50 ( https://nmap.org/ncat )
NCAT DEBUG: Using system default trusted CA certificates and those in /usr/share/ncat/ca-bundle.crt.
NCAT DEBUG: Unable to load trusted CA certificates from /usr/share/ncat/ca-bundle.crt: error:02001002:system library:fopen:No such file or directory
libnsock nsi_new2(): nsi_new (IOD #1)
libnsock nsock_connect_tcp(): TCP connection requested to 152.136.21.101:80 (IOD #1) EID 8
libnsock nsock_trace_handler_callback(): Callback: CONNECT SUCCESS for EID 8 [152.136.21.101:80]
Ncat: Connected to 152.136.21.101:80.
libnsock nsi_new2(): nsi_new (IOD #2)
libnsock nsock_read(): Read request from IOD #1 [152.136.21.101:80] (timeout: -1ms) EID 18
libnsock nsock_readbytes(): Read request for 0 bytes from IOD #2 [peer unspecified] EID 26
^C


❯ nc -vv 152.136.21.101 801
Ncat: Version 7.50 ( https://nmap.org/ncat )
NCAT DEBUG: Using system default trusted CA certificates and those in /usr/share/ncat/ca-bundle.crt.
NCAT DEBUG: Unable to load trusted CA certificates from /usr/share/ncat/ca-bundle.crt: error:02001002:system library:fopen:No such file or directory
libnsock nsi_new2(): nsi_new (IOD #1)
libnsock nsock_connect_tcp(): TCP connection requested to 152.136.21.101:801 (IOD #1) EID 8
libnsock nsock_trace_handler_callback(): Callback: CONNECT ERROR [Connection refused (111)] for EID 8 [152.136.21.101:801]
Ncat: Connection refused.

nmap


❯ nmap 152.136.21.101 -p 80

Starting Nmap 6.40 ( http://nmap.org ) at 2021-04-20 16:46 CST
Nmap scan report for 152.136.21.101
Host is up (0.0056s latency).
PORT   STATE    SERVICE
80/tcp filtered http

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

我再魔法世界开创互联网时代

人们会把出生时就看到的东西当作理所当然,世界本貌。
会把年轻时出现的东西,认作时代进步,勉强跟进;
当年老体衰,气力不济,学习能力大减之时,再出现新的东西,就会认为是离经叛道,无法容忍。