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
相关推荐
酣大智15 分钟前
参考模型--物理层
网络
B2_Proxy1 小时前
IP 来源合规性,正在成为全球业务的隐性门槛
网络·爬虫·网络协议·安全
MMME~2 小时前
Ansible Playbook高效自动化实战指南
网络·自动化·ansible
数据安全科普王2 小时前
从 HTTP/1.1 到 HTTP/3:协议演进如何改变 Web 性能?
网络·其他
舰长1152 小时前
linux 实现文件共享的实现方式比较
linux·服务器·网络
学***54233 小时前
如何轻松避免网络负载过大
开发语言·网络·php
weixin_395448913 小时前
main.c_cursor_0129
前端·网络·算法
路由侠内网穿透.3 小时前
本地部署智能家居集成解决方案 ESPHome 并实现外部访问( Linux 版本)
linux·运维·服务器·网络协议·智能家居
CS创新实验室3 小时前
《计算机网络》深入学:路由算法与路径选择
网络·计算机网络·算法
吠品3 小时前
什么是 IP SSL 证书?该如何申请
网络协议·tcp/ip·ssl