tcpdump 抓取 udp 报文 以及 nc 测试 udp 端口是否打开
1. 测试 UDP 端口是否打开
# nc -vuz 172.19.89.74 123 Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to 172.19.89.74:123. Ncat: UDP packet sent successfully Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.
2. 抓取 UDP 报文
2.1 向 172.19.89.74 的 123 端口发送 udp 测试数据
# echo "Hello World\!" | nc -4u 172.19.89.74 123
2.2 可以在 172.19.89.74 上用 tcpdump 观察
# tcpdump -i eth0 -nn -vv -X udp port 123 tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes 15:06:12.662981 IP (tos 0x0, ttl 64, id 51424, offset 0, flags [DF], proto UDP (17), length 42) 172.19.89.71.48678 > 172.19.89.74.123: [udp sum ok] NTPv1, length 14 unspecified, Leap indicator: +1s (64), Stratum 101 (reserved), poll 108 (4096s), precision 108 Root Delay: 28448.341537, Root dispersion: 29292.392028 [|ntp] 0x0000: 4500 002a c8e0 4000 4011 672a ac13 5947 E..*..@.@.g*..YG 0x0010: ac13 594a be26 007b 0016 c333 4865 6c6c ..YJ.&.{...3Hell 0x0020: 6f20 576f 726c 645c 210a o.World\!.
0顶
0 踩
共 0 条评论