linux 网络检测常用命令(tcp/udp 端口检测)

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
失败:
Trying 10.32.2.231…
telnet: connect to address 10.32.2.231: Connection refused
成功:
[dev@kf-dev-node-004 ~]$ nc -vuz 10.32.2.232 5060
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 10.32.2.232:5060.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.
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@[email protected]….
0x0010: 0a20 02e7 bfc2 13d8 0014 41cc e280 9c68 ……….A….h
0x0020: 656c 6c6f e280 9d0a ello….

猜你喜欢

转载自blog.csdn.net/pku1254/article/details/81137281