Supported Platforms
Example: Configuring Layer 2 Circuit Switching Protection
Unlike Layer 2 circuit protect interfaces (see Example: Configuring Layer 2 Circuit Protect Interfaces), which provide traffic protection for paths configured between the PE routers and CE routers, Layer 2 circuit switching protection provides traffic protection for the paths configured between the PE routers. In the event the path used by a Layer 2 circuit fails, traffic can be switched to an alternate path (or protection path). Switching protection is supported for locally switched Layer 2 circuits and provides 1 to 1 protection for each Layer 2 circuit interface.
When you enable Layer 2 circuit switching protection, each Layer 2 circuit interface requires the following paths:
- Working path—Used by the Layer 2 circuit when working normally.
- Protection path—Used by the Layer 2 circuit when the working path fails.
Requirements
This example uses the following hardware and software components:
- MX 3D routers
- Junos OS Release 12.3
Overview
Each working path can be configured to have a either a protection path routed directly to the neighboring PE router (as shown in Figure 1) or indirectly using a pseudowire configured through an intermediate PE router (as shown in Figure 2 and Figure 3). The protection path provides failure protection for the traffic flowing between the PE routers. Ethernet OAM monitors the status of these paths. When OAM detects a failure, it reroutes the traffic from the failed working path to the protection path. You can configure OAM to revert the traffic automatically to the working path when it is restored. You can also manually switch traffic between the working path, the protection path, and back.
![]() | Note: Non-stop routing (NSR) and graceful routing engine switchover (GRES) do not support Layer 2 circuit switching protection. |
Topology
Figure 1 illustrates Layer 2 circuit local switching. There are two OAM sessions running between router PE1 and router PE2. One OAM session is configured over the working path and the other is configured over the protection path.
Figure 1: Connection protection enabled between router PE1 and router PE2

In Figure 2 and Figure 3, there are two OAM sessions running between router PE1 and router PE2. For Figure 2, one OAM session is configured over the working path between router PE1 and router PE2. The other OAM session is configured over the protection path between router PE1 and router PE3 to router PE2.
Figure 2: Connection Protection Using a Pseudowire Configured through Router PE3 as the Protection Path

For Figure 3, one OAM session is configured over the working path, the pseudowire between router PE1 and router PE3, then to router PE2. The other OAM session is configured on the protect path between router PE1 and router PE2.
Figure 3: Connection Protection Using a Pseudowire Configured through Router PE3 as the Working Path

Configuration
The following sections describe how to configure each of the variations of Layer 2 circuit connection protection:
- Configuring Connection Protection Between Two PE Routers
- Configuring Connection Protection Using Another PE Router for the Protection Path
- Configuring Connection Protection Using an Another PE Router for the Working Path
Configuring Connection Protection Between Two PE Routers
Step-by-Step Procedure
To configure Layer 2 Circuit switching protection as shown in Figure 1 on router PE1:
- Configure the Layer 2 circuit on router PE1.[edit protocols l2circuit]set local-switching interface ge-2/0/2.0 connection-protectionset local-switching interface ge-2/0/2.0 end-interface interface ge-2/0/1.0set local-switching interface ge-2/0/2.0 end-interface backup-interface ge-2/0/1.1
- Configure the routing policy on router PE1.[edit policy-options]set policy-statement protection-policy then load-balance per-packet
- Enable the routing policy on router PE1.[edit routing-options]set routing-options forwarding-table export protection-policy
- Configure OAM on Router PE1. OAM is used to monitor the
working path between router PE1 and router PE2. In the event of a
failure on the working path, traffic is switched automatically to
the protection path. A connectivity fault management (CFM) session
is configured on the working path and on the protection path. Begin
by configuring the OAM maintenance domain.[edit protocols oam ethernet]set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE1 for the working path.[edit protocols oam ethernet]set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working continuity-check interval 100msset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 interface ge-2/0/1.0set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 interface workingset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 direction downset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 remote-mep 103
- Configure OAM on Router PE1 for the protection path.[edit protocols oam ethernet]set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection continuity-check interval 100msset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 interface ge-2/0/1.1set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 interface protectset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 direction downset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 remote-mep 104
- Configure the OAM maintenance domain on Router PE2.set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE2 for the working path.set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working continuity-check interval 100msset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 interface ge-2/0/1.0set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 interface workingset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 direction downset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 remote-mep 1000
- Configure OAM on Router PE2 for the protection path.set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection continuity-check interval 100msset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 interface ge-2/0/1.1set protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 interface protectset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 direction downset protocols oam ethernet connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 remote-mep 1001
Results
From configuration mode on Router PE1, confirm your configuration by entering the show protocols l2circuit, show policy-options, show routing-options, and show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.
From configuration mode on Router PE2, confirm your configuration by entering the show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.
Configuring Connection Protection Using Another PE Router for the Protection Path
Step-by-Step Procedure
To configure Layer 2 Circuit switching protection as shown in Figure 2 on router PE1:
- Configure the Layer 2 circuit on router PE1.[edit protocols l2circuit]set protocols l2circuit local-switching interface ge-2/0/2.0 connection-protectionset protocols l2circuit local-switching interface ge-2/0/2.0 backup-neighbor 2.2.2.2 virtual-circuit-id 2set protocols l2circuit local-switching interface ge-2/0/2.0 backup-neighbor 2.2.2.2 community exampleset protocols l2circuit local-switching interface ge-2/0/2.0 end-interface interface ge-2/0/1.0
- Configure the routing policy on router PE1.[edit policy-options]set policy-statement load-balance then load-balance per-packetset policy-statement protection-policy term protect from community exampleset policy-statement protection-policy term protect then install-nexthop lsp-regex lsp-protect-*
- Configure the routing options on router PE1.[edit routing-options]set routing-options forwarding-table export load-balance
- Configure OAM on Router PE1 to setup the maintenance domain.
OAM is used to monitor the working path between router PE1 and router
PE2. In the event of a failure on the working path, traffic is switched
automatically to the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE1 for the working path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 interface ge-2/0/1.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 remote-mep 103
- Configure OAM on Router PE1 for the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 interface ge-2/0/0.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 remote-mep 104
- Configure OAM on Router PE2 to setup the maintenance domain.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE2 for the working path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 interface ge-2/0/1.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 remote-mep 1000
- Configure OAM on Router PE2 for the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 interface ge-2/0/0.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 remote-mep 1001
Results
From configuration mode on Router PE1, confirm your configuration by entering the show protocols l2circuit, show policy-options, show routing-options, and show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.
From configuration mode on Router PE2, confirm your configuration by entering the show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.
Configuring Connection Protection Using an Another PE Router for the Working Path
Step-by-Step Procedure
To configure Layer 2 Circuit switching protection as shown in Figure 3 on router PE1:
- Configure the Layer 2 circuit on router PE1.[edit protocols l2circuit]set protocols l2circuit neighbor 2.2.2.2 interface ge-2/0/2.0 virtual-circuit-id 2set protocols l2circuit neighbor 2.2.2.2 interface ge-2/0/2.0 community exampleset protocols l2circuit neighbor 2.2.2.2 interface ge-2/0/2.0 connection-protectionset protocols l2circuit neighbor 2.2.2.2 interface ge-2/0/2.0 backup-neighbor 3.3.3.3 virtual-circuit-id 3set protocols l2circuit neighbor 2.2.2.2 interface ge-2/0/2.0 backup-neighbor 3.3.3.3 standby
- Configure the policies on router PE1.[edit policy-options]set policy-options policy-statement load-balance then load-balance per-packetset policy-options policy-statement protection-policy term protect from community exampleset policy-options policy-statement protection-policy term protect then install-nexthop lsp-regex lsp-primary
- [edit routing-options]set routing-options forwarding-table export load-balance
- Configure OAM on Router PE1 to setup the maintenance domain.
OAM is used to monitor the working path between router PE1 and router
PE2. In the event of a failure on the working path, traffic is switched
automatically to the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE1 for the working path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 interface ge-2/0/0.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 1000 remote-mep 103
- Configure OAM on Router PE1 for the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 interface ge-2/0/1.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 1001 remote-mep 104
- Configure OAM on Router PE2 to setup the maintenance domain.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md level 5
- Configure OAM on Router PE2 for the working path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 interface ge-2/0/0.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association working mep 103 remote-mep 1000
- Configure OAM on Router PE2 for the protection path.[edit protocols oam ethernet]set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 interface ge-2/0/1.0set connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 direction downset connectivity-fault-management maintenance-domain l2circuit-example-md maintenance-association protection mep 104 remote-mep 1001
Results
From configuration mode on Router PE1, confirm your configuration by entering the show protocols l2circuit, show policy-options, show routing-options, and show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.
From configuration mode on Router PE2, confirm your configuration by entering the show protocols oam ethernet commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.