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
相关推荐
网络研究院43 分钟前
将黑客拒之物联网网络之外的竞赛
网络·物联网·5g·安全·趋势
小白爱电脑1 小时前
Wireshark专家模式定位网络故障:14种TCP异常深度解剖
网络·tcp/ip·wireshark
fulangxisikexi3 小时前
bgp笔记
服务器·网络·笔记
coding随想3 小时前
网络层的“四骑士”:深入浅出IP、ICMP、ARP、RARP协议
后端·网络协议
星哥说事4 小时前
腾讯云iOA:全面提升企业办公安全与效率的智能解决方案
网络·安全·腾讯云
武晓兵4 小时前
Ethernet, WiFi, Cellular, BLE, LoRa 分别解释
网络
哈基米喜欢哈哈哈5 小时前
Cookies和Sessions
网络·后端·计算机网络
wanhengidc6 小时前
云手机网速和本机网速的关系
网络·智能手机
猫头虎7 小时前
如何实现在多跳UDP传输场景,保证单文件和多文件完整传输的成功率?
java·开发语言·网络·python·网络协议·golang·udp
期待未来的男孩8 小时前
Cisco IOS Classic Firewall
网络·安全