Example: Configuring CoS for GRE or IP-IP Tunnels
This topic provides an example of how to configure class of service (CoS) for GRE or IP-IP tunnels.
Requirements
No special configuration beyond device initialization is required before configuring this example.
Overview
Topology
In Figure 1, Router A acts as a tunnel
ingress device. The link between interfaces ge-1/0/0
in
Router A and ge-1/3/0
in Router B is the GRE or IP-IP tunnel.
Router A monitors the traffic received from interface ge-1/3/0
. By way of interface ge-1/0/0
, Router C generates traffic
to Router B.
Configuration
To configure this example, perform these tasks:
CLI Quick Configuration
To quickly configure this example, copy the
following commands, paste them into a text file, remove any line breaks,
change any details necessary to match your network configuration,
and then copy and paste the commands into the CLI at the [edit]
hierarchy level.
Router A
set interfaces ge-1/0/0 unit 0 family inet address 10.80.0.2/24 set interfaces ge-1/0/1 unit 0 family inet filter input zf-catch-all set interfaces ge-1/0/1 unit 0 family inet address 10.90.0.2/24 set interfaces gr-2/1/0 unit 0 tunnel source 10.11.11.11 destination 10.255.245.46 set interfaces gr-2/1/0 unit 0 family inet address 10.21.21.21/24 set interfaces ip-2/1/0 unit 0 tunnel source 10.12.12.12 destination 10.255.245.46 set interfaces ip-2/1/0 unit 0 family inet address 10.22.22.22/24 set routing-options static route 10.1.1.1/32 next-hop gr-2/1/0.0 set routing-options static route 10.2.2.2/32 next-hop ip-2/1/0.0 set class-of-service interfaces ge-1/0/0 unit 0 rewrite-rules inet-precedence zf-tun-rw-ipprec-00 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class best-effort loss-priority low code-point 000 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class best-effort loss-priority high code-point 001 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class expedited-forwarding loss-priority low code-point 010 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class expedited-forwarding loss-priority high code-point 011 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class assured-forwarding loss-priority low code-point 100 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class assured-forwarding loss-priority high code-point 101 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class network-control loss-priority low code-point 110 set class-of-service rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class network-control loss-priority high code-point 111 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class best-effort loss-priority low code-point 000000 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class best-effort loss-priority high code-point 001001 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class expedited-forwarding loss-priority low code-point 010010 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class expedited-forwarding loss-priority high code-point 011011 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class assured-forwarding loss-priority low code-point 100100 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class assured-forwarding loss-priority high code-point 101101 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class network-control loss-priority low code-point 110110 set class-of-service rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class network-control loss-priority high code-point 111111 set firewall filter zf-catch-all term term1 then loss-priority high set firewall filter zf-catch-all term term1 then forwarding-class network-control
Router B
user@router-B# set interfaces ge-1/3/0 unit 0 family inet address 10.80.0.1/24 user@router-B# set interfaces lo0 unit 0 family inet address 10.255.245.46/32
Router C
set interfaces ge-1/0/0 unit 0 family inet address 10.90.0.1/24 set routing-options static route 10.1.1.1/32 next-hop 10.90.0.2 set routing-options static route 10.2.2.2/32 next-hop 10.90.0.2
Configuring Router A
Procedure
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure router A:
Configure the device interfaces.
[edit interfaces] user@router-A# set ge-1/0/0 unit 0 family inet address 10.80.0.2/24 user@router-A# set ge-1/0/1 unit 0 family inet filter input zf-catch-all user@router-A# set ge-1/0/1 unit 0 family inet address address 10.90.0.2/24 user@router-A# set gr-2/1/0 unit 0 tunnel source 10.11.11.11 destination 10.255.245.46 user@router-A# set gr-2/1/0 unit 0 family inet address 10.21.21.21/24 user@router-A# set ip-2/1/0 unit 0 tunnel source 10.12.12.12 destination 10.255.245.46 user@router-A# set ip-2/1/0 unit 0 family inet address 10.22.22.22/24
Configure the static routes.
[edit routing-options static] user@router-A# set static route 10.1.1.1/32 next-hop gr-2/1/0.0 user@router-A# set static route 10.2.2.2/32 next-hop ip-2/1/0.0
Apply the rewrite rule to the interface.
[edit class-of-service] user@router-A# set interfaces ge-1/0/0 unit 0 rewrite-rules inet-precedence zf-tun-rw-ipprec-00
Define the rewrite rules.
[edit class-of-service] user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class best-effort loss-priority low code-point 000 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class best-effort loss-priority high code-point 001 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class expedited-forwarding loss-priority low code-point 010 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class expedited-forwarding loss-priority high code-point 011 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class assured-forwarding loss-priority low code-point 100 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class assured-forwarding loss-priority high code-point 101 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class network-control loss-priority low code-point 110 user@router-A# set rewrite-rules inet-precedence zf-tun-rw-ipprec-00 forwarding-class network-control loss-priority high code-point 111 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class best-effort loss-priority low code-point 000000 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class best-effort loss-priority high code-point 001001 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class expedited-forwarding loss-priority low code-point 010010 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class expedited-forwarding loss-priority high code-point 011011 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class assured-forwarding loss-priority low code-point 100100 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class assured-forwarding loss-priority high code-point 101101 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class network-control loss-priority low code-point 110110 user@router-A# set rewrite-rules dscp zf-tun-rw-dscp-00 forwarding-class network-control loss-priority high code-point 111111
Configure the firewall filter.
[edit firewall] user@router-A# set filter zf-catch-all term term1 then loss-priority high user@router-A# set filter zf-catch-all term term1 then forwarding-class network-control
Results
From configuration mode, confirm your configuration
by entering the show interfaces
, show routing-options
, show class-of-service
, and show firewall
commands.
If the output does not display the intended configuration, repeat
the instructions in this example to correct the configuration.
user@router-A# show interfaces ge-1/0/0 { unit 0 { family inet { address 10.80.0.2/24; } } } ge-1/0/1 { unit 0 { family inet { filter { input zf-catch-all; } address 10.90.0.2/24; } } } gr-2/1/0 { unit 0 { tunnel { source 10.11.11.11; destination 10.255.245.46; } family inet { address 10.21.21.21/24; } } } ip-2/1/0 { unit 0 { tunnel { source 10.12.12.12; destination 10.255.245.46; } family inet { address 10.22.22.22/24; } } }
user@router-A# show routing-options static { route 10.1.1.1/32 next-hop gr-2/1/0.0; route 10.2.2.2/32 next-hop ip-2/1/0.0; }
user@router-A# show class-of-service interfaces { ge-1/0/0 { unit 0 { rewrite-rules { inet-precedence zf-tun-rw-ipprec-00; } } } } rewrite-rules { inet-precedence zf-tun-rw-ipprec-00 { forwarding-class best-effort { loss-priority low code-point 000; loss-priority high code-point 001; } forwarding-class expedited-forwarding { loss-priority low code-point 010; loss-priority high code-point 011; } forwarding-class assured-forwarding { loss-priority low code-point 100; loss-priority high code-point 101; } forwarding-class network-control { loss-priority low code-point 110; loss-priority high code-point 111; } } } dscp zf-tun-rw-dscp-00 { forwarding-class best-effort { loss-priority low code-point 000000; loss-priority high code-point 001001; } forwarding-class expedited-forwarding { loss-priority low code-point 010010; loss-priority high code-point 011011; } forwarding-class assured-forwarding { loss-priority low code-point 100100; loss-priority high code-point 101101; } forwarding-class network-control { loss-priority low code-point 110110; loss-priority high code-point 111111; } }
user@router-A# show firewall filter zf-catch-all { term term1 { then { loss-priority high; forwarding-class network-control; } } }
If you are done configuring the device, enter commit
from configuration mode.
Configuring Router B
Procedure
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure router B:
Configure the device interfaces.
[edit interfaces] user@router-B# set ge-1/3/0 unit 0 family inet address 10.80.0.1/24 user@router-B# set lo0 unit 0 family inet address 10.255.245.46/32
Results
From configuration mode, confirm your configuration
by entering the show interfaces
command. If the output
does not display the intended configuration, repeat the instructions
in this example to correct the configuration.
Router B
user@router-B# show interfaces ge-1/3/0 { unit 0 { family inet { address 10.80.0.1/24; } } } lo0 { unit 0 { family inet { address 10.255.245.46/32; } } }
If you are done configuring the device, enter commit
from configuration mode.
Configuring Router C
Procedure
Step-by-Step Procedure
To configure router C:
Configure the device interfaces.
[edit interfaces] user@router-B# set ge-1/0/0 unit 0 family inet address 10.90.0.1/24
Configure the static routes.
[edit routing-options static] user@router-A# set static route 10.1.1.1/32 next-hop 10.90.0.2 user@router-A# set static route 10.2.2.2/32 next-hop 10.90.0.2
Results
From configuration mode, confirm your configuration
by entering the show interfaces
and show routing-options
commands. If the output does not display the intended configuration,
repeat the instructions in this example to correct the configuration.
Router C
user@router-C show interfaces ge-1/0/0 { unit 0 { family inet { address 10.90.0.1/24; } } } user@router-C show routing-options static { route 10.1.1.1/32 next-hop 10.90.0.2; route 10.2.2.2/32 next-hop 10.90.0.2; }
If you are done configuring the device, enter commit
from configuration mode.
Verification
To verify the configuration, run the following commands: