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
相关推荐
Henry Zhu1231 天前
VPP中ACL实战配置指南与VPP的API使用初探
运维·服务器·网络·计算机网络·云原生
派大鑫wink1 天前
网络工程师入门学习第二篇:TCP/IP协议与路由协议深入
网络·学习·tcp/ip
GTgiantech1 天前
专业指南:SFP光模块使用与维护的最佳实践
网络
Evan芙1 天前
使用inotify + rsync和sersync实现文件的同步,并且总结两种方式的优缺点
java·服务器·网络
AI浩1 天前
SemOD:基于语义增强的多天气条件目标检测网络
网络·人工智能·目标检测
QT 小鲜肉1 天前
【孙子兵法之终篇】《孙子兵法》真人阅读、朗读、讲解的视频链接
网络·笔记·音视频·读书·孙子兵法
testpassportcn1 天前
CompTIA A+ 220-1201 認證介紹|最新版本 A+ Core 1 220-1201 考試完整指南
网络·学习·改行学it
北京耐用通信1 天前
调试复杂、适配难?耐达讯自动化Ethercat转Devicenet让继电器通讯少走弯路
人工智能·物联网·网络协议·自动化·信息与通信
不染尘.1 天前
超网和路由概述
网络·计算机网络
2501_938810111 天前
共享IP的弊端
服务器·网络·tcp/ip