Each VPN can have a policy that defines how routes are exported from the PE router’s VRF table. An export policy is applied to routes sent to other PE routers in the VPN. An export policy must evaluate all routes received over the routing protocol session with the CE router. (This session can use the BGP, OSPF, or Routing Information Protocol [RIP] routing protocols, or static routes.) If the routes match the conditions, the specified community target (which is the route target) is added to them and they are exported to the remote PE routers. An export policy must contain a second term that rejects all other routes.
Export policies defined within the VPN routing instance are the only export policies that apply to the VRF table. Any export policy that you define on the IBGP session between the PE routers has no effect on the VRF table. You can configure multiple export policies.
To configure an export policy for the PE router’s VRF table, follow these steps:
To define an export policy, include the policy-statement statement. An export policy must always include the policy-statement statement, at a minimum:
- policy-statement export-policy-name {
-
- term export-term-name {
- from protocol (bgp | ospf | rip | static);
-
- then {
- community add community-id;
- accept;
- }
- }
-
- term term-name {
- then reject;
- }
- }
![]() |
Note: Configuring the community add statement is a requirement for Layer 2 VPN VRF export policies. |
You can include the policy-statement statement at the following hierarchy levels:
The export-policy-name policy evaluates all routes received over the routing protocol session with the CE router. (This session can use the BGP, OSPF, or RIP routing protocols, or static routes.) If the routes match the conditions in the from statement, the community target specified in the then community add statement is added to them and they are exported to the remote PE routers. The second term in the policy rejects all other routes.
For more information about creating policies, see the JUNOS Policy Framework Configuration Guide.
-
vrf-export export-policy-name;
You can include the vrf-export statement at the following hierarchy levels: