Re: Matching Packet Length with class-ma

From: Narbik Kocharians (narbikk@gmail.com)
Date: Mon Dec 15 2008 - 21:54:24 ARST


Sorry for the long reply but try this lab and i hop it helps.

Lab this up, i am sure it will benefit you.

The topology of the following lab is:

R1 is connected to R2 via Frame-relay (No sub-interfaces) and R2 is
connected to R3 via F0/0.

R1's S0/0 = 10.1.12.1 /24
*R2's S0/0 = 10.1.12.2 /24*
*R2's F0/0 = 10.1.23.2 /24*
R3's F0/0 = 10.1.23.3 /24

*Task 1*

Configure reachability to all networks in this topology using static routes.

*On R1*

R1(config)#ip route 10.1.24.0 255.255.255.0 10.1.12.2

*On R3*

R3(config)#ip route 10.1.12.0 255.255.255.0 10.1.23.2

*Task 2*

Configure R2 to set the DE bit on all egress packets that are greater than
1000 Bytes.

*In the following example a class-map called "QOS" has been configured, and
a layer 3 packet length has been specified as a match criterion. In the
following configuration, packets with a minimum layer 3 packet length of
1000 bytes will match and therefore, classified.*

*On R2*

R2(config)#class-map *QOS*

R2(config-cmap)#*match packet length min 1000*

R2(config-cmap)#policy-map *TST*

R2(config-pmap)#class *QOS*

R2(config-pmap-c)#*set fr-de*

R2(config-if)#int s0/0

R2(config-if)#service-policy output *TST*

*On R1*

R1(config)#class-map *FR*

R1(config-cmap)#*match fr-de*

R1(config)#policy-map *TST*

R1(config-pmap)#class *FR*

R1(config-pmap-c)#int s0/0

R1(config-if)#service-policy in *TST*

*To verify the configuration:*

* *

*On R1*

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *0 packets*, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      4 packets, 1328 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*To test the configuration:*

* *

*On R3*

*R3#ping 10.1.12.1 size 999 repeat 20*

Type escape sequence to abort.

Sending 20, 999-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!!!!!!!!!!!*

*Success rate is 100 percent (20/20),* round-trip min/avg/max = 452/452/457
ms

*On R1*

* *

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *0 packets*, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      *22 packets*, 20724 bytes

      5 minute offered rate 4000 bps, drop rate 0 bps

      Match: any

* *

*On R3*

* *

*R3#ping 10.1.12.1 size 1000 repeat 10*

Type escape sequence to abort.

Sending 10, 1000-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 452/458/492
ms

*On R1*

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *10 packets*, 10040 bytes

      5 minute offered rate 2000 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      28 packets, 22716 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*Task 3*

Re-configure R2 to set the DE bit on all egress packets that are smaller
than 1000 Bytes.

*On R2*

R2(config)#class-map *QOS*

R2(config-cmap)#*no match packet length min 1000*

R2(config-cmap)#*match packet length max 1000*

* *

*To test the configuration:*

*On R1*

*To clear all the counters:*

*R1#clear counters*

Clear "show interface" counters on all interfaces [confirm]

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      0 packets, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      2 packets, 664 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*To generate some traffic:*

*On R3*

*R3#ping 10.1.12.1 size 1001 repeat 10*

Type escape sequence to abort.

Sending 10, 1001-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 452/454/457
ms

*To see the result:*

* *

*On R1*

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *0 packets*, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      16 packets, 12042 bytes

      5 minute offered rate 1000 bps, drop rate 0 bps

      Match: any

* *

*To generate traffic with packet sizes less than 1000 Bytes:*

* *

*On R3*

*R3#ping 10.1.12.1 size 999 repeat 10 *

Type escape sequence to abort.

Sending 10, 999-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 452/453/457
ms

*On R1*

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *10 packets*, 10030 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      19 packets, 13038 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*
*

*Task 4*

Re-configure R2 to set the DE bit on all egress packets that are larger than
1000 and smaller than 1200 Bytes.

*On R2*

R2(config)#class-map QOS

R2(config-cmap)#*no match packet length max 1000*

R2(config-cmap)#*match packet length min 1000 max 1200*

*On R1*

*R1#cle counters*

Clear "show interface" counters on all interfaces [confirm]

*R1#Show policy-map interface s0/*0

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      0 packets, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      2 packets, 664 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*On R3*

*R3#ping 10.1.12.1 size 999 repeat 10*

Type escape sequence to abort.

Sending 10, 999-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 453/453/456
ms

*On R1*

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      0 packets, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      14 packets, 11358 bytes

      5 minute offered rate 3000 bps, drop rate 0 bps

      Match: any

*On R3*

*R3#ping 10.1.12.1 size 1201 repeat 10*

Type escape sequence to abort.

Sending 10, 1201-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 540/543/545
ms

*On R1*

* *

*R1#Show policy-map interface s0/0*

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      0 packets, 0 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      31 packets, 25732 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

*On R3*

* *

* *

*R3#ping 10.1.12.1 size 1100 repeat 10*

Type escape sequence to abort.

Sending 10, 1100-byte ICMP Echos to 10.1.12.1, timeout is 2 seconds:

*!!!!!!!!!!*

*Success rate is 100 percent (10/10),* round-trip min/avg/max = 496/497/501
ms

*On R1*

R1#Show policy-map interface s0/0

 Serial0/0

  Service-policy input: TST

    Class-map: FR (match-all)

      *10 packets*, 11040 bytes

      5 minute offered rate 0 bps

      Match: fr-de

      Match: any

    Class-map: class-default (match-any)

      35 packets, 27060 bytes

      5 minute offered rate 0 bps, drop rate 0 bps

      Match: any

Thanks
On Mon, Dec 15, 2008 at 3:43 PM, antonygrooves <antonygrooves@gmail.com>wrote:

> I guys.
>
> I have a task that ask me to match packets length from 100 to 500, I'm not
> sure if in this case i should use
>
> Match packet length min 100 max 500
>
> OR
>
> Match packet length min 100 max 499
>
>
> I appreciate any help on this.
>
> Tony.
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html
>
>
>
>
>
>
>
>

-- 
Narbik Kocharians
CCSI#30832, CCIE# 12410 (R&S, SP, Security)
www.MicronicsTraining.com
www.Net-Workbooks.com
Sr. Technical Instructor

Blogs and organic groups at http://www.ccie.net



This archive was generated by hypermail 2.1.4 : Thu Jan 01 2009 - 12:53:08 ARST