Telnet 测试 UDP 端口?

Telnet 并不支持 UDP 端口的测试,可以使用 nc 命令来进行测试。nc 命令两种都支持:

TCP

bash 复制代码
# nc -z -v -u [hostname/IP address] [port number] 

 

# nc -z -v 192.168.10.12 22 

Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!

UDP

bash 复制代码
# nc -z -v [hostname/IP address] [port number] 

 

# nc -z -v -u 192.168.10.12 123 

Connection to 192.118.20.95 123 port [udp/ntp] succeeded!

下面是一些 nc 的简单用例:

bash 复制代码
  - Start a listener on the specified TCP port and send a file into it:
    nc -l -p port < filename

  - Connect to a target listener on the specified port and receive a file from it:
    nc host port > received_filename

  - Scan the open TCP ports of a specified host:
    nc -v -z -w timeout_in_seconds host start_port-end_port

  - Start a listener on the specified TCP port and provide your local shell access to the connected party (this is dangerous and can be abused):
    nc -l -p port -e shell_executable

  - Connect to a target listener and provide your local shell access to the remote party (this is dangerous and can be abused):
    nc host port -e shell_executable

  - Act as a proxy and forward data from a local TCP port to the given remote host:
    nc -l -p local_port | nc host remote_port

  - Send an HTTP GET request:
    echo -e "GET / HTTP/1.1\nHost: host\n\n" | nc host 80
相关推荐
小武~2 分钟前
嵌入式网络编程深度优化 --网络协议栈配置实战指南
linux·网络·网络协议
kblj555524 分钟前
学习Linux——网络——网卡
linux·网络·学习
沧澜sincerely2 小时前
互联网的路由选择协议
网络·tcp/ip·智能路由器
qq_5470261792 小时前
微服务 - 网关统一鉴权
运维·网络·微服务
拾忆,想起2 小时前
TCP粘包拆包全解析:数据流中的“藕断丝连”与“一刀两断”
java·网络·数据库·网络协议·tcp/ip·哈希算法
网安小白的进阶之路3 小时前
A模块 系统与网络安全 第四门课 弹性交换网络-4
网络·web安全·php
七夜zippoe3 小时前
高性能网络编程实战:用Tokio构建自定义协议服务器
linux·服务器·网络·rust·tokio
wsx_iot4 小时前
TCP/IP 五层协议栈
网络·网络协议·tcp/ip
午安~婉4 小时前
浏览器与网络
前端·javascript·网络·http·浏览器
0和1的舞者7 小时前
网络通信的奥秘:网络层ip与路由详解(四)
大数据·网络·计算机网络·计算机·智能路由器·计算机科学与技术