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
相关推荐
GilgameshJSS14 小时前
【学习K230-例程21】GT6700-UDP-Client
网络·python·单片机·网络协议·学习·udp
不知名的前端专家15 小时前
uniapp原生插件 TCP Socket 使用文档
网络·tcp/ip·uni-app·netty
波波烤鸭15 小时前
Netty 实战应用:从 RPC 到即时通讯,再到 WebSocket
websocket·网络协议·rpc
linux修理工15 小时前
解决 N1 ARMBIAN Prometheus 服务启动失败问题
网络
土星碎冰机16 小时前
数据库开启ssl
数据库·网络协议·ssl
weixin_5078479516 小时前
Nginx SSL/TLS 配置
网络·nginx·ssl
Leo来编程16 小时前
七层网络协议-面试
网络·网络协议·面试
北极光SD-WAN组网16 小时前
某光伏电力监控系统网络安全监测项目:智能组网技术优化方案实践
大数据·网络·分布式
新鲜萝卜皮18 小时前
你知道TCP的半连接队列和全连接队列吗?
网络协议
wanhengidc18 小时前
服务器内存不足会造成哪些影响?
运维·服务器·网络·游戏·智能手机