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

    Example: Configuring the Metric Value Added to Imported RIP Routes

    This example shows how to change the default metric to be added to incoming routes to control the route selection process.

    Requirements

    No special configuration beyond device initialization is required before configuring this example.

    Overview

    Normally, when multiple routes are available, RIP selects the route with the lowest hop count. Changing the default metric enables you to control the route selection process such that a route with a higher hop count can be preferred over of a route with a lower hop count.

    Figure 1 shows the topology used in this example.

    Figure 1: RIP Incoming Metrics Network Topology

    RIP Incoming Metrics Network
Topology

    Device R1 has two potential paths to reach 172.16.2.2/32. The default behavior is to send traffic out the 0.1/30 interface facing Device R2. Suppose, though, that the path through Device R3 is less expensive to use or has higher bandwidth links. This example shows how to use the metric-in statement to ensure that Device R1 uses the path through Device R3 to reach 172.16.2.2/32. CLI Quick Configuration shows the configuration for all of the devices in Figure 1. The section Step-by-Step Procedure describes the steps on Device R1.

    Configuration

    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.

    Device R1

    set interfaces fe-1/2/0 unit 1 description to-R2set interfaces fe-1/2/0 unit 1 family inet address 10.0.0.1/30set interfaces ge-1/2/1 unit 10 description to-R3set interfaces ge-1/2/1 unit 10 family inet address 10.0.0.10/30set interfaces lo0 unit 1 family inet address 172.16.0.1/32set interfaces lo0 unit 1 family inet address 192.168.1.1/32set protocols rip group primary export advertise-routes-through-ripset protocols rip group primary neighbor ge-1/2/1.10set protocols rip group secondary export advertise-routes-through-ripset protocols rip group secondary neighbor fe-1/2/0.1 metric-in 4set policy-options policy-statement advertise-routes-through-rip term 1 from protocol directset policy-options policy-statement advertise-routes-through-rip term 1 from protocol ripset policy-options policy-statement advertise-routes-through-rip term 1 then accept

    Device R2

    set interfaces fe-1/2/0 unit 2 family inet address 10.0.0.2/30set interfaces ge-1/2/1 unit 5 family inet address 10.0.0.5/30set interfaces lo0 unit 2 family inet address 192.168.2.2/32set interfaces lo0 unit 2 family inet address 172.16.2.2/32set protocols rip group rip-group export advertise-routes-through-ripset protocols rip group rip-group neighbor fe-1/2/0.2set protocols rip group rip-group neighbor ge-1/2/1.5set policy-options policy-statement advertise-routes-through-rip term 1 from protocol directset policy-options policy-statement advertise-routes-through-rip term 1 from protocol ripset policy-options policy-statement advertise-routes-through-rip term 1 then accept

    Device R3

    set interfaces fe-1/2/0 unit 6 family inet address 10.0.0.6/30set interfaces ge-1/2/1 unit 9 family inet address 10.0.0.9/30set interfaces lo0 unit 3 family inet address 192.168.3.3/32set interfaces lo0 unit 3 family inet address 172.16.3.3/32set protocols rip group rip-group export advertise-routes-through-ripset protocols rip group rip-group neighbor fe-1/2/0.6set protocols rip group rip-group neighbor ge-1/2/1.9set policy-options policy-statement advertise-routes-through-rip term 1 from protocol directset policy-options policy-statement advertise-routes-through-rip term 1 from protocol ripset policy-options policy-statement advertise-routes-through-rip term 1 then accept

    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 configure a RIP metrics:

    1. Configure the network interfaces.
      [edit interfaces]user@R1# set fe-1/2/0 unit 1 description to-R2user@R1# set fe-1/2/0 unit 1 family inet address 10.0.0.1/30
      user@R1# set ge-1/2/1 unit 10 description to-R3user@R1# set ge-1/2/1 unit 10 family inet address 10.0.0.10/30
      user@R1# set lo0 unit 1 family inet address 172.16.0.1/32user@R1# set lo0 unit 1 family inet address 192.168.1.1/32
    2. Create the RIP groups and add the interfaces.

      To configure RIP in Junos OS, you must configure one or more groups that contain the interfaces on which RIP is enabled. You do not need to enable RIP on the loopback interface.

      For the interface that is facing Device R2, the metric-in 4 setting causes this route to be less likely to be chosen as the active route.

      [edit protocols rip]user@R1# set group primary neighbor ge-1/2/1.10user@R1# set group secondary neighbor fe-1/2/0.1 metric-in 4
    3. Create the routing policy to advertise both direct and RIP-learned routes.
      [edit policy-options policy-statement advertise-routes-through-rip term 1]user@R1# set from protocol directuser@R1# set from protocol ripuser@R1# set then accept
    4. Apply the routing policy.

      In Junos OS, you can only apply RIP export policies at the group level.

      [edit protocols rip]user@R1# set group primary export advertise-routes-through-ripuser@R1# set group secondary export advertise-routes-through-rip

    Results

    From configuration mode, confirm your configuration by entering the show interfaces, show protocols, and show policy-options commands. If the output does not display the intended configuration, repeat the configuration instructions in this example to correct it.

    user@R1# show interfaces
    fe-1/2/0 {unit 1 {description to-R2;family inet {address 10.0.0.1/30;}}}
    ge-1/2/1 {unit 10 {description to-R3;family inet {address 10.0.0.10/30;}}}
    lo0 {unit 1 {family inet {address 172.16.0.1/32;address 192.168.1.1/32;}}}
    user@R1# show protocols
    rip {group primary {export advertise-routes-through-rip;neighbor ge-1/2/1.10;}group secondary {export advertise-routes-through-rip;neighbor fe-1/2/0.1 {metric-in 4;}}}
    user@R1# show policy-options
    policy-statement advertise-routes-through-rip {term 1 {from protocol [ direct rip ];then accept;}}

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

    Verification

    Confirm that the configuration is working properly.

    Verifying That the Expected Route Is Active

    Purpose

    Make sure that to reach 172.16.2.2/32, Device R1 uses the path through Device R3.

    Action

    From operational mode, enter the show route 172.16.2.2 command.

    user@R1> show route 172.16.2.2
    inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
    + = Active Route, - = Last Active, * = Both
    
    172.16.2.2/32      *[RIP/100] 00:15:46, metric 3, tag 0
                        > to 10.0.0.9 via ge-1/2/1.10
    

    Meaning

    The to 10.0.0.9 via ge-1/2/1.10 output shows that Device R1 uses the path through Device R3 to reach 172.16.2.2/32. The metric for this route is 3.

    Removing the metric-in Statement

    Purpose

    Delete or deactivate the metric-in statement to see what happens to the 172.16.2.2/32 route.

    Action

    1. From configuration mode, deactivate the metric-in statement.
      [edit protocols rip group secondary neighbor fe-1/2/0.1]user@R1# deactivate metric-inuser@R1# commit
    2. From operational mode, enter the show route 172.16.2.2 command.
      user@R1> show route 172.16.2.2
      inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
      + = Active Route, - = Last Active, * = Both
      
      172.16.2.2/32      *[RIP/100] 00:00:06, metric 2, tag 0
                          > to 10.0.0.2 via fe-1/2/0.1
      

    Meaning

    The to 10.0.0.2 via fe-1/2/0.1 output shows that Device R1 uses the path through Device R2 to reach 172.16.2.2/32. The metric for this route is 2.

    Published: 2013-08-15