怎么在Linux服务器上测试TCP/UDP端口的连通性
2017-02-17 17:48
417 查看
翻译自:
How to Test Port[TCP/UDP] Connectivity from a Linux Server (文档 ID 2212626.1)
适用于:
Linux OS - Version Oracle Linux 5.0 to Oracle Linux 6.8 [Release OL5 to
OL6U8]
Information in this document applies to any platform.
目标:
在Linux服务器上检查TCP/UDP端口的连通性。
解决方案:
telnet和nc 是用来测试端口连通性的一般工具。
telnet可以测试tcp端口的连通性。
nc可以测试tcp和udp端口的连通性。
请确保telnet和nc工具已经安装
[html] view
plain copy
# yum install nc
# yum install telnet
测试tcp端口的连通性:
语法如下:
[html] view
plain copy
telnet <hostname/IP address> <port number>
如下是连通成功的例子:
[html] view
plain copy
# telnet 192.118.20.95 22
Trying 192.118.20.95...
Connected to 192.118.20.95.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
Protocol mismatch.
Connection closed by foreign host.
如下是连通不成功的例子:
[html] view
plain copy
# telnet 192.118.20.95 22
Trying 192.118.20.95...
telnet: connect to address 192.118.20.95: No route to host
使用nc命令来测试tcp端口的连通性:
语法:
[html] view
plain copy
nc -z -v <hostname/IP address> <port number>
如下是连通成功的例子:
[html] view
plain copy
# nc -z -v 192.118.20.95 22
Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!
如下是连通不成功的例子:
[html] view
plain copy
# nc -z -v 192.118.20.95 22
nc: connect to 192.118.20.95 port 22 (tcp) failed: No route to host
使用nc命令来测试udp端口的连通性:
语法:
[html] view
plain copy
nc -z -v -u <hostname/IP address> <port number>
[html] view
plain copy
# nc -z -v -u 192.118.20.95 123
Connection to 192.118.20.95 123 port [udp/ntp] succeeded!
nc检测端口的用法
nc -z -w 10 %IP% %PORT%
-z表示检测或者扫描端口
-w表示超时时间
-u表示使用UDP协议
How to Test Port[TCP/UDP] Connectivity from a Linux Server (文档 ID 2212626.1)
适用于:
Linux OS - Version Oracle Linux 5.0 to Oracle Linux 6.8 [Release OL5 to
OL6U8]
Information in this document applies to any platform.
目标:
在Linux服务器上检查TCP/UDP端口的连通性。
解决方案:
telnet和nc 是用来测试端口连通性的一般工具。
telnet可以测试tcp端口的连通性。
nc可以测试tcp和udp端口的连通性。
请确保telnet和nc工具已经安装
[html] view
plain copy
# yum install nc
# yum install telnet
测试tcp端口的连通性:
语法如下:
[html] view
plain copy
telnet <hostname/IP address> <port number>
如下是连通成功的例子:
[html] view
plain copy
# telnet 192.118.20.95 22
Trying 192.118.20.95...
Connected to 192.118.20.95.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
Protocol mismatch.
Connection closed by foreign host.
如下是连通不成功的例子:
[html] view
plain copy
# telnet 192.118.20.95 22
Trying 192.118.20.95...
telnet: connect to address 192.118.20.95: No route to host
使用nc命令来测试tcp端口的连通性:
语法:
[html] view
plain copy
nc -z -v <hostname/IP address> <port number>
如下是连通成功的例子:
[html] view
plain copy
# nc -z -v 192.118.20.95 22
Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!
如下是连通不成功的例子:
[html] view
plain copy
# nc -z -v 192.118.20.95 22
nc: connect to 192.118.20.95 port 22 (tcp) failed: No route to host
使用nc命令来测试udp端口的连通性:
语法:
[html] view
plain copy
nc -z -v -u <hostname/IP address> <port number>
[html] view
plain copy
# nc -z -v -u 192.118.20.95 123
Connection to 192.118.20.95 123 port [udp/ntp] succeeded!
nc检测端口的用法
nc -z -w 10 %IP% %PORT%
-z表示检测或者扫描端口
-w表示超时时间
-u表示使用UDP协议
相关文章推荐
- 怎么在Linux服务器上测试TCP/UDP端口的连通性?
- 在Linux服务器上检查TCP/UDP端口的连通性
- [na][tools]tcp/udp连通性测试
- 测试TCP和UDP端口的方法
- 小白日记10:kali渗透测试之端口扫描-UDP、TCP、僵尸扫描、隐蔽扫描
- Linux系统下怎么测试端口的连通性
- 怎样测试TCP&UDP端口
- 如何测试UDP端口连通性
- 转载一个很经典的--C# Socket TCP和UDP报文及端口测试工具的开发(提供源码)
- 常见的tcp udp端口的信息列表
- TCP、UDP绑定同一端口通信的解释
- Netstat用于显示与IP、TCP、UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况
- 获取tcp/udp端口对应的进程pid
- LWIP netconn TCP UDP测试 实例
- 常见TCP/UDP端口
- 常见TCP/UDP端口收录大全
- TCP/UDP/IP常用端口
- TCP和UDP的端口