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 router 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.
In the network shown in Figure 92, Router A acts as a tunnel ingress device. The link between GRE tunnel interfaces ge-1/0/0 in Router A and ge-1/0/3 in Router B is the GRE tunnel. Router A monitors the traffic received from interface ge-1/0/3. By way of interface ge-1/0/2, Router C generates traffic to Router B.
Figure 92: Configuring CoS Queing for GRE Tunnels

To configure COS queuing for GRE or IP-IP tunnels:
For information on configuring forwarding classes, see Assigning Forwarding Classes to Output Queues. For information on configuring schedulers, see Configuring Schedulers .
For information on configuring classifiers, see Configuring and Applying Behavior Aggregate Classifiers .
For information on configuring rewrite rules, see Configuring and Applying Rewrite Rules.
Table 209: Configuring CoS for GRE Tunnels
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;
- }
- }