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
相关推荐
dog25018 分钟前
网络可用性,扩展性,性能的统计本质
网络
嵌入式-老费40 分钟前
esp32开发与应用(再谈wifi的使用)
网络·智能路由器
米丘42 分钟前
HTTP/3 传输层 QUIC 协议
网络协议·http3
YJlio44 分钟前
《Sysinternals实战指南》16.5 Ctrl2Cap 工具详解:把 Caps Lock 变成 Ctrl 的键盘改造与回退方法
linux·运维·服务器·网络·python·学习·计算机外设
wangxixi5221 小时前
OTN 以太网业务接入全流程详解
网络
带土11 小时前
5. 网络体系架构与WireShark简单使用
网络·测试工具·wireshark
liulilittle2 小时前
拥塞控制:排水终止的两种决策:OR 与 AND
网络·tcp/ip·计算机网络·算法·信息与通信·tcp·通信
行走__Wz2 小时前
【网工入门-03】认识常见网络设备——交换机、路由器、防火墙、无线设备
网络·智能路由器
申通之声2 小时前
以体验和AI重构竞争力,申通要“构建生态共同体”
大数据·网络·人工智能·重构·交通物流
Eloudy2 小时前
ns-3 在数据中心网络仿真
网络·人工智能·量子计算