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
相关推荐
2501_916013742 分钟前
用Fiddler中文版抓包工具掌控微服务架构中的接口调试:联合Postman与Charles的高效实践
websocket·网络协议·tcp/ip·http·网络安全·https·udp
xkroy1 小时前
网络协议概念与应用层
网络
筏.k2 小时前
C++ 网络编程(14) asio多线程模型IOThreadPool
网络·c++·架构
00后程序员张2 小时前
调试 WebView 接口时间戳签名问题:一次精细化排查和修复过程
websocket·网络协议·tcp/ip·http·网络安全·https·udp
门思科技2 小时前
设计可靠 LoRaWAN 设备时需要考虑的关键能力
运维·服务器·网络·嵌入式硬件·物联网
小锋学长生活大爆炸2 小时前
【知识】RPC和gRPC
服务器·网络协议·rpc
小高不会迪斯科2 小时前
MIT 6.824学习心得(2) 浅谈多线程和RPC
网络·网络协议·rpc
前端小巷子2 小时前
跨域问题解决方案:CORS(跨域资源共享)
前端·网络协议·面试
清醒的兰3 小时前
Qt 基于TCP套接字编程
网络·qt·tcp
程序猿追4 小时前
免费版安全性缩水?ToDesk、TeamViewer、向日葵、网易UU远程访问&隐私防护测评
服务器·网络·科技·teamviewer