SlideShare a Scribd company logo
QoS Pre-Classify on Cisco IOS
Quality of Service (QoS) | www.netprotocolxpert.in
• When we use tunnelling, your Cisco IOS router will do classification based on
the outer (post) header, not the inner (pre) header. This can cause issues with
QoS policies that are applied to the physical interfaces. I will explain the issue
and we will take a look how we can Fix it. Here’s the topology that we will use:
• Using a static route so that R1 and R3 can reach each other’s
loopback interfaces through the tunnel:
• R1(config)#interface Tunnel 0
• R1(config‐if)#tunnel source 192.168.12.1
• R1(config‐if)#tunnel destination 192.168.23.3
• R1(config‐if)#ip address 172.16.13.1 255.255.255.0
• R1(config)#ip route 3.3.3.3 255.255.255.255 172.16.13.3
• The configuration on R3 is similar:
• R3(config)#interface Tunnel 0
• R3(config‐if)#tunnel source 192.168.23.3
• R3(config‐if)#tunnel destination 192.168.12.1
• R3(config‐if)#ip address 172.16.13.3 255.255.255.0
• R3(config)#ip route 1.1.1.1 255.255.255.255 172.16.13.1
Default Classification Behaviour
• The tunnel is up and running, before we play with classification and service
policies, let’s take a look at the default classification behaviour of Cisco IOS
• IOS will copy the information in theTOS (Type of Service) byte from the
inner IP header to the outer IP header by default.We can demonstrate this
with a simple ping.
• Loose, Strict, Record,Timestamp,
Verbose[none]:
• Sweep range of sizes [n]:
• Type escape sequence to abort.
• Sending 5, 100‐byte ICMP Echos to 3.3.3.3,
timeout is 2 seconds:
• Packet sent with a source address of 1.1.1.1
• !!!!!
• Success rate is 100 percent (5/5), round‐trip
min/avg/max = 1/2/4 ms
• R1#ping
• Protocol [ip]:
• Target IP address: 3.3.3.3
• Repeat count [5]:
• Datagram size [100]:
• Timeout in seconds [2]:
• Extended commands [n]: y
• Source address or interface: 1.1.1.1
• Type of service [0]: 160
• Set DF bit in IP header? [no]:
• Validate reply data? [no]:
• Data pattern [0xABCD]:
• This ping between 1.1.1.1 and 3.3.3.3 will go through the tunnel and I marked the TOS
byte of this IP packet with 160 (decimal). 160 in binary is 10100000, remove the last
two bits and you have our 6 DSCP bits. 101000 in binary is 40 in decimal which is the
same as the CS5.
wireshark capture of this ping:
Cont.…
QoS Pre-Classify on Cisco IOS
• As we can see, Cisco IOS automatically copied the TOS byte from the inner
IP header to the outer IP header. This is a good thing, We are using GRE in
our example so we can see both headers but if this was an encrypted IPSEC
tunnel then we (and any device in between) could only see the outer header.
• When you have QoS policies based on the TOS byte then you will have no
problems at all because the TOS byte is copied from the inner to the outer
header. We will run into issues when you have policies based on access-lists
that match on source / destination addresses and/or port numbers.
Post Header Classification
• We are going to create two class-maps, one for telnet traffic and another one for
GRE traffic. Both class-maps will use an access-list to classify traffic:
• R1(config)#ip access‐list extendedTELNET
• R1(config‐ext‐nacl)#permit tcp any any eq telnet
• R1(config)#class‐mapTELNET
• R1(config‐cmap)#match access‐group nameTELNET
• R1(config)#ip access‐list extended GRE
• R1(config‐ext‐nacl)#permit gre any any
• R1(config)#class‐map GRE
• R1(config‐cmap)#match access‐group name GRE
The two class-maps will be used in a policy-map:
• R1(config)#policy‐map POLICE
• R1(config‐pmap)#classTELNET
• R1(config‐pmap‐c)#police 128000
• R1(config‐pmap‐c‐police)#exit
• R1(config‐pmap‐c)#exit
• R1(config‐pmap)#class GRE
• R1(config‐pmap‐c)#exit
• R1(config‐pmap)#exit
• We’ve added policing for telnet traffic and nothing for GRE. It doesn’t matter
what “actions” we configure here, even without an action the traffic will still be
classified and it will show up in the policy-map. Let’s activate it on the physical
interface:
• R1(config)#interface FastEthernet 0/0
• R1(config‐if)#service‐policy output POLICE
• Something to keep in mind is that when you enable a policy on the physical
interface, it will be applied to all tunnel interfaces.
• Generate some telnet traffic between R1 and R3 so it goes through the tunnel:
• R1#telnet 3.3.3.3 /source‐interface loopback 0
• Trying 3.3.3.3 ... Open
• R1#show policy‐map interface FastEthernet 0/0
• FastEthernet0/0
• Service‐policy output: POLICE
• Class‐map:TELNET (match‐all)
•0 packets, 0 bytes
•5 minute offered rate 0 bps, drop rate 0 bps
•Match: access‐group nameTELNET
•police:
•cir 128000 bps, bc 4000 bytes
•conformed 0 packets, 0 bytes; actions:
•transmit
•exceeded 0 packets, 0 bytes; actions:
•drop
• conformed 0 bps, exceed 0 bps
• Class‐map: GRE (match‐all)
• 11 packets, 735 bytes
• 5 minute offered rate 0 bps
• Match: access‐group name GRE
• Class‐map: class‐default (match‐any)
• 2 packets, 120 bytes
• 5 minute offered rate 0 bps, drop rate 0 bps
• Match: any
• We don’t have any matches for the telnet traffic.
• If this was a real network, it means that telnet traffic will never get policed
(or any other action you configured). The reason that we don’t see any
matches is because Cisco IOS first encapsulates the IP packet and then
applies the policy to the GRE traffic.
Encapsulates the IP packet
The blue IP header on top is our original IP packet with telnet traffic, this is
encapsulated and the router adds a GRE header and a new IP header (the red
one).The policy-map is then applied to this outer IP header.
Pre Header Classification (Physical Interface)
• The first method to solve this issue is to enable pre-classification on the
tunnel interface. This tells the router to create a copy of the original IP
header and to use that for the policy. Here's how to do this:
• R1(config)#interfaceTunnel 0
• R1(config‐if)#qos pre‐classify
• R1#clear counters
• Clear "show interface" counters on all interfaces [confirm]
• R1#telnet 3.3.3.3 /source‐interface loopback 0
• Trying 3.3.3.3 ... Open
Now take a look at the policy-map:
• R1#show policy‐map interface FastEthernet 0/0
• FastEthernet0/0
• Service‐policy output: POLICE
• Class‐map: TELNET (match‐all)
•11 packets, 735 bytes
•5 minute offered rate 0 bps, drop rate 0 bps
•Match: access‐group nameTELNET
•police:
•cir 128000 bps, bc 4000 bytes
•conformed 11 packets, 889 bytes; actions:
•transmit
Cont.…
• exceeded 0 packets, 0 bytes; actions:
•drop
• conformed 0 bps, exceed 0 bps
• Class‐map: GRE (match‐all)
• 0 packets, 0 bytes
• 5 minute offered rate 0 bps
• Match: access‐group name GRE
• Class‐map: class‐default (match‐any)
• 1 packets, 60 bytes
• 5 minute offered rate 0 bps, drop rate 0 bps
• Match: any
Now we see matches on our
telnet traffic so it can be
policed if needed. We don't
see any matches on our GRE
traffic anymore.
When the router encapsulates a packet, it will make a temporary copy of the
header. This temporary copy is then used for the policy instead of the outer
header. When this is done, the temporary copy is destroyed.
We accomplished this with the qos pre-classify command but there is another
method to get the same result.
Pre Header Classification (Tunnel Interface)
• Instead of activating the policy on the physical interface we can also
enable it on the tunnel interface:
• R1(config)#interface FastEthernet 0/0
• R1(config‐if)#no service‐policy output POLICE
• R1(config)#interfaceTunnel 0
• R1(config‐if)#no qos pre‐classify
• R1(config‐if)#service‐policy output POLICE
• Note that I also removed the qos pre-classify command on the
tunnel interface. Let's give it another try:
• R1#clear counters
• Clear "show interface" counters on all interfaces [confirm]
• R1#telnet 3.3.3.3 /source‐interface loopback 0
• Trying 3.3.3.3 ... Open
• R1#show policy‐map interfaceTunnel 0
• Tunnel0
• Service‐policy output: POLICE
• Class‐map: TELNET (match‐all)
•11 packets, 737 bytes
•5 minute offered rate 0 bps, drop rate 0 bps
•Match: access‐group nameTELNET
•police:
•cir 128000 bps, bc 4000 bytes
•conformed 11 packets, 737 bytes; actions:
•transmit
•exceeded 0 packets
•drop
• conformed 0 bps, exceed 0 bps
• Class‐map: GRE (match‐all)
• 0 packets, 0 bytes
• 5 minute offered rate 0 bps
• Match: access‐group name GRE
• Class‐map: class‐default (match‐any)
• 0 packets, 0 bytes
• 5 minute offered rate 0 bps, drop rate 0 bps
• Match: any
• If you enable the policy on the tunnel interface then the router will
use the inner header for classification, just like we saw when we
used the qos pre-classify command on the tunnel interface.
• That's all there is to explain. We hope this lesson has been useful to
understand the difference between "outer" and "inner" header
classification and how to deal with this issue.
Follow us
@https://www.facebook.com/Ne
tProtocolXpert/
https://www.linkedin.com/com
pany/netprotocol-xpert
https://plus.google.com/u/0/+
NetProtocolXpert_NPX/posts
https://www.instagram.com/
netprotocol_xpert/
https://twitter.com/NPX_ci
sco
https://branded.me/netp
rotocolxpert

More Related Content

PPTX
QoS Classification on Cisco IOS Router
PDF
PDF
Real World Applications of MQTT
PPTX
VTP(Virtual Trunking Protocol)
PDF
Demystifying TrustSec, Identity, NAC and ISE
PPTX
SIP: Call Id, Cseq, Via-branch, From & To-tag role play
PPT
Routing Information Protocol (RIP)
PPT
BGP Overview
QoS Classification on Cisco IOS Router
Real World Applications of MQTT
VTP(Virtual Trunking Protocol)
Demystifying TrustSec, Identity, NAC and ISE
SIP: Call Id, Cseq, Via-branch, From & To-tag role play
Routing Information Protocol (RIP)
BGP Overview

What's hot (20)

PDF
GRE (generic routing encapsulation)
PDF
Policy Based Routing (PBR)
PDF
BGP Techniques for Network Operators
PDF
IMS Call Follow
PDF
GLBP (gateway load balancing protocol)
PPT
Vpn site to site
PDF
FIWARE Training: FIWARE Training: i4Trust Marketplace
PDF
Presentation f5 – beyond load balancer
ODP
Dynamic routing
PDF
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
PPTX
JUNOS: OSPF and BGP
PDF
Streaming Analytics & CEP - Two sides of the same coin?
PDF
Protocole EIGRP
PPT
Cisco ACL
PPTX
Rpl dodag
PDF
초보자를 위한 네트워크/VLAN 기초
PPTX
GRE Tunnel Configuration
PPTX
Fortinet [Enregistrement automatique].pptx
PDF
Router commands
GRE (generic routing encapsulation)
Policy Based Routing (PBR)
BGP Techniques for Network Operators
IMS Call Follow
GLBP (gateway load balancing protocol)
Vpn site to site
FIWARE Training: FIWARE Training: i4Trust Marketplace
Presentation f5 – beyond load balancer
Dynamic routing
Building “old” Windows drivers (XP, Vista, 2003 and 2008) with Visual Studio ...
JUNOS: OSPF and BGP
Streaming Analytics & CEP - Two sides of the same coin?
Protocole EIGRP
Cisco ACL
Rpl dodag
초보자를 위한 네트워크/VLAN 기초
GRE Tunnel Configuration
Fortinet [Enregistrement automatique].pptx
Router commands
Ad

Viewers also liked (16)

PPTX
Quality of service
PPT
PDF
2 2-diff serv-intserv
PPTX
Mini-Workshop: Responsive Web Design with Visualforce and Bootstrap
PPTX
Recycle Game
PPT
Ο σχολικός μας κήπος
PPT
οδηγίες συμπλήρωσης αίτησης για το πρόγραμμα Teachers 4 europe 2014 2015
PPTX
Project ECHO (Extension for Community Health Outcomes)
PPTX
Manejo y seguridad del internet
PDF
Social Media Report - Snack Brands - Chips (India) September - October 2016
PPT
洞穴人的陰影
PDF
Welwyn Hatfield Dragons Apprentice: 5 reasons to be involved
PDF
World Economic Forum Annual Meeting 2006
PDF
ECRI-INSTITUTE - Camas de Parto
PDF
Validación del Desempeño de los Dispositivos Médicos, Una Mirada desde la Ing...
PPSX
The drowned love
Quality of service
2 2-diff serv-intserv
Mini-Workshop: Responsive Web Design with Visualforce and Bootstrap
Recycle Game
Ο σχολικός μας κήπος
οδηγίες συμπλήρωσης αίτησης για το πρόγραμμα Teachers 4 europe 2014 2015
Project ECHO (Extension for Community Health Outcomes)
Manejo y seguridad del internet
Social Media Report - Snack Brands - Chips (India) September - October 2016
洞穴人的陰影
Welwyn Hatfield Dragons Apprentice: 5 reasons to be involved
World Economic Forum Annual Meeting 2006
ECRI-INSTITUTE - Camas de Parto
Validación del Desempeño de los Dispositivos Médicos, Una Mirada desde la Ing...
The drowned love
Ad

Similar to QoS Pre-Classify on Cisco IOS (20)

PPTX
QoS marking on cisco IOS Router
PDF
Labmannual
PPT
Ccna2 mod3-configuring a-router
PPTX
CCNA ppt Day 4
DOC
Ccn pv7 route_lab2-1_eigrp-load-balancing_student
PPT
Pass4sure 300-101 CCNP Routing And Switching Protocol
PDF
Configuring Ip Sec Between A Router And A Pix
PDF
Lab8 Controlling traffic using Extended ACL Objectives Per.pdf
PPT
Intro to router_config
PPTX
How to convert your Linux box into Security Gateway - Part 1
PDF
Cisco Internetworking Operating System (ios)
PDF
Ccna command
PPTX
ccnp routing.pptx
DOC
Enterprise Network Manager: the Router-On-A-stick
PDF
Uccn1003 -may10_-_lect04a_-_intro_to_routing_rules
PPT
Packet_Filteringfgasdgasdgsagdsgsagasg.ppt
PPTX
ACCESS CONTROL LIST (Standard and Dynamic).pptx
PPTX
Frame Relay (Multipoint)
PPT
Intro to router_config
DOCX
All contents are Copyright © 1992–2012 Cisco Systems, Inc. A.docx
QoS marking on cisco IOS Router
Labmannual
Ccna2 mod3-configuring a-router
CCNA ppt Day 4
Ccn pv7 route_lab2-1_eigrp-load-balancing_student
Pass4sure 300-101 CCNP Routing And Switching Protocol
Configuring Ip Sec Between A Router And A Pix
Lab8 Controlling traffic using Extended ACL Objectives Per.pdf
Intro to router_config
How to convert your Linux box into Security Gateway - Part 1
Cisco Internetworking Operating System (ios)
Ccna command
ccnp routing.pptx
Enterprise Network Manager: the Router-On-A-stick
Uccn1003 -may10_-_lect04a_-_intro_to_routing_rules
Packet_Filteringfgasdgasdgsagdsgsagasg.ppt
ACCESS CONTROL LIST (Standard and Dynamic).pptx
Frame Relay (Multipoint)
Intro to router_config
All contents are Copyright © 1992–2012 Cisco Systems, Inc. A.docx

More from NetProtocol Xpert (20)

PPTX
Basic Cisco ASA 5506-x Configuration (Firepower)
PPTX
MPLS Layer 3 VPN
PPTX
Common Layer 2 Threats, Attacks & Mitigation
PPTX
Storm-Control
PPTX
Dynamic ARP Inspection (DAI)
PPTX
IP Source Guard
PPTX
DHCP Snooping
PPTX
Password Recovery
PPTX
Application & Data Center
PPTX
Cisco ISR 4351 Router
PPTX
Cisco ASR 1001-X Router
PPTX
Securing management, control & data plane
PPTX
Point to-point protocol (ppp), PAP & CHAP
PPTX
Avoid DNS lookup when mistyping a command
PPTX
TCLSH and Macro Ping Test on Cisco Routers and Switches
PPTX
Private VLANs
PPTX
MTU (maximum transmission unit) & MRU (maximum receive unit)
PPTX
OTV Configuration
PPTX
Cisco OTV 
PPTX
OTV(Overlay Transport Virtualization)
Basic Cisco ASA 5506-x Configuration (Firepower)
MPLS Layer 3 VPN
Common Layer 2 Threats, Attacks & Mitigation
Storm-Control
Dynamic ARP Inspection (DAI)
IP Source Guard
DHCP Snooping
Password Recovery
Application & Data Center
Cisco ISR 4351 Router
Cisco ASR 1001-X Router
Securing management, control & data plane
Point to-point protocol (ppp), PAP & CHAP
Avoid DNS lookup when mistyping a command
TCLSH and Macro Ping Test on Cisco Routers and Switches
Private VLANs
MTU (maximum transmission unit) & MRU (maximum receive unit)
OTV Configuration
Cisco OTV 
OTV(Overlay Transport Virtualization)

Recently uploaded (20)

PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
web development for engineering and engineering
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
composite construction of structures.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Sustainable Sites - Green Building Construction
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
web development for engineering and engineering
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
composite construction of structures.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Internet of Things (IOT) - A guide to understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Sustainable Sites - Green Building Construction

QoS Pre-Classify on Cisco IOS

  • 1. QoS Pre-Classify on Cisco IOS Quality of Service (QoS) | www.netprotocolxpert.in
  • 2. • When we use tunnelling, your Cisco IOS router will do classification based on the outer (post) header, not the inner (pre) header. This can cause issues with QoS policies that are applied to the physical interfaces. I will explain the issue and we will take a look how we can Fix it. Here’s the topology that we will use:
  • 3. • Using a static route so that R1 and R3 can reach each other’s loopback interfaces through the tunnel: • R1(config)#interface Tunnel 0 • R1(config‐if)#tunnel source 192.168.12.1 • R1(config‐if)#tunnel destination 192.168.23.3 • R1(config‐if)#ip address 172.16.13.1 255.255.255.0 • R1(config)#ip route 3.3.3.3 255.255.255.255 172.16.13.3 • The configuration on R3 is similar: • R3(config)#interface Tunnel 0 • R3(config‐if)#tunnel source 192.168.23.3 • R3(config‐if)#tunnel destination 192.168.12.1 • R3(config‐if)#ip address 172.16.13.3 255.255.255.0 • R3(config)#ip route 1.1.1.1 255.255.255.255 172.16.13.1
  • 4. Default Classification Behaviour • The tunnel is up and running, before we play with classification and service policies, let’s take a look at the default classification behaviour of Cisco IOS • IOS will copy the information in theTOS (Type of Service) byte from the inner IP header to the outer IP header by default.We can demonstrate this with a simple ping.
  • 5. • Loose, Strict, Record,Timestamp, Verbose[none]: • Sweep range of sizes [n]: • Type escape sequence to abort. • Sending 5, 100‐byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: • Packet sent with a source address of 1.1.1.1 • !!!!! • Success rate is 100 percent (5/5), round‐trip min/avg/max = 1/2/4 ms • R1#ping • Protocol [ip]: • Target IP address: 3.3.3.3 • Repeat count [5]: • Datagram size [100]: • Timeout in seconds [2]: • Extended commands [n]: y • Source address or interface: 1.1.1.1 • Type of service [0]: 160 • Set DF bit in IP header? [no]: • Validate reply data? [no]: • Data pattern [0xABCD]:
  • 6. • This ping between 1.1.1.1 and 3.3.3.3 will go through the tunnel and I marked the TOS byte of this IP packet with 160 (decimal). 160 in binary is 10100000, remove the last two bits and you have our 6 DSCP bits. 101000 in binary is 40 in decimal which is the same as the CS5. wireshark capture of this ping: Cont.…
  • 8. • As we can see, Cisco IOS automatically copied the TOS byte from the inner IP header to the outer IP header. This is a good thing, We are using GRE in our example so we can see both headers but if this was an encrypted IPSEC tunnel then we (and any device in between) could only see the outer header. • When you have QoS policies based on the TOS byte then you will have no problems at all because the TOS byte is copied from the inner to the outer header. We will run into issues when you have policies based on access-lists that match on source / destination addresses and/or port numbers.
  • 9. Post Header Classification • We are going to create two class-maps, one for telnet traffic and another one for GRE traffic. Both class-maps will use an access-list to classify traffic: • R1(config)#ip access‐list extendedTELNET • R1(config‐ext‐nacl)#permit tcp any any eq telnet • R1(config)#class‐mapTELNET • R1(config‐cmap)#match access‐group nameTELNET • R1(config)#ip access‐list extended GRE • R1(config‐ext‐nacl)#permit gre any any • R1(config)#class‐map GRE • R1(config‐cmap)#match access‐group name GRE
  • 10. The two class-maps will be used in a policy-map: • R1(config)#policy‐map POLICE • R1(config‐pmap)#classTELNET • R1(config‐pmap‐c)#police 128000 • R1(config‐pmap‐c‐police)#exit • R1(config‐pmap‐c)#exit • R1(config‐pmap)#class GRE • R1(config‐pmap‐c)#exit • R1(config‐pmap)#exit
  • 11. • We’ve added policing for telnet traffic and nothing for GRE. It doesn’t matter what “actions” we configure here, even without an action the traffic will still be classified and it will show up in the policy-map. Let’s activate it on the physical interface: • R1(config)#interface FastEthernet 0/0 • R1(config‐if)#service‐policy output POLICE • Something to keep in mind is that when you enable a policy on the physical interface, it will be applied to all tunnel interfaces. • Generate some telnet traffic between R1 and R3 so it goes through the tunnel: • R1#telnet 3.3.3.3 /source‐interface loopback 0 • Trying 3.3.3.3 ... Open
  • 12. • R1#show policy‐map interface FastEthernet 0/0 • FastEthernet0/0 • Service‐policy output: POLICE • Class‐map:TELNET (match‐all) •0 packets, 0 bytes •5 minute offered rate 0 bps, drop rate 0 bps •Match: access‐group nameTELNET •police: •cir 128000 bps, bc 4000 bytes •conformed 0 packets, 0 bytes; actions: •transmit •exceeded 0 packets, 0 bytes; actions:
  • 13. •drop • conformed 0 bps, exceed 0 bps • Class‐map: GRE (match‐all) • 11 packets, 735 bytes • 5 minute offered rate 0 bps • Match: access‐group name GRE • Class‐map: class‐default (match‐any) • 2 packets, 120 bytes • 5 minute offered rate 0 bps, drop rate 0 bps • Match: any
  • 14. • We don’t have any matches for the telnet traffic. • If this was a real network, it means that telnet traffic will never get policed (or any other action you configured). The reason that we don’t see any matches is because Cisco IOS first encapsulates the IP packet and then applies the policy to the GRE traffic.
  • 15. Encapsulates the IP packet The blue IP header on top is our original IP packet with telnet traffic, this is encapsulated and the router adds a GRE header and a new IP header (the red one).The policy-map is then applied to this outer IP header.
  • 16. Pre Header Classification (Physical Interface) • The first method to solve this issue is to enable pre-classification on the tunnel interface. This tells the router to create a copy of the original IP header and to use that for the policy. Here's how to do this: • R1(config)#interfaceTunnel 0 • R1(config‐if)#qos pre‐classify
  • 17. • R1#clear counters • Clear "show interface" counters on all interfaces [confirm] • R1#telnet 3.3.3.3 /source‐interface loopback 0 • Trying 3.3.3.3 ... Open
  • 18. Now take a look at the policy-map: • R1#show policy‐map interface FastEthernet 0/0 • FastEthernet0/0 • Service‐policy output: POLICE • Class‐map: TELNET (match‐all) •11 packets, 735 bytes •5 minute offered rate 0 bps, drop rate 0 bps •Match: access‐group nameTELNET •police: •cir 128000 bps, bc 4000 bytes •conformed 11 packets, 889 bytes; actions: •transmit Cont.…
  • 19. • exceeded 0 packets, 0 bytes; actions: •drop • conformed 0 bps, exceed 0 bps • Class‐map: GRE (match‐all) • 0 packets, 0 bytes • 5 minute offered rate 0 bps • Match: access‐group name GRE • Class‐map: class‐default (match‐any) • 1 packets, 60 bytes • 5 minute offered rate 0 bps, drop rate 0 bps • Match: any Now we see matches on our telnet traffic so it can be policed if needed. We don't see any matches on our GRE traffic anymore.
  • 20. When the router encapsulates a packet, it will make a temporary copy of the header. This temporary copy is then used for the policy instead of the outer header. When this is done, the temporary copy is destroyed. We accomplished this with the qos pre-classify command but there is another method to get the same result.
  • 21. Pre Header Classification (Tunnel Interface) • Instead of activating the policy on the physical interface we can also enable it on the tunnel interface: • R1(config)#interface FastEthernet 0/0 • R1(config‐if)#no service‐policy output POLICE • R1(config)#interfaceTunnel 0 • R1(config‐if)#no qos pre‐classify • R1(config‐if)#service‐policy output POLICE
  • 22. • Note that I also removed the qos pre-classify command on the tunnel interface. Let's give it another try: • R1#clear counters • Clear "show interface" counters on all interfaces [confirm] • R1#telnet 3.3.3.3 /source‐interface loopback 0 • Trying 3.3.3.3 ... Open
  • 23. • R1#show policy‐map interfaceTunnel 0 • Tunnel0 • Service‐policy output: POLICE • Class‐map: TELNET (match‐all) •11 packets, 737 bytes •5 minute offered rate 0 bps, drop rate 0 bps •Match: access‐group nameTELNET •police: •cir 128000 bps, bc 4000 bytes •conformed 11 packets, 737 bytes; actions: •transmit •exceeded 0 packets
  • 24. •drop • conformed 0 bps, exceed 0 bps • Class‐map: GRE (match‐all) • 0 packets, 0 bytes • 5 minute offered rate 0 bps • Match: access‐group name GRE • Class‐map: class‐default (match‐any) • 0 packets, 0 bytes • 5 minute offered rate 0 bps, drop rate 0 bps • Match: any
  • 25. • If you enable the policy on the tunnel interface then the router will use the inner header for classification, just like we saw when we used the qos pre-classify command on the tunnel interface. • That's all there is to explain. We hope this lesson has been useful to understand the difference between "outer" and "inner" header classification and how to deal with this issue.