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
相关推荐
北极光SD-WAN组网2 小时前
从0到1搭建某铝箔智慧工厂网络:5G与WiFi 6助力智能制造
网络·5g·制造
阿昭L3 小时前
HTTP原理
网络·网络协议·http
hazy1k3 小时前
STM32H750 RTC介绍及应用
网络·stm32·实时音视频
没书读了4 小时前
考研复习-计算机网络-第三章-数据链路层
网络·计算机网络·考研
zhao3266857514 小时前
2025年代理IP三强横评:LoongProxy、神龙海外动态IP代理、全民HTTP怎么选?看完这篇不踩坑
网络协议·tcp/ip·http
on the way 1234 小时前
多线程之HardCodedTarget(type=OssFileClient, name=file, url=http://file)异常
网络·网络协议·http
WhoisXMLAPI4 小时前
WhoisXML API再次荣登2025年美国Inc. 5000快速成长企业榜单
网络·安全
阿sir1985 小时前
ZYNQ 自定义IP
服务器·网络·tcp/ip
星马梦缘6 小时前
计算机网络4 第四章 网络层——网络间的通信问题(省际之间如何规划信件运输路线)
网络·计算机网络·路由·ip地址·子网掩码·icmp·ipv4/ipv6
hsjkdhs7 小时前
万字详解网络编程之socket
网络·tcp/ip·udp·socket