首先下载数据包分析软件WINDUMP(下载地址:http://windump.polito.it)。在A计算机上,安装之,然后连接到将要镜像的RJ45端口上。再在B计算机上,也安装WINDUMP,并连接到当前的VLAN1(网关:222.222.222.1,掩码:255.255.255.0)中。
一切准备就绪后,接着就是开始端口镜像。使用计算机B登录到路由器,进入配置模式,输入以下命令:
SSR(config)# port mirroring dst-ports et.1.3 src-ports gi.4.1
上面的命令把上联端口(gi.4.1)镜像到目标端口(et.1.3),目标端口就是计算机A连接的端口。在计算机A上,进入DOS提示符,转到WINDUMP所在的目录,输入命令:
C:\> WINDUMP –N
windump30alpha: listening on \Device\NPF_{911DB410-C01E-49E8-B524-50132C6A56A8}
………
15:57:17.516203 IP 222.222.222.17.80 > 221.215.142.50.1264:
. 46721:48181(1460) ack 0 win 16336 (DF)
15:57:17.516337 IP 222.222.222.17.80 > 221.215.142.50.1264:
. 48181:49641(1460) ack 0 win 16336 (DF)
15:57:17.518043 IP 220.198.22.202.3196 > 222.222.222.99.8882:
. 137236:138676(1440) ack 260501 win 64800 (DF)
15:57:17.518162 IP 218.79.246.212.64627 > 222.222.222.191.16881:
S 2898301189:2898301189(0) win 64240 (DF)
15:57:17.518558 IP 209.24.79.200> 218.79.246.212: icmp 36:
host 222.222.222.191 unreachable (DF)
………..
(上面的记录已做过筛选。第一句的参数“-N”表示IP地址或者端口号转换为主机名或端口名,第二句表示windump开始在所选网卡上监听,第三句开始就是WINDUMP记录的信息。)
同样在计算机B上也运行WINDUMP:
C:\> WINDUMP –N
windump30alpha: listening on \Device\NPF_{911DB410-C01E-49E8-B524-50132C6A56B4}
…………
15:57:54.695935 arp who-has 222.222.222.191 tell 222.222.222.1
15:57:55.191475 arp who-has 222.222.222.136 tell 222.222.222.1
15:57:57.033354 arp who-has 222.222.222.210 tell 222.222.222.1
15:57:57.039057 arp who-has 222.222.222.69 tell 222.222.222.1
…………(已作筛选)
查看路由器上的日志,我任意找到其中一条关于ICMP的记录:
Jul 09 15:51:50 %ACL_LOG-I-PERMIT, ACL [out]
on "uplink" ICMP 210.29.42.70 -> 218.79.246.212