Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Injecting OSPF Routes into the BGP Routing Table

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

    Requirements

    Before you begin:

    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

    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, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

    set policy-options policy-statement injectpolicy1 term injectterm1 from protocol ospfset policy-options policy-statement injectpolicy1 term injectterm1 from area 0.0.0.1set policy-options policy-statement injectpolicy1 term injectterm1 then acceptset 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:

    1. Create the policy term.

      [edit policy-options policy-statement injectpolicy1]user@host# set term injectterm1
    2. Specify OSPF as a match condition.

      [edit policy-options policy-statement injectpolicy1 term injectterm1]user@host# set from protocol ospf
    3. Specify the routes from an OSPF area as a match condition.

      [edit policy-options policy-statement injectpolicy1 term injectterm1]user@host# set from area 0.0.0.1
    4. Specify that the route is to be accepted if the previous conditions are matched.

      [edit policy-options policy-statement injectpolicy1 term injectterm1]user@host# set then accept
    5. Apply the routing policy to BGP.

      [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.

    user@host# show policy-options
    policy-statement injectpolicy1 {term injectterm1 {from {protocol ospf;area 0.0.0.1;}then accept;}}
    user@host# show protocols bgpexport 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, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

    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.

    1. Include a trace action in the policy.

      [edit policy-options policy-statement injectpolicy1 term injectterm1]user@host# then trace
    2. Configure the tracing file for the output.

      [edit routing-options traceoptions]user@host# set file ospf-bgp-policy-loguser@host# set file size 5muser@host# set file files 5user@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.

    user@host# show policy-options
    policy-statement injectpolicy1 {term injectterm1 {then {trace;}}}
    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

    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.

    Published: 2014-05-15