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
相关推荐
潇凝子潇9 小时前
网络协议的零拷贝 和 操作系统的零拷贝异同
网络·网络协议
RTC老炮9 小时前
webrtc弱网-BitrateEstimator类源码分析与算法原理
网络·人工智能·算法·机器学习·webrtc
悟能不能悟9 小时前
用cmd命令修改适配器ip
网络·tcp/ip·github
Jul1en_9 小时前
HTTP初识(二)
网络·网络协议·http
小张课程11 小时前
网络安全威胁分析师(初级)
网络协议
我科绝伦(Huanhuan Zhou)12 小时前
Systemctl 与 Systemd 全面指南:Linux 系统服务管理详解
linux·服务器·网络
world-wide-wait12 小时前
python高级05——HTTP协议和静态服务器
网络·网络协议·http
止水编程 water_proof12 小时前
Java--网络编程(二)
java·开发语言·网络
Ankie Wan13 小时前
ARP: Address Resolution Protocol (ARP),IP转mac address
网络协议·tcp/ip·rfc·arp
沐浴露z13 小时前
【深入理解计算机网络10】UDP协议详解
网络·网络协议·计算机网络·udp