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
相关推荐
FPGA小徐6 小时前
PA1 基础设施(2)深度解析:NEMU 中 ITRACE、MTRACE、FTRACE、IRINGBUF、ETRACE、DIFFTEST 全解析
java·服务器·网络
Zelman9 小时前
TCP 协议
网络协议·tcp/ip
life码农11 小时前
Nginx 配置允许指定 IP 段访问:从 192.168.1.1 到 192.168.1.124 及 /24 详解
网络·tcp/ip·nginx
javaDocker11 小时前
16.5 小时,我打掉了两只「SSL 握手失败」的怪
网络·网络协议·ssl
蜗牛互联网12 小时前
Python接入Gemini 3.8 Flash实现票据视觉抽取与规则校验
java·javascript·网络·人工智能·python
我就是不信12 小时前
TCP 原理详解:从三次握手到拥塞控制
网络·网络协议·tcp/ip
木白CPP12 小时前
USB(一): USB 概述&&介绍
linux·网络·嵌入式硬件
可乐鸡翅yeah_13 小时前
AES‑128 加密 M3U8,IV 初始化向量新手容易踩坑
前端·网络·数据库·ffmpeg·音视频·m3u8在线
HEJOO913 小时前
指针与结构体:C 语言进阶核心详解
c语言·开发语言·网络
en.en..13 小时前
IO 多路复用:select、poll、epoll 核心函数解析
网络