Juniper: BGP Policy Inject OSPF Routing

From OnnoWiki
Revision as of 14:39, 22 December 2018 by Onnowpurbo (talk | contribs) (Created page with "Sumber: https://www.juniper.net/documentation/en_US/junos/topics/example/routing-policy-security-opspf-route-into-bpg-routing-table-injecting.html This example shows how to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sumber: https://www.juniper.net/documentation/en_US/junos/topics/example/routing-policy-security-opspf-route-into-bpg-routing-table-injecting.html


This example shows how to create a policy that injects OSPF routes into the BGP routing table. Requirements

Before you begin:

   Configure network interfaces.
   Configure external peer sessions. See Example: Configuring External BGP Point-to-Point Peer Sessions.
   Configure interior gateway protocol (IGP) sessions between peers. 

Overview

In this example, you create a routing policy called injectpolicy1 and a routing term called injectterm1. The policy injects OSPF routes into the BGP routing table. Configuration

   Configuring the Routing Policy
   Configuring Tracing for the Routing Policy

Configuring the Routing Policy 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, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode. content_copy zoom_out_map set policy-options policy-statement injectpolicy1 term injectterm1 from protocol ospf set policy-options policy-statement injectpolicy1 term injectterm1 from area 0.0.0.1 set policy-options policy-statement injectpolicy1 term injectterm1 then accept set protocols bgp export injectpolicy1 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 inject OSPF routes into a BGP routing table:

   Create the policy term.
   content_copy zoom_out_map
   [edit policy-options policy-statement injectpolicy1]
   user@host# set term injectterm1
   Specify OSPF as a match condition.
   content_copy zoom_out_map
   [edit policy-options policy-statement injectpolicy1 term injectterm1]
   user@host# set from protocol ospf
   Specify the routes from an OSPF area as a match condition.
   content_copy zoom_out_map
   [edit policy-options policy-statement injectpolicy1 term injectterm1]
   user@host# set from area 0.0.0.1
   Specify that the route is to be accepted if the previous conditions are matched.
   content_copy zoom_out_map
   [edit policy-options policy-statement injectpolicy1 term injectterm1]
   user@host# set then accept
   Apply the routing policy to BGP.
   content_copy zoom_out_map
   [edit]
   user@host# set protocols bgp export injectpolicy1

Results

Confirm your configuration by entering the show policy-options and show protocols bgp commands from configuration mode. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration. content_copy zoom_out_map user@host# show policy-options policy-statement injectpolicy1 { term injectterm1 { from { protocol ospf; area 0.0.0.1; } then accept; } } content_copy zoom_out_map user@host# show protocols bgp export injectpolicy1;

If you are done configuring the device, enter commit from configuration mode. Configuring Tracing for the Routing Policy 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, copy and paste the commands into the CLI at the [edit] hierarchy level, and then enter commit from configuration mode. content_copy zoom_out_map set policy-options policy-statement injectpolicy1 term injectterm1 then trace set routing-options traceoptions file ospf-bgp-policy-log set routing-options traceoptions file size 5m set routing-options traceoptions file files 5 set routing-options traceoptions flag policy 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.

   Include a trace action in the policy.
   content_copy zoom_out_map
   [edit policy-options policy-statement injectpolicy1 term injectterm1]
   user@host# then trace
   Configure the tracing file for the output.
   content_copy zoom_out_map
   [edit routing-options traceoptions]
   user@host# set file ospf-bgp-policy-log
   user@host# set file size 5m
   user@host# set file files 5
   user@host# set flag policy

Results

Confirm your configuration by entering the show policy-options and show routing-options commands from configuration mode. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration. content_copy zoom_out_map user@host# show policy-options policy-statement injectpolicy1 { term injectterm1 { then { trace; } } } content_copy zoom_out_map user@host# show routing-options traceoptions { file ospf-bgp-policy-log size 5m files 5; flag policy; }

If you are done configuring the device, enter commit from configuration mode. Verification

Confirm that the configuration is working properly. Verifying That the Expected BGP Routes Are Present Purpose

Verify the effect of the export policy. Action

From operational mode, enter the show route command. Troubleshooting

   Using the show log Command to Examine the Actions of the Routing Policy

Using the show log Command to Examine the Actions of the Routing Policy Problem

The routing table contains unexpected routes, or routes are missing from the routing table.

Solution

If you configure policy tracing as shown in this example, you can run the show log ospf-bgp-policy-log command to diagnose problems with the routing policy. The show log ospf-bgp-policy-log command displays information about the routes that the injectpolicy1 policy term analyzes and acts upon.





Referensi


Pranala Menarik