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
相关推荐
无限码农40 分钟前
2.1 网络编程 异步网络库zvnet
服务器·网络·php
无风听海42 分钟前
深入解析 Python dotenv
网络·python·rpc
九硕智慧建筑一体化厂家42 分钟前
什么是楼宇自控?全面解析楼宇自控与楼宇自控系统的作用
大数据·运维·人工智能·网络协议·制造
Never_Satisfied1 小时前
通过certbot安装SSL证书
网络·网络协议·ssl
wanhengidc1 小时前
裸金属服务器与普通服务器的区别
运维·服务器·网络·游戏·智能手机
野犬寒鸦1 小时前
面试常问:TCP相关(中级篇)问题原因即解决方案
服务器·网络·后端·面试
M158227690552 小时前
SG-TCP-COE-210 Modbus TCP 转 CANOpen 网关:跨协议工业通信的无缝互联方案
网络·网络协议·tcp/ip
李恒-聆机智能专精数采2 小时前
从零开始了解数据采集技术篇(8)——为什么工业数据采集很难用“一站式平台”解决?从设备生态到系统架构的技术分析
运维·网络·数据库·数据分析·数据采集
米羊1212 小时前
威胁情报工具
网络·安全
荣仔灬2 小时前
什么是公共DNS地址?
网络