跳转至

网络连通性检查

nc

语法

nc -zv <ip> <port>

例子

1
2
3
4
5
$ nc -zv 127.0.0.1 80
Connection to 127.0.0.1 80 port [tcp/http] succeeded!

$ nc -zv 127.0.0.1 90
nc: connect to 127.0.0.1 port 90 (tcp) failed: Connection refused

telnet

语法

telnet <ip> <port>

例子

1
2
3
4
5
6
7
8
9
$ telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
^CConnection closed by foreign host.

$ telnet 127.0.0.1 90
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
作者: aisuhua