When testing with QOS we need to send packets with different markings. There is a trick to find out the corresponding value for the extended ping command.
First create a class-map. Then make a matching with dscp.
R3(config)#class-map test R3(config-cmap)#match dscp ? Differentiated services codepoint value af11 Match packets with AF11 dscp (001010) af12 Match packets with AF12 dscp (001100) af13 Match packets with AF13 dscp (001110) af21 Match packets with AF21 dscp (010010) af22 Match packets with AF22 dscp (010100) af23 Match packets with AF23 dscp (010110) af31 Match packets with AF31 dscp (011010) af32 Match packets with AF32 dscp (011100) af33 Match packets with AF33 dscp (011110) af41 Match packets with AF41 dscp (100010) af42 Match packets with AF42 dscp (100100) af43 Match packets with AF43 dscp (100110) cs1 Match packets with CS1(precedence 1) dscp (001000) cs2 Match packets with CS2(precedence 2) dscp (010000) cs3 Match packets with CS3(precedence 3) dscp (011000) cs4 Match packets with CS4(precedence 4) dscp (100000) cs5 Match packets with CS5(precedence 5) dscp (101000) cs6 Match packets with CS6(precedence 6) dscp (110000) cs7 Match packets with CS7(precedence 7) dscp (111000) default Match packets with default dscp (000000) ef Match packets with EF dscp (101110)
We want to sent a packet with an IP prec of 5. In the above output we can find the binary representation (101000). The first 6 bits are represented in binary. We just have to add the final 2 bits of zeros and then convert it back to decimal.Thus 10100000 will yield 160 in decimal.
now we can send a ping using extended ping.
R1#ping
Protocol [ip]:
Target IP address: 10.0.23.3
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]: 160
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.0.23.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/36/60 ms
I created a policy-map on the destination to meter the input.
class-map match-all test
class-map match-all MATCH_PRE_5
match precedence 5
!
!
policy-map METER
class MATCH_PRE_5
!
!
interface FastEthernet0/0
ip address 10.0.23.3 255.255.255.0
service-policy input METER
R3#sh policy-map int f0/0 FastEthernet0/0 Service-policy input: METER Class-map: MATCH_PRE_5 (match-all) 5 packets, 570 bytes 5 minute offered rate 0 bps Match: precedence 5 Class-map: class-default (match-any) 15 packets, 1710 bytes 5 minute offered rate 0 bps, drop rate 0 bps Match: any
The 5 ICMP packets are marked 😉