Configuring CoS for Tunnels

CoS queuing, scheduling, and shaping allow you to control and improve the flow of traffic through tunnel interfaces like GRE and IP-IP interfaces. The GRE and IP-IP interfaces on a J Series device are internal, configurable interfaces named gr-0/0/0 and ip-0/0/0.

To configure CoS for a GRE or IP-IP tunnel, you must first enable tunnel queuing on the router. If tunnel queuing is not enabled, the router continues to send traffic through the tunnel but ignores any configured CoS schedulers and shapers.

Note: You cannot enable tunnel queuing on J Series interfaces other than tunnel interfaces, although the router allows you to commit such a configuration.

You then define the GRE or IP-IP tunnel interface and its per-unit scheduler and set a line rate for the tunnel with the CoS shaper.

To configure CoS for tunnels, include the following statements at the [edit class-of-service] and [edit interfaces] hierarchy level:

[edit class-of-service] interfaces {tunnel-interface-name { unit logical-unit-number {scheduler-map scheduler-map-name;shaping-rate, rate;rewrite-rules {dscp (rewrite-name | default); dscp-ipv6 (rewrite-name | default); exp (rewrite-name | default) protocol protocol-types; exp-push-push-push default; exp-swap-push-push default; ieee-802.1 (rewrite-name | default);inet-precedence (rewrite-name | default);}}}schedulersgre_be {transmit-rate transmit-rate-percent;shaping-rate rate;buffer-size buffer-size-percent;priority low;drop-profile-map loss-priority any protocol any drop-profile DP1;}gre_ef {transmit-rate transmit-rate-percent;shaping-rate rate;buffer-size buffer-size-percent;priority low;drop-profile-map loss-priority high protocol any drop-profile DP1;}}scheduler-maps {gre_sched_map {forwarding-class fc_be scheduler gre_be;forwarding-class fc_ef scheduler gre_ef;forwarding-class fc_af scheduler gre_af;forwarding-class fc_nc scheduler gre_nc;}ipip_sched_map {forwarding-class fc_be scheduler ipip_be;forwarding-class fc_ef scheduler ipip_ef;forwarding-class fc_af scheduler ipip_af;forwarding-class fc_nc scheduler ipip_nc;}}rewrite-rules{(dscp | dscp-ipv6 | exp | ieee-802.1 | inet-precedence) rewrite-name {import (rewrite-name | default);forwarding-class class-name {loss-priority level code-point (alias | bits);}}}[edit interfaces]tunnel-interface-name {per-unit-scheduler;unit logical-unit-number;copy-tos-to-outer-ip-header;}}

For an example of configuring GRE tunnels, see Example: Configuring CoS for GRE/IPIP tunnels.

Configuring CoS Queuing for Tunnels with a Configuration Editor

To configure COS queuing for GRE or IP-IP tunnels:

  1. Navigate to the top of the configuration hierarchy in either the J-Web or CLI configuration editor.
  2. Perform the configuration tasks described in Table 39 to configure CoS queuing for tunnel interfaces.
    1. Enable tunnel queuing on the router.
    2. Define the GRE or IP-IP tunnel interface.
    3. Define the per-unit scheduler for the GRE or IP-IP tunnel interface.
    4. Define the tunnel's line rate by using the shaper definition.
  3. Configure forwarding classes and schedulers.

    For information on configuring forwarding classes, see Assigning Forwarding Classes to Output Queues. For information on configuring schedulers, see Configuring Schedulers.

  4. Configure a scheduler map and apply the scheduler map to the tunnel interface. For information on configuring a scheduler map, see Configuring and Applying Scheduler Maps .
  5. Configure classifiers and apply them to the tunnel interface.

    For information on configuring classifiers, see Configuring and Applying Behavior Aggregate Classifiers .

  6. Create rewrite rules and apply them to the tunnel interface.

    For information on configuring rewrite rules, see Configuring and Applying Rewrite Rules.

  7. If you are finished configuring the router, commit the configuration.
  8. Go on to one of the following tasks:

Table 39: Configuring CoS for GRE Tunnels

Task

J-Web Configuration Editor

CLI Configuration Editor

Navigate to the Chassis level in the configuration hierarchy, and enable tunnel queuing on the router.

  1. In the J-Web interface, select Configure>CLI Tools>Point and Click CLI.
  2. Next to Chassis, click Configure or Edit.
  3. Next to Fpc, click Add new entry.
  4. Next to Slot, type 0.
  5. Next to Pic, click Add New Entry.
  6. Next to Slot, type 0.
  7. Select the check box next to Tunnel queuing.
  8. Click OK until you return to the main Configuration page.

From the [edit] hierarchy level, enter

edit chassis fpc 0 pic 0 tunnel-queuing

Navigate to the Interfaces level in the configuration hierarchy, and define the GRE tunnel interface gr-0/0/0.

  1. On the main Configuration page, next to Interfaces click Configure or Edit.
  2. In the Interfaces name box, type gr-0/0/0.
  3. Next to Unit, click Add new entry.
  4. In the Interfaces unit number box, type 0.
  5. Click OK.

From the [edit] hierarchy level, enter

edit interfaces gr-0/0/0 unit 0

Define the per-unit scheduler for the GRE tunnel interface.

  1. From the Scheduler type list, select Per unit scheduler.
  2. Click OK until you return to the main Configuration page.

From the [edit] hierarchy level, enter

set interfaces gr-0/0/0 per-unit-scheduler

Navigate to the Class of service level in the configuration hierarchy, and define the GRE tunnel's line rate (for example, 100 Mbps) by using the shaper definition.

  1. On the main configuration page next to Class of service, click Configure or Edit.
  2. Next to Interfaces, click Add new entry.
  3. In the Interface name box, type the name of the interface gr-0/0/0.
  4. Next to unit, click Add New Entry.
  5. In the Interface unit number box, type the logical interface unit number 0.
  6. Select the Shaping rate check box, and click Configure.
  7. Next to Shaping Rate choice, select Rate.
  8. In the Rate box, type 100m.
  9. Click OK until you return to the main Class of Service configuration page.

From the [edit] hierarchy level, enter

set class-of-service interfaces gr-0/0/0 unit 0 shaping-rate 100m

Preserving the ToS Value of a Tunneled Packet

To ensure that the tunneled packet continues to have the same CoS treatment even in the physical interface, you must preserve the type-of-service (ToS) value from the inner IP header to the outer IP header.

For transit traffic, JUNOS Software preserves the CoS value of the tunnel packet for both GRE and IP-IP tunnel interfaces. The inner IPv4 or IPv6 ToS bits are copied to the outer IPv4 ToS header for both types of tunnel interfaces.

For Routing Engine traffic, however, the router handles GRE tunnel interface traffic differently from IP-IP tunnel interface traffic. Unlike for IP-IP tunnels, the IPv4 ToS bits are not copied to the outer IPv4 header by default. You have a configuration option to copy the ToS value from the packet's inner IPv4 header to the outer IPv4 header.

To copy the inner ToS bits to the outer IP header (which is required for some tunneled routing protocols) on packets sent by the Routing Engine, include the copy-tos-to-outer-ip-header statement at the logical unit hierarchy level of a GRE interface.

Note: For IPv6 traffic, the inner ToS value is not copied to the outer IPv4 header for both GRE and IP-IP tunnel interfaces even if the copy-tos-to-outer-ip-header statement is specified.

This example copies the inner ToS bits to the outer IP header on a GRE tunnel:

[edit interfaces]gr-0/0/0 {unit 0 {copy-tos-to-outer-ip-header;family inet;}}

Example: Configuring CoS for GRE/IPIP tunnels

In the network shown in Figure 5, Router A has a GRE tunnel established with Router B through interface ge-1/0/0. Router A also has an IPIP tunnel established with Router C through interface ge-1/0/2. Router A is configured so that tunnel-queuing is enabled. Routers B and Router C do not have tunnel-queuing configured.

Figure 5: Configuring CoS Queuing for GRE Tunnels

Image g030652.gif

Router A (has tunnel queuing)

chassis {fpc 0 {pic 0 {tunnel-queuing;}}}interfaces gr-0/0/0 {per-unit-scheduler;unit 0 {tunnel {source 192.12.12.1;destination 192.12.12.2;ttl 4;}family inet {address 192.22.22.1/30;}copy-tos-to-outer-ip-header;}}ip-0/0/0 {per-unit-scheduler;unit 0 {tunnel {source 192.13.13.1;destination 192.13.13.2;ttl 4;}family inet {address 192.33.33.1/30;}}}ge-1/0/0 {unit 0 {family inet { address 192.12.12.1/24;}}}ge-1/0/1 {unit 0 {family inet { address 192.13.13.1/24;}}}class-of-service {classifiers {dscp gre-dscp {forwarding-class fc_be {loss-priority high code-points 000000;}forwarding-class fc_ef {loss-priority high code-points 101110;}forwarding-class fc_af{loss-priority low code-points 001010;}forwarding-class fc_nc {loss-priority low code-points 111111;}}inet-precedence ipip-inet-prec {forwarding-class fc_be {loss-priority high code-points 000;}forwarding-class fc_ef {loss-priority high code-points 001;}forwarding-class fc_af {loss-priority low code-points 010;}forwarding-class fc_nc {loss-priority low code-points 011;}}}drop-profiles { DP1 {fill-level 80 drop-probability 60;}DP2 {fill-level 75 drop-probability 80;}}forwarding-classes {queue 0 fc_be;queue 1 fc_ef;queue 2 fc_af;queue 3 fc_nc;}interfaces {gr-0/0/0 {unit 0 {scheduler-map gre_sched_map;shaping-rate 4m;classifiers {dscp gre-dscp;}rewrite-rules {inet-precedence tnl_rw;}}}ip-0/0/0 {unit 0 {scheduler-map ipip_sched_map;shaping-rate 7m;classifiers {inet-precedence ipip-inet-prec}rewrite-rules {inet-precedence tnl_rw;}}}}rewrite-rules {inet-precedence tnl_rw {forwarding-class fc_be {loss-priority high code-point 100;}forwarding-class fc_ef {loss-priority low code-point 101;}forwarding-class fc_af {loss-priority high code-point 110;}forwarding-class fc_nc {loss-priority high code-point 111;}}}scheduler-maps {gre_sched_map {forwarding-class fc_be scheduler gre_be;forwarding-class fc_ef scheduler gre_ef;forwarding-class fc_af scheduler gre_af;forwarding-class fc_nc scheduler gre_nc;}ipip_sched_map {forwarding-class fc_be scheduler ipip_be;forwarding-class fc_ef scheduler ipip_ef;forwarding-class fc_af scheduler ipip_af;forwarding-class fc_nc scheduler ipip_nc;}}schedulers {gre_be {transmit-rate percent 30;shaping-rate 2m;buffer-size percent 30;priority low;drop-profile-map loss-priority high protocol any drop-profile DP1;}gre_ef {transmit-rate percent 30;shaping-rate 1m;buffer-size percent 30;priority low;drop-profile-map loss-priority high protocol any drop-profile DP1;}gre_af {transmit-rate percent 25;buffer-size percent 25;priority high;drop-profile-map loss-priority high protocol any drop-profile DP1;}gre_nc {transmit-rate percent 15;buffer-size percent 15;priority high;drop-profile-map loss-priority high protocol any drop-profile DP1;}ipip_be {transmit-rate percent 40;shaping-rate 3m;buffer-size percent 40;priority lowdrop-profile-map loss-priority high protocol any drop-profile DP1;}ipip_ef {transmit-rate percent 20;shaping-rate 1m;buffer-size percent 20;priority low;drop-profile-map loss-priority high protocol any drop-profile DP1;}ipip_af {transmit-rate percent 20;buffer-size percent 20;priority high;drop-profile-map loss-priority high protocol any drop-profile DP1;}ipip_nc {transmit-rate percent 20;buffer-size percent 20;priority high;drop-profile-map loss-priority high protocol any drop-profile DP1;}}

Router B (has no tunnel queuing)

interface gr-0/0/0 {per-unit-scheduler;unit 0 {tunnel {source 192.12.12.2;destination 192.12.12.1;ttl 4;}family inet {address 192.22.22.2/30;}copy-tos-to-outer-ip-header;}}ge-1/0/3 {unit 0 {family inet {address 192.12.12.2/24;}}}

Router C (has no tunnel queuing)

interface ip-0/0/0 {per-unit-scheduler;unit 0 {tunnel {source 192.13.13.2;destination 192.13.13.1;ttl 4;}family inet {address 192.33.33.2/30;}}}ge-1/0/2 {unit 0 {family inet {address 192.13.13.2/24;}}}

Restrictions on CoS Shapers

On a J Series device, when defining a CoS shaping rate on a tunnel interface, be aware of the following restrictions: