Let's walk through a requirement.
Let's imagine the following requirement which is to be matched.
(1). HTTP traffic from source 192.168.12.0/24 which goes out from Gig0/2 interface should be marked with an IP Precedence of 2.
(2). VoIP packets goes out from Gig0/2 interface with UDP ports in the destination range of 16384–32767, and a Layer 3 packet size of 60 bytes should be marked with DSCP EF.
(3). Mail regarding traffic which uses IMAP, SMTP should be marked with DSCP 35
(4). All other packets that goes out from the link should be remarked with an IP precedence of 1.
Here we need to create 2 access-lists to match some of the requirements which then can be called in class-maps.
R2(config)#ip access-list extended HTTP
R2(config-ext-nacl)#permit tcp 192.168.12.0 0.0.0.255 eq www any
R2(config)#ip access-list extended VOIP
R2(config-ext-nacl)#permit udp any any range 16384 32767
Now it's the time to create Class-Maps;
R2(config)#class-map HTTP
R2(config-cmap)#match access-group name HTTP
R2(config)#class-map VOIP
R2(config-cmap)#match access-group name VOIP
R2(config-cmap)#match packet length min 60 max 60
R2(config)#class-map match-any MAIL
R2(config-cmap)#match protocol imap
R2(config-cmap)#match protocol smtp
Now it's the time to write the Policy-Map;
R2(config)#policy-map POLICY
R2(config-pmap)#class HTTP
R2(config-pmap-c)#set ip precedence 2
R2(config-pmap-c)#exit
R2(config-pmap)#class VOIP
R2(config-pmap-c)#set dscp ef
R2(config-pmap-c)#exit
R2(config-pmap)#class MAIL
R2(config-pmap-c)#set dscp 35
R2(config-pmap-c)#exit
R2(config-pmap)#class class-default
R2(config-pmap-c)#set ip precedence 1
Finally let's apply the policy in an interface;
R2(config)#int e0/1
R2(config-if)#service-policy output POLICY
To view the statistics we can use #show policy-map interface e0/1
No comments:
Post a Comment