Configure Export Policy for the PE Router's VRF Table
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:
- For all PE routers, an export policy must distribute VPN routes to and from the connected CE routers in accordance with the type of routing protocol that you configure between the CE and PE routers within the routing instance.
To define an export policy, include the
policy-statementstatement. An export policy must always include the following, at a minimum:policy-options {policy-statementexport-policy-name{termexport-term-name{from protocol (bgp | ospf | rip | static);then {community addcommunity-id;accept;}}termterm-name{then reject;}}}You can configure these statements at the following hierarchy levels:
The
export-policy-namepolicy evaluates all routes received over the routing protocol session with the CE router. (This session can use the BGP, OSPF, or RIP routing protocol, or static routes.) If the routes match the conditions in thefromstatement, the community target specified in thethen community addstatement 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 Internet Software Configuration Guide: Policy Framework.
- To apply the policy, include the vrf-export statement:
vrf-exportexport-policy-name;You can configure this statement at the following hierarchy levels: