1,tcp 端口检测
telnet ip port
[dev@kf-dev-node-004 ~]$ telnet 10.32.2.231 5060
失败:
Trying 10.32.2.231…
telnet: connect to address 10.32.2.231: Connection refused
成功:
[dev@kf-dev-node-004 ~]$ telnet 10.32.2.232 5080
Trying 10.32.2.232…
Connected to 10.32.2.232.
2,udp 端口检测
nc -vuz 10.32.2.231 5060
如果没有请自行安装
sudo yum install nc
a机器上运行:
nc -ul 1080
或:
netcat -ul -p 1080
#使用udp模式监听1080 端口
b机器上运行:
nc -u x.x.x.x 1080
或:
netcat -u x.x.x.x 1080
#使用udp模式向该ip的1080端口发送信息。
失败的表现为:
nc -vuz x.x.x.x 16385
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to x.x.x.x:16385.
Ncat: Connection refused.
3,tcpdump发送抓包检测
sudo tcpdump -vvv -X udp port 6080
从另一个机器发包
echo “hello” | socat - udp4-datagram:10.32.2.231:5080
这边可以收到,证明没有问题:
sudo tcpdump -vvv -X udp port 5080
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:06:34.710707 IP (tos 0x0, ttl 64, id 52039, offset 0, flags [DF], proto UDP (17), length 40)
10.32.2.232.49090 > iZbp1c2a8ike46vqst3z81Z.onscreen: [udp sum ok] UDP, length 12
0x0000: 4500 0028 cb47 4000 4011 556f 0a20 02e8 E…(.G@.@.Uo…
0x0010: 0a20 02e7 bfc2 13d8 0014 41cc e280 9c68 …A…h
0x0020: 656c 6c6f e280 9d0a ello…
![1b1d8b0df4a5bef2dab6c08cf524931d.png](https://i-blog.csdnimg.cn/blog_migrate/028937c39f48dd5217ce2a97b3042dea.jpeg)