OSFP distance .

Hi,

What is the use of distane command in ospf ?

What is difference between

-router)#distance ospf intra-area X

and

-router)#distance osfp intra-area X

What sould be the X value ?

 

Comments

  • What is the use of distane command in ospf ?

    What is difference between

    -router)#distance ospf intra-area X

    and

    -router)#distance osfp intra-area X

    These distance command are exactly the same so no difference[;)]

    However if you are referencing to intra-area and inter-area distance commands then ofcourse it makes sense. The "distance ospf intra-area X"  command under ospf is used to prefer intra area route from one ospf process over another and same with "distance osfp inter-area X" prefers inter area routes from one ospf process over another.

    For example if a ospf running router is having two processes and this router is learing area area routes from its neighbor then only one of the ospf process lets say process 1 will learn these intra area routes. But if you want to prefer there routes via ospf process 2 then you can lower the distance unrer ospf process 2 for these intra area routes. In this way ospf process 2 will lear intra area routes insdead of ospf process 1.

    It should no be apply within a single ospf process.

     

  • Hi,

    What is the use of distane command in ospf ?

    What is difference between

    -router)#distance ospf intra-area X

    and

    -router)#distance osfp intra-area X

    What sould be the X value ?

     

    Hi CCIESP,

    I would like to demonstrate one example to clear your doubt about distance command in OSPF:

    The distance command is designed for a route selection  for specific prefixes  or routes learned from specific sources, ie If your router learning same route from different protocols like RIP,EIGRP and OSPF, path selection is based on:

    1. Longer Prefix
    2. Administrative distance

    In RIP/OSPF/EIGRP we can specify the Administrative distance either routes learned from any sources or specific source and all routes or specific route:
    See here
    R2(config-router)#distance 20 1.1.1.1 0.0.0.0 ?
      <1-99>       IP Standard access list number
      <1300-1999>  IP Standard expanded access list number
      WORD         Standard access-list name
      <cr>

    See here, I have O, O IA and D routes:
    R3#show ip route | be Ga
    Gateway of last resort is not set

         34.0.0.0/24 is subnetted, 1 subnets
    C       34.34.34.0 is directly connected, FastEthernet2/0
         1.0.0.0/32 is subnetted, 1 subnets
    D       1.1.1.1 [90/156160] via 13.13.13.1, 00:02:30, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/2] via 23.23.23.2, 00:00:04, FastEthernet1/0
         33.0.0.0/32 is subnetted, 1 subnets
    C       33.33.33.33 is directly connected, Loopback33
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [110/2] via 34.34.34.4, 00:00:04, FastEthernet2/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.23.23.0 is directly connected, FastEthernet1/0
         22.0.0.0/32 is subnetted, 1 subnets
    O       22.22.22.22 [110/2] via 23.23.23.2, 00:00:04, FastEthernet1/0
         11.0.0.0/32 is subnetted, 1 subnets
    D       11.11.11.11 [90/156160] via 13.13.13.1, 00:02:30, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    D       12.12.12.0 [90/30720] via 13.13.13.1, 00:02:32, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    C       13.13.13.0 is directly connected, FastEthernet0/0
         14.0.0.0/24 is subnetted, 1 subnets
    O IA    14.14.14.0 [110/2] via 34.34.34.4, 00:00:07, FastEthernet2/0

    Let's change the distance of OSPF:
    R3(config)#router ospf 1
    R3(config-router)#distance 21
    R3(config-router)#do show ip route | be Ga
    Gateway of last resort is not set

         34.0.0.0/24 is subnetted, 1 subnets
    C       34.34.34.0 is directly connected, FastEthernet2/0
         1.0.0.0/32 is subnetted, 1 subnets
    O E2    1.1.1.1 [21/1] via 34.34.34.4, 00:00:17, FastEthernet2/0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [21/2] via 23.23.23.2, 00:00:17, FastEthernet1/0
         33.0.0.0/32 is subnetted, 1 subnets
    C       33.33.33.33 is directly connected, Loopback33
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [21/2] via 34.34.34.4, 00:00:17, FastEthernet2/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.23.23.0 is directly connected, FastEthernet1/0
         22.0.0.0/32 is subnetted, 1 subnets
    O       22.22.22.22 [21/2] via 23.23.23.2, 00:00:17, FastEthernet1/0
         11.0.0.0/32 is subnetted, 1 subnets
    O E2    11.11.11.11 [21/1] via 34.34.34.4, 00:00:17, FastEthernet2/0
         12.0.0.0/24 is subnetted, 1 subnets
    O E2    12.12.12.0 [21/1] via 34.34.34.4, 00:00:19, FastEthernet2/0
         13.0.0.0/24 is subnetted, 1 subnets
    Now you can AD of all routes has been changed to 21, look at 11.11.11.11/32, OSPF is preferred than EIGRP. you can trace the path.

    Now let's change the AD of intra-area only:
    R3(config-router)#distance ospf intra-area 171
    R3(config-router)#do show ip route | be Ga
    Gateway of last resort is not set

         34.0.0.0/24 is subnetted, 1 subnets
    C       34.34.34.0 is directly connected, FastEthernet2/0
         1.0.0.0/32 is subnetted, 1 subnets
    D       1.1.1.1 [90/156160] via 13.13.13.1, 00:00:58, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    D EX    2.2.2.2 [170/2560002816] via 13.13.13.1, 00:00:06, FastEthernet0/0
         33.0.0.0/32 is subnetted, 1 subnets
    C       33.33.33.33 is directly connected, Loopback33
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [110/2] via 34.34.34.4, 00:00:06, FastEthernet2/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.23.23.0 is directly connected, FastEthernet1/0
         22.0.0.0/32 is subnetted, 1 subnets
    D EX    22.22.22.22 [170/2560002816] via 13.13.13.1, 00:00:06, FastEthernet0/0
         11.0.0.0/32 is subnetted, 1 subnets
    D       11.11.11.11 [90/156160] via 13.13.13.1, 00:00:58, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    D       12.12.12.0 [90/30720] via 13.13.13.1, 00:01:00, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    C       13.13.13.0 is directly connected, FastEthernet0/0
         14.0.0.0/24 is subnetted, 1 subnets
    O IA    14.14.14.0 [110/2] via 34.34.34.4, 00:00:08, FastEthernet2/0

    Now you can see EIGRP (default AD for EIGRP external route is 170) is preferred than OSPF because of higher AD(171), it's not changing the AD of other OSPF routes.

    Now let's change the AD of inter-area OSPF routes:
    R3(config-router)#distance ospf inter-area 171
    R3(config-router)#do show ip route | be Ga
    Gateway of last resort is not set

         34.0.0.0/24 is subnetted, 1 subnets
    C       34.34.34.0 is directly connected, FastEthernet2/0
         1.0.0.0/32 is subnetted, 1 subnets
    D       1.1.1.1 [90/156160] via 13.13.13.1, 00:03:56, FastEthernet0/0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/2] via 23.23.23.2, 00:00:26, FastEthernet1/0
         33.0.0.0/32 is subnetted, 1 subnets
    C       33.33.33.33 is directly connected, Loopback33
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    D EX    4.4.4.4 [170/2560002816] via 13.13.13.1, 00:00:26, FastEthernet0/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.23.23.0 is directly connected, FastEthernet1/0
         22.0.0.0/32 is subnetted, 1 subnets
    O       22.22.22.22 [110/2] via 23.23.23.2, 00:00:26, FastEthernet1/0
         11.0.0.0/32 is subnetted, 1 subnets
    D       11.11.11.11 [90/156160] via 13.13.13.1, 00:03:56, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    D       12.12.12.0 [90/30720] via 13.13.13.1, 00:03:57, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    C       13.13.13.0 is directly connected, FastEthernet0/0
         14.0.0.0/24 is subnetted, 1 subnets
    D EX    14.14.14.0 [170/2560002816] via 13.13.13.1, 00:00:28, FastEthernet0/0
    R3(config-router)#

    All inter-area routes (you can't see here O IA, which is routes leanred from another OSPF area) going through the EIGRP domain than OSPF itself because of higher AD, router selecting EIGRP.

    Let's change the AD of external routes:
    R3(config-router)#distance ospf external 80
    R3(config-router)#do show ip route | be Ga
    Gateway of last resort is not set

         34.0.0.0/24 is subnetted, 1 subnets
    C       34.34.34.0 is directly connected, FastEthernet2/0
         1.0.0.0/32 is subnetted, 1 subnets
    O E2    1.1.1.1 [80/1] via 34.34.34.4, 00:00:04, FastEthernet2/0
         2.0.0.0/32 is subnetted, 1 subnets
    O       2.2.2.2 [110/2] via 23.23.23.2, 00:00:04, FastEthernet1/0
         33.0.0.0/32 is subnetted, 1 subnets
    C       33.33.33.33 is directly connected, Loopback33
         3.0.0.0/32 is subnetted, 1 subnets
    C       3.3.3.3 is directly connected, Loopback0
         4.0.0.0/32 is subnetted, 1 subnets
    O IA    4.4.4.4 [110/2] via 34.34.34.4, 00:00:04, FastEthernet2/0
         23.0.0.0/24 is subnetted, 1 subnets
    C       23.23.23.0 is directly connected, FastEthernet1/0
         22.0.0.0/32 is subnetted, 1 subnets
    O       22.22.22.22 [110/2] via 23.23.23.2, 00:00:04, FastEthernet1/0
         11.0.0.0/32 is subnetted, 1 subnets
    O E2    11.11.11.11 [80/1] via 34.34.34.4, 00:00:04, FastEthernet2/0
         12.0.0.0/24 is subnetted, 1 subnets
    O E2    12.12.12.0 [80/1] via 34.34.34.4, 00:00:05, FastEthernet2/0
         13.0.0.0/24 is subnetted, 1 subnets
    C       13.13.13.0 is directly connected, FastEthernet0/0
         14.0.0.0/24 is subnetted, 1 subnets
    O IA    14.14.14.0 [110/2] via 34.34.34.4, 00:00:06, FastEthernet2/0

    Now you can't see D(EIGRP routes) because I have changed the AD of all OSPF external routes to 80.

    Hope this clears your doubt what distance command does in OSPF.

    Good Luck

Sign In or Register to comment.