Wednesday, April 8, 2009

hierarchical queuing on Cisco


Recently i tested on assigning different bandwidth requirement for number of users. Example setup is showed in the following diagram. 512kbps is divided between users and one user can use whole bandwidth when others are not using.I've done some testing on this and i archived the requirement through hierarchical queuing strategy.

1) I setup the natting / and other basic setup-

ip route 0.0.0.0 0.0.0.0 10.0.0.2
ip nat inside source list 2 interface FastEthernet0/0 overload
access-list 2 permit 192.168.2.0 0.0.0.255
ip nat outside
ip nat inside


2) Define the class-maps.

2.1 - Access-list for match the ips.


access-list 101 permit ip host 192.168.2.1 any
access-list 101 permit ip any host 192.168.2.1
access-list 102 permit ip host 192.168.2.2 any
access-list 102 permit ip any host 192.168.2.2
access-list 103 permit ip host 192.168.2.3 any
access-list 103 permit ip any host 192.168.2.3


2.2 - match ACL.


class-map match-all shape256_pir256_HostA
match access-group 101
class-map match-all shape64_pir64_HostB
match access-group 102
class-map match-all shape128_pir512_HostC
match access-group 103


3) queues ..
3.1 - Define the parent shaper.

policy-map shape_512
class class-default
shape average 512000
service-policy shapeinside


3.2 - child queues

policy-map shapeinside
class shape256_pir256_HostA
bandwidth 256
police rate 256000 bps burst 32000 bytes
class shape64_pir64_HostB
bandwidth 64
police rate 64000 bps burst 32000 bytes


4) Apply it on the interface

interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
ip nat inside
duplex auto
speed auto
service-policy output shape_512

My test result showed the bandwidth guaranteed for the HOST A,B if those are not using HOST C can utilize that's the reason i did not put any shape in the child.