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
相关推荐
皮皮学姐分享-ppx3 小时前
政府绿色采购数据库(2015-2024.3)
大数据·网络·数据库·人工智能·制造
W_chuanqi3 小时前
联想M7615DNA网络打印方法
网络·联想·打印机网络连接
HavenlonLabs6 小时前
硬件 + SaaS 产品的工程化路径:从系统架构、PCB 设计到工程样机
网络·安全·架构·系统架构·安全架构
sweet丶9 小时前
MQTT消息通道-基础篇
网络协议
yychen_java10 小时前
当算法成为武器:AI泛滥时代的多维危机透视与治理路径
网络·人工智能·ai
漫途科技10 小时前
精准盯防危房隐患,智守人居安全|MTB46-4-2A 4G数据采集终端专项应用方案
网络·安全
Misnearch11 小时前
抓包Packet Capture
网络·抓包
zhangfeng113311 小时前
ps aux讲解,结合国家超算中心 hpc apptainer
linux·服务器·网络
吠品12 小时前
一次 Nginx 报错 unexpected end of file 的排查记录
网络协议·https·ssl
代码中介商12 小时前
TLS握手全解析:从1.2到1.3的加密演进
网络·网络协议·http