R1(config-if)#ip address 10.10.10.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
R2(config)#interface S0/0
R2(config-if)#ip address 10.10.10.2 255.255.255.252
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface E0/0
R2(config-if)#ip address 192.168.10.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
R1(config)#class-map match-any Flow
R1(config)#policy-map nbar
R1(config-pmap)#class Flow
R1(config-pmap-c)#exit
R1(config)#interface S0/0
R1(config-if)#service-policy input nbar
Class Map match-any class-default (id 0)
Match any
Match protocol icmp
Policy Map nbar
Class Flow
drop
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5) ---R2不能ping通R1,因为R1的S0/0口将ICMP包Drop。