Re: Clarification on class map

From: Alexei Monastyrnyi <alexeim73_at_gmail.com>
Date: Mon, 18 Jun 2012 21:09:18 +1000

Mr Me You, Sir,
I would have to disagree with you on the first one. If you look closely,
the class-map is of type match-any, which creates a logical OR.

And probably just to close this one off, a quick setup like this shows
those two syntax do the same job, logical OR.

*R1 - Ethernet - R2*

*First we source Telnet from R2 to R1, it gets marked as Prec 3 when it
leases the router. Then we source SSS from R2 to R1, it gets marked as
Prec 4.*

R1(config-if)#do sh run | sec class-map|policy-map|interface FastEthernet0/0
class-map match-any TEST
  match precedence 3
  match precedence 4
policy-map PM_TEST
  class TEST
   set precedence 5
interface FastEthernet0/0
  ip address 1.1.1.1 255.255.255.0
  service-policy input PM_TEST

R2#sh run | sec list|local|route-map|interface FastEthernet0/0
interface FastEthernet0/0
  ip address 1.1.1.2 255.255.255.0
!
ip local policy route-map LOCAL_PBR
access-list 122 permit tcp any any eq 22
access-list 123 permit tcp any any eq telnet
route-map LOCAL_PBR permit 10
  match ip address 122
  set ip precedence 3
route-map LOCAL_PBR permit 20
  match ip address 123
  set ip precedence 4

*In case of telnet we get:*

R1(config)#do sh policy-map inter
  FastEthernet0/0

   Service-policy input: PM_TEST

     Class-map: TEST (match-any)
       10 packets, 606 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: precedence 3
         0 packets, 0 bytes
         5 minute rate 0 bps
       Match: precedence 4
* 10 packets, 606 bytes*
         5 minute rate 0 bps
       QoS Set
         precedence 5
* Packets marked 10*

     Class-map: class-default (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: any

*And with SSH we get:*

R1(config)#do sh policy-map inter
  FastEthernet0/0

   Service-policy input: PM_TEST

     Class-map: TEST (match-any)
       42 packets, 3510 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: precedence 3
* 32 packets, 2904 bytes*
         5 minute rate 0 bps
       Match: precedence 4
         10 packets, 606 bytes
         5 minute rate 0 bps
       QoS Set
         precedence 5
* Packets marked 42*

     Class-map: class-default (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: any

*Now we change class-map TEST around:*

R1(config)#class-map TEST
R1(config-cmap)#match precedence 3 4
R1(config-cmap)#no match precedence 3
R1(config-cmap)#no match precedence 4
R1(config-cmap)#do sh run class-map
Building configuration...

Current configuration : 60 bytes
!
class-map match-any TEST
  match precedence 3 4
!
end

R1(config-cmap)#in fa 0/0
R1(config-if)#no service-policy in PM_TEST
R1(config-if)#service-policy in PM_TEST

R1(config-if)#do sh policy-map inter
  FastEthernet0/0

   Service-policy input: PM_TEST

     Class-map: TEST (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: precedence 3 4
         0 packets, 0 bytes
         5 minute rate 0 bps
       QoS Set
         precedence 5
           Packets marked 0

     Class-map: class-default (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: any

*In case of telnet we get:*

R1(config-if)#do sh policy-map inter
  FastEthernet0/0

   Service-policy input: PM_TEST

     Class-map: TEST (match-any)
       10 packets, 606 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: precedence 3 4
* 10 packets, 606 bytes*
         5 minute rate 0 bps
       QoS Set
         precedence 5
* Packets marked 10*

     Class-map: class-default (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: any

*And with SSH we get:*

R1(config-if)#do sh policy-map inter
  FastEthernet0/0

   Service-policy input: PM_TEST

     Class-map: TEST (match-any)
       42 packets, 3510 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: precedence 3 4
* 42 packets, 3510 bytes*
         5 minute rate 0 bps
       QoS Set
         precedence 5
* Packets marked 42*

     Class-map: class-default (match-any)
       0 packets, 0 bytes
       5 minute offered rate 0 bps, drop rate 0 bps
       Match: any

HTH
A.

On 6/18/2012 8:25 PM, me you wrote:
>
> Figured I would answer it because no-one else did.
>
> Class-map match-any TEST
> match precedence 3
> match precedence 4
>
> creates a logical "and" statement. The packet would have to be marked
> with both IP precedence 3 and 4 which is impossible.
>
> class-map match-any TEST
> match precedence 3 4
>
> creates a logical "or" statement. The class-map will match any packet
> marked with an ip prec of 3 or 4.
>
> Rob
>
> A.
>
>
> On 6/18/2012 12:16 AM, Vincent Tay wrote:
> > Hi there, just to clarify the below differences between
> >
> > class-map match-any TEST
> > match precedence 3
> > match precedence 4
> >
> > vs
> >
> > class-map match-any TEST
> > match precedence 3 4
> >
> > Regards
> > Thanks.
> >
> >
> > Blogs and organic groups at http://www.ccie.net
> >
> >
> _______________________________________________________________________
> > Subscription information may be found at:
> > http://www.groupstudy.com/list/CCIELab.html
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html

Blogs and organic groups at http://www.ccie.net
Received on Mon Jun 18 2012 - 21:09:18 ART

This archive was generated by hypermail 2.2.0 : Sun Jul 01 2012 - 10:39:52 ART