3. Configure a Simple Routing Policy
Purpose
Routing policy allows you to control the information shared with BGP neighbors and provides the opportunity to filter and modify the information you receive. Typically, a network is injected into BGP using a policy. This may also be done through a static route. In the network in Figure 4, a static route export policy is used to inject routes into BGP.
Action
To configure a simple routing policy, follow these steps:
- In configuration mode, go to the following hierarchy level:
[edit]user@host#edit routing-options- Configure a static route for redistribution to other autonomous systems:
[edit routing-options]user@host#set static routedestination/24 reject- Configure a routing policy that matches and accepts the configured static routes into BGP updates:
[edit]user@host#edit policy-options[edit policy-options]user@host#set policy-statementpolicy-nametermterm-namefrom route-filteraddressexactuser@host#set policy-statementpolicy-nametermterm-namethen accept- Apply the policy created in Step 3 to all BGP neighbors:
[edit]user@host#edit protocols bgp[edit protocols bgp]user@host#set exportpolicy-name- Verify and commit the configuration:
user@host#showuser@host#commitSample Output
user@R1>editEntering configuration mode[edit]user@R1#edit routing-options[edit routing-options]user@R1#set static route 100.100.1.0/24 reject[edit routing-options]user@R1#show[...Output truncated...]route 100.100.1.0/24 reject;}router-id 10.0.0.1;autonomous-system 65432;[edit routing-options]user@R1#top[edit]user@R1#edit policy-options[edit policy-options]user@R1#set policy-statement send-statics term statics from route-filter 100.100.1.0/24 exact[edit policy-options]user@R1#set policy-statement send-statics term statics then accept[edit policy-options]user@R1#top[edit]user@R1#edit protocols bgp[edit protocols bgp]user@R1#set export send-statics[edit protocols bgp]user@R1#showexport send-statics;group internal {type internal;local-address 10.0.0.1;neighbor 10.0.0.2;neighbor 10.0.0.3;neighbor 10.0.0.5;neighbor 10.0.0.4;neighbor 10.0.0.6;}[edit protocols bgp]user@R1#commitcommit completeWhat It Means
The sample output shows that routing policy
send-staticsis configured on the router. The routing policy matches and accepts the configured static routes into the routing table and injects the routes into BGP updates. Typically, a routing policy is applied at the group level, although it can be applied at the global level, as shown in this example.