一篇國外大佬關(guān)于QoS Pre-classify in GRE over IPsec VPNs經(jīng)典文章

QoS Pre-classify in GRE over IPsec?VPNs

Posted by?Andy?on November 29, 2008

When a packet is encapsulated and/or encrypted, theToS byte is by default copied to the new IP header, however the other headerfields are no longer available for classification and QoS actions.? QoS pre-classify allows IOS to create a temporary copy of a packet?in memory?to be used for classification so that QoS actions can be performed on the final packet after encapsulation and/or encryption.? This example will take a look at the three different ways QoS preclassification can beconfigured in a GRE over IPsec VPN, what the results are of each, and why each of them behave the way that they do.? The following diagram shows the topology for this example:

R1 has a GRE over IPsec tunnel to R3 which will beused to encrypt traffic between each of their LAN subnets.? R1 isconnected to ‘Host’ which will be used to simulate a host on the LAN for traffic generation to test our QoS preclassify configuration.? R3 is usinga loopback to simulate its LAN.? The relevant portions of each router’s intial configuration are shown below:



Since we will be testing preclassification outbound on R1′s S0/0 interface, we do not want any traffic being sent out the interface besides the traffic that we generate in order to make the results easier to interpret.? To accomplish this, we will create static routes on R1 and R3 so that no routing protocol traffic is needed, and disable unnecessary services on R1 that create traffic.? R2 does not need any static routes to createfull reachability because all traffic between R1 and R3′s LAN subnets will be sent through the VPN and destined to R1 or R3′s S0/0 interfaces, which are directly connected to R2.? The config for R1 and R3 is as follows:


Next,? let’s create a policy map to use for testing how our traffic is classified.? When we test it out, we will generate?pings from ‘Host’ to R3′s loopback.? Depending on when the classification is performed, the traffic could be classified as either ICMP traffic, GRE traffic, or ESP traffic so we will create a class to match each?and add them to a policy map.? Finally, we will enable the policy map on R1 S0/0 outbound.

Now we’re ready to look at how traffic is classified in each of the three scenarios.? The first scenario is with no preclassification configured – in other words, the default behavior.? We ping from ‘Host’ to R3′s loopback and examine the classification results in our policy map on R1:

The?packets have been classified as ESP traffic,and the QoS actions (if we had configured any) for that class would be performed on the final outgoing packet.? This generally isn’t very useful in a real network, since we don’t know what type of traffic is inside the ESP packet.? That’s?where QoS preclassification comes in.

The second scenario we will look at is with?qos

pre-classify configured?on the crypto map.? We configure this on R1 and?clear the counters to remove the traffic statistics from our previous example:

Then we initiate another ping from ‘Host’ to R3′s loopback and view the policy map statistics on R1 again:

This time the packets have been classified as GRE traffic.? Again, this is probably not very useful because we do not know what is encapsulated within the GRE packet.

For the third scenario, we will configure?qos?pre-classifyon the Tunnel 0 interface.? First remove the?qos?pre-classify from the crypto map in the previous scenario, then configure it on the tunnel interface and clear the counters:

Then initate a ping from ‘Host’ to R3′s loopback again and view the policy map statistics:

This time the traffic has been classified as ICMP andif we had configured any QoS actions for ICMP traffic, they would be performed on the final ESP packet when it leaves the router.

Why does the router classify the traffic like this in each scenario?? It’s probably easiest to start with the?third scenario, followed by the second, and finally the first.

Scenario #3 – Preclassify on the tunnel interface

1. R1 receives an ICMP packet from ‘Host’ to R3′sloopback.

2. R1 performs a routing table lookup on the packet and finds3.3.3.0 /24 out interface Tunnel 0 as the best match, which we configured statically

3. R1 ‘sends’ the packet to Tunnel 0 and finds the?qos

pre-classify command configured.? A temporary copy of the ICMP packet is created at this point to be used for classification, as shown below:

Scenario #2 – Preclassify on the crypto map

1. R1 receives an ICMP packet from ‘Host’ to R3′sloopback.

2. R1 performs a routing table lookup on the packet and finds3.3.3.0 /24 out interface Tunnel 0 as theb est match, which we configured statically

3. R1 ‘sends’ the packet to?Tunnel 0.? The tunnel mode, which was left at default,?is?gre ip.? R1 adds a GRE header and a new IP header outside the GRE header, using the?tunnel?source and?tunnel destination?addresses that are configured on the tunnel interface as the source and destination for the new IP header.

4. R1 performs a routing table lookup on the new destination address,10.1.23.3, and finds the default route out interface S0/0 as the best match (this was configured statically as well).

5. R1 finds that there is a?crypto map?configuredon S0/0 and finds the?qos pre-classify?command in the crypto map.?A temporary copy of the packet is created at this point to be used for classification, as shown below:

Scenario #1 – No preclassification configured

1. R1 receives an ICMP packet from ‘Host’ to R3′sloopback.

2. R1 performs a routing table lookup on the packet and finds3.3.3.0 /24 out interface Tunnel 0 as the best match, which we configured statically

3. R1 ‘sends’ the packet to?Tunnel 0.? The tunnel mode, which was left at default,?is?gre ip.? R1 adds a GRE header and a new IP header outside the GRE header, using the?tunnel?source and?tunnel destination?addresses that are configured on the tunnel interface as the source and destination for the new IP header.

4. R1 performs a routing table lookup on the new destination address,10.1.23.3, and finds the default route out interface S0/0 as the best match (this was configured statically as well).

5. R1 finds that there is a?crypto map?configuredon S0/0 and that the GRE packet matches the ACL in the crypto map.? R1 adds an ESP header and a new IP header outside the ESP header, as specified by the crypto map and IPsec transform set.

6. R1 performs classification on the final ESP packet and sends the packet out S0/0, as shown below:

One final scenario to look at is configuring the service policy on the tunnel interface rather than the physical interface without using preclassification:


Then we initiate a ping from ‘Host’ to R3′s loopback again and view the statistics:

Just like the third scenario, the traffic is classified as ICMP, and no preclassification was even needed.? However,this service policy will only be applied to traffic exiting Tunnel 0, whereas the first three scenarios would apply to traffic exiting S0/0, Tunnel 0, and any other tunnel interfaces that were configured to use S0/0.? Ultimately,the choice of where to apply the service policy and where or if to apply QoS preclassification ?will depend on what is trying to be accomplished.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末材蛛,一起剝皮案震驚了整個(gè)濱河市堆巧,隨后出現(xiàn)的幾起案子叉抡,更是在濱河造成了極大的恐慌,老刑警劉巖名扛,帶你破解...
    沈念sama閱讀 212,542評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異蹈集,居然都是意外死亡闺兢,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,596評論 3 385
  • 文/潘曉璐 我一進(jìn)店門帽揪,熙熙樓的掌柜王于貴愁眉苦臉地迎上來硝清,“玉大人,你說我怎么就攤上這事转晰÷茫” “怎么了?”我有些...
    開封第一講書人閱讀 158,021評論 0 348
  • 文/不壞的土叔 我叫張陵查邢,是天一觀的道長蔗崎。 經(jīng)常有香客問我,道長侠坎,這世上最難降的妖魔是什么蚁趁? 我笑而不...
    開封第一講書人閱讀 56,682評論 1 284
  • 正文 為了忘掉前任,我火速辦了婚禮实胸,結(jié)果婚禮上他嫡,老公的妹妹穿的比我還像新娘番官。我一直安慰自己,他們只是感情好钢属,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,792評論 6 386
  • 文/花漫 我一把揭開白布徘熔。 她就那樣靜靜地躺著,像睡著了一般淆党。 火紅的嫁衣襯著肌膚如雪酷师。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,985評論 1 291
  • 那天染乌,我揣著相機(jī)與錄音山孔,去河邊找鬼。 笑死荷憋,一個(gè)胖子當(dāng)著我的面吹牛台颠,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播勒庄,決...
    沈念sama閱讀 39,107評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼串前,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了实蔽?” 一聲冷哼從身側(cè)響起荡碾,我...
    開封第一講書人閱讀 37,845評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎局装,沒想到半個(gè)月后坛吁,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,299評論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡铐尚,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,612評論 2 327
  • 正文 我和宋清朗相戀三年阶冈,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片塑径。...
    茶點(diǎn)故事閱讀 38,747評論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡女坑,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出统舀,到底是詐尸還是另有隱情匆骗,我是刑警寧澤,帶...
    沈念sama閱讀 34,441評論 4 333
  • 正文 年R本政府宣布誉简,位于F島的核電站碉就,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏闷串。R本人自食惡果不足惜瓮钥,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,072評論 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧碉熄,春花似錦桨武、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,828評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至琼梆,卻和暖如春性誉,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背茎杂。 一陣腳步聲響...
    開封第一講書人閱讀 32,069評論 1 267
  • 我被黑心中介騙來泰國打工错览, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人煌往。 一個(gè)月前我還...
    沈念sama閱讀 46,545評論 2 362
  • 正文 我出身青樓蝗砾,卻偏偏與公主長得像,于是被迫代替她去往敵國和親携冤。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,658評論 2 350

推薦閱讀更多精彩內(nèi)容