Linux下判断远程主机是否开放udp端口

使用nc命令(本例是判断远程主机是否开放syslog服务的udp 514端口)
[root@localhost etc]# nc -vuz 172.24.2.118 514
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 172.24.2.118:514.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.


nc命令用法:

usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
[-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
[-x proxy_address[:port]] [hostname] [port[s]]


详细用法参见 man nc

 

如果没有nc命令,用下面的语句安装

yum install -y nc

 

你可能感兴趣的:(#,RHEL/CentOS)