首先用console线登录到交换机的CLI命令行界面下
Switch>enable
Switch#conf t
Switch(config)#monitor session 1 source interface Gi1/0/49 both
指定你要抓包的源端口,both是进出的包都抓
Switch(config)#monitor session 1 destination interface Gi1/0/1
指定你要镜像到的目的端口,
这样就把第49端口的数据包镜像到1端口了
同理
monitor session 2 source interface Gi1/0/50 both
monitor session 2 destination interface Gi1/0/2
这样就把第50端口的数据包镜像到2端口了
{zh1}保存配置
Switch(config)#exit
Switch#wr
验证配置
Switch#show monitor
这种配置适应与cisco交换机,不同的交换机端口编号可能有不同,可以使用
show ip int b
命令查看端口的编号,来进行相应的配置。