源为R1,目标为R3,在R2上定义CBWFQ使:
1,ping保证带宽为20K
2,telnet保证带宽为1M
 
基本配置
R1
conf t
int f 0/0
ip ad 10.1.1.1 255.255.255.0
no shut
router rip
ver 2
no au
net 10.0.0.0
end
 
R2
conf t
int f 0/0
ip ad 10.1.1.2 255.255.255.0
no shut
int s2/0
ip ad 10.1.2.2 255.255.255.0
encap f
no arp f
no frame inver
frame map ip 10.1.2.3 203 b
no shut
router rip
ver 2
no au
net 10.0.0.0
exit
access-list 100 permit icmp host 10.1.1.1 host 10.1.2.3
access-list 101 permit tcp host 10.1.1.1 host 10.1.2.3 eq telnet

class-map PING
match access-group 100

exit
class-map TELNET
match access-group 101

exit
policy-map CBWFQ
class PING
bandwidth 20

class TELNET
bandwidth 1000

exit
int s2/0
service-policy output CBWFQ                           /*CBWFQ只支持output方向策略
end
 
R3
conf t
int s2/0
ip ad 10.1.2.3 255.255.255.0
encap f
no arp f
no frame inver
frame map ip 10.1.2.2 302 b
no shut
router rip
ver 2
no au
net 10.0.0.0
line vty 0 4
password cisco
login
end

校验
R1#ping 10.1.2.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/52/88 ms
R1#telnet 10.1.2.3
Trying 10.1.2.3 ... Open

User Access Verification
Password:
R3>quit
[Connection to 10.1.2.3 closed by foreign host]
 

R2#sh ip access-list
Extended IP access list 100
    10 permit icmp host 10.1.1.1 host 10.1.2.3 (5 matches)
Extended IP access list 101
    10 permit tcp host 10.1.1.1 host 10.1.2.3 eq telnet (22 matches)

R2#sh policy-map int s2/0
 Serial2/0
  Service-policy output: CBWFQ
    Class-map: PING (match-all)
      10 packets, 1040 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: access-group 100
      Queueing
        Output Queue: Conversation 265
        Bandwidth 20 (kbps) Max Threshold 64 (packets)
        (pkts matched/bytes matched) 0/0
        (depth/total drops/no-buffer drops) 0/0/0
    Class-map: TELNET (match-all)
      39 packets, 1844 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: access-group 101
      Queueing
        Output Queue: Conversation 266
        Bandwidth 1000 (kbps) Max Threshold 64 (packets)
        (pkts matched/bytes matched) 2/100
        (depth/total drops/no-buffer drops) 0/0/0

R2#sh queue s2/0
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: Class-based queueing
  Output queue: 0/1000/64/0 (size/max total/threshold/drops)
     Conversations  0/1/256 (active/max active/max total)
     Reserved Conversations 2/2 (allocated/max allocated)
     Available Bandwidth 138 kilobits/sec
 
当使用RTP和LLQ时
 
R2
class-map VOICE
match dscp ef
policy-map LLQ
class VOICE
priority 50                                                     /×限定dscp值为ef的流量为50K
int s2/0
ip rtp priority 20000 21000 100               /*限定UDP端口范围从20000到21000的流量带宽为100K
service-policy output LLQ
end