对R1到R3的流量使用CAR进行分类和限速
对于ICMP的流量限速5MBPS,normal burst size为6000,exceed burst size为8000,速率以内的设置优先级为5并传输,超过速率设置优先级为0后传输
对TCP的流量限速为8MBPS,normal vurst size为10000,exceed burst size为20000,速率以内的设置优先级为5并传输,超过速率丢弃
其他的流量限速为9MBPS,normal burst size 为8000, exceed burst size 为10000,速率内的传输,超过的丢弃

R1
conf t
int f 0/0
ip ad 10.1.1.1 255.255.255.0
no shut
router rip
net 10.0.0.0
 
 
R2
conf t
int f 0/0
ip ad 10.1.1.2 255.255.255.0
no shut
int f 1/0
ip ad 10.1.2.2 255.255.255.0
no shut
exit
access 100 permit icmp any any
access 101 permit tcp any any
int f 0/0
rate-limit input access-group 100 5000000 6000 8000 conform-action set-prec-transmit 5 exceed-action set-prec-transmit 0
 rate-limit input access-group 101 8000000 10000 20000 conform-action set-prec-transmit 5 exceed-action drop
 rate-limit input 9000000 8000 10000 conform-action transmit exceed-action drop

no shut
exit
router rip
net 10.0.0.0
line vty 0 4
password cisco
login
end
 
校验
在R1上分别对R2做PING(icmp) ,TRACEROUTE(udp),TELNET(tcp)命令
1#telnet 2.2.2.2
Trying 2.2.2.2 ... Open

User Access Verification
Password:
R2>
R2>quit
[Connection to 2.2.2.2 closed by foreign host]

R1#trace 2.2.2.2
Type escape sequence to abort.
Tracing the route to 2.2.2.2
  1 10.1.1.2 88 msec *  68 msec

R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/32/88 ms
在R2上观察CAR起的作用
R2#sh int f 0/0 rate-limit
FastEthernet0/0
  Input
    matches: access-group 100
      params:  5000000 bps, 6000 limit, 8000 extended limit
      conformed 5 packets, 570 bytes; action: set-prec-transmit 5
      exceeded 0 packets, 0 bytes; action: set-prec-transmit 0
      last packet: 4596ms ago, current burst: 0 bytes
      last cleared 00:00:29 ago, conformed 0 bps, exceeded 0 bps
    matches: access-group 101
      params:  8000000 bps, 10000 limit, 20000 extended limit
      conformed 26 packets, 1566 bytes; action: set-prec-transmit 5
      exceeded 0 packets, 0 bytes; action: drop
      last packet: 14512ms ago, current burst: 0 bytes
      last cleared 00:00:29 ago, conformed 0 bps, exceeded 0 bps
    matches: all traffic
      params:  9000000 bps, 8000 limit, 10000 extended limit
      conformed 3 packets, 180 bytes; action: transmit
      exceeded 0 packets, 0 bytes; action: drop
      last packet: 7416ms ago, current burst: 0 bytes
      last cleared 00:00:29 ago, conformed 0 bps, exceeded 0 bps