#首先截获一个DHCP包,注意,没有加-s0参数
root@S71[1]~15:28:04
# tcpdump -e -i eth0 -nn port 67 -c 1 -w yfang.cap
#接下来replay这个包,不做任何修改,这里只用了两个参数 -i eth0不解释了,-l 3表示连续发这个包3次,其实测试的话,发一次也OK
root@S71[1]~15:28:14
# tcpreplay -i eth0 -l 3 yfang.cap
sending out eth0 processing file: yfang.cap processing file: yfang.cap processing file: yfang.cap Actual: 3 packets (288 bytes) sent in 0.23 seconds Rated: 12007.5 bps, 0.09 Mbps/sec, 125.08 pps Statistics for network device: eth0 Attempted packets: 3 Successful packets: 3 Failed packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0
# 花开两支,在刚才那个命令执行之前,先在另一台服务器S172上(其实同一台也OK,为的是表明局域网其他机器可以看到包)监听包 [root@S172 ~]
# tcpdump -i eth0 port 67 -c 10
tcpdump: verbose output suppressed, use -v or -vv for
# 我们注意到后面三行,三个奇怪的包,被truncate过了,这一点使用wireshark打开cap文件查看包的信息会看到下面这样的警告
# [Packet size limited during capture: BOOTP/DHCP truncated]
# 经过检查发现是-s参数的作用,加上-s0参数就好了