Switch>en
Switch#conf t //进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#monitor session 1 source interface gigabitEthernet 0/1 both //指定端口0/1,both是进出的包都抓
Switch(config)#monitor session 1 destination interface gigabitEthernet 0/2 //指定连接抓包主机的端口
Switch(config)#exit
例如,我想在f0/24端口上抓f0/1-23端口的包
配置如下:
Switch#conf t (进入全局配置模式)
Switch(config)#monitor session 1 destination interface fastEthernet 0/24(指定连接抓包主机的端口)
Switch(config)#monitor session 1 source interface f0/1 - 23 both(指定端口1-23,both是进出的包都抓)
很简单的设置就可以了,但这里有个小问题,就是做了镜像端口,连接这个端口就变成单向接收模式了,那么主机将无法上网了。那,如果想要远程连接抓包怎么办呢?就在这台主机上再加一块网卡就可以上网,也可以远程了.
转载于:https://blog.51cto.com/gywxdn/1230492