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
相关推荐
开开心心就好8 小时前
提升办公效率的PDF转图片实用工具
运维·服务器·网络·python·智能手机·pdf·ocr
小妖6668 小时前
express 怎么搭建 WebSocket 服务器
websocket·网络协议·express
JAVA学习通9 小时前
[javaEE]网络编程
运维·服务器·网络
钢铁男儿10 小时前
Python 函数装饰器和闭包(闭包)
java·网络·python
alden_ygq10 小时前
/etc/kdump.conf 配置详解
服务器·网络·php
卡戎-caryon10 小时前
【项目实践】boost 搜索引擎
linux·前端·网络·搜索引擎·boost·jieba·cpp-http
JANYI201811 小时前
Linux 常用指令详解
linux·c语言·网络
安生生申12 小时前
MQTT 协议与 HTTP 协议的区别
网络·网络协议·http
计算机毕设定制辅导-无忧学长14 小时前
ActiveMQ 性能优化与网络配置实战(一)
网络·性能优化·activemq
安全方案15 小时前
2025信息安全网络安全意识培训资料汇编(24份)
网络·安全·web安全