Tuesday 26 January 2016

OSPF virtual link

In this example we will test cost and virtual link







We will configured OSPF in R1, R2, R3, R4 and R5. Note that R4 need a virtual area


All areas in an Open Shortest Path First (OSPF) autonomous system must be physically connected to the backbone area (Area 0). In some cases, where this is not possible, you can use a virtual link to connect to the backbone through a non-backbone area. You can also use virtual links to connect two parts of a partitioned backbone through a non-backbone area. The area through which you configure the virtual link, known as a transit area, must have full routing information. The transit area cannot be a stub area.

-===========R1
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 0
!
interface Ethernet0/0
 ip address 12.0.0.1 255.255.255.0
 ip ospf 1 area 0
 ip ospf cost 10
!
interface Ethernet0/1
 ip address 13.0.0.1 255.255.255.0
 ip ospf 1 area 0
 ip ospf cost 100 _+++++++++++++++
!


!
-==========R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 2
!
interface Ethernet0/0
 ip address 12.0.0.2 255.255.255.0
 ip ospf 1 area 0
!
interface Ethernet0/1
 ip address 24.0.0.1 255.255.255.0
 ip ospf 1 area 2
!

-==========R3

interface Loopback0
 ip address 3.3.3.3 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 1
!
interface Ethernet0/0
 ip address 13.0.0.2 255.255.255.0
 ip ospf 1 area 0
!
interface Ethernet0/1
 ip address 34.0.0.1 255.255.255.0
 ip ospf 1 area 1
!








-===========R4
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 4
!
interface Ethernet0/0
 ip address 24.0.0.2 255.255.255.0
 ip ospf 1 area 2
!
interface Ethernet0/1
 ip address 34.0.0.2 255.255.255.0
 ip ospf 1 area 1
!
interface Ethernet0/2
 ip address 45.0.0.2 255.255.255.0
 ip ospf 1 area 4
!
-=========R5
!
interface Loopback0
 ip address 5.5.5.5 255.255.255.0
 ip ospf 1 area 4
!
interface Ethernet0/0
 ip address 45.0.0.1 255.255.255.0
 ip ospf 1 area 4
!

To configure the virtual links

R2#sh run | s router
router ospf 1
 area 2 virtual-link 4.4.4.4
R2#

R3#sh run | s router
router ospf 1
 router-id 3.3.3.3
 area 1 virtual-link 4.4.4.4
R3#



R4#sh run | s router
router ospf 1
 area 1 virtual-link 3.3.3.3
 area 2 virtual-link 2.2.2.2
R4#

here when the OSPF cost was 100 in R1 toward R3


R1# sh ip ospf inter | i Cost
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 100
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
R1#


R1# sh ip route 4.4.4.4
Routing entry for 4.4.4.0/24
  Known via "ospf 1", distance 110, metric 21, type inter area
  Last update from 12.0.0.2 on Ethernet0/0, 00:18:22 ago
  Routing Descriptor Blocks:
  * 12.0.0.2, from 4.4.4.4, 00:18:22 ago, via Ethernet0/0
      Route metric is 21, traffic share count is 1
R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      2.0.0.0/24 is subnetted, 1 subnets
O IA     2.2.2.0 [110/11] via 12.0.0.2, 00:33:22, Ethernet0/0
      3.0.0.0/24 is subnetted, 1 subnets
O IA     3.3.3.0 [110/31] via 12.0.0.2, 00:24:03, Ethernet0/0
      4.0.0.0/24 is subnetted, 1 subnets
O IA     4.4.4.0 [110/21] via 12.0.0.2, 00:19:11, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
O IA     5.5.5.5 [110/31] via 12.0.0.2, 00:20:25, Ethernet0/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.0.0.0/24 is directly connected, Ethernet0/0
L        12.0.0.1/32 is directly connected, Ethernet0/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.0.0.0/24 is directly connected, Ethernet0/1
L        13.0.0.1/32 is directly connected, Ethernet0/1
      24.0.0.0/24 is subnetted, 1 subnets
O IA     24.0.0.0 [110/20] via 12.0.0.2, 00:33:22, Ethernet0/0
      34.0.0.0/24 is subnetted, 1 subnets
O IA     34.0.0.0 [110/30] via 12.0.0.2, 00:30:51, Ethernet0/0
      45.0.0.0/24 is subnetted, 1 subnets
O IA     45.0.0.0 [110/30] via 12.0.0.2, 00:20:25, Ethernet0/0
R1#

When we put same cost in both.



R1# sh ip ospf inter | i Cost
  Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
  Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
R1#

R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0
      2.0.0.0/24 is subnetted, 1 subnets
O IA     2.2.2.0 [110/11] via 12.0.0.2, 00:41:27, Ethernet0/0
      3.0.0.0/24 is subnetted, 1 subnets
O IA     3.3.3.0 [110/11] via 13.0.0.2, 00:00:19, Ethernet0/1
      4.0.0.0/24 is subnetted, 1 subnets
O IA     4.4.4.0 [110/21] via 13.0.0.2, 00:00:19, Ethernet0/1
                 [110/21] via 12.0.0.2, 00:27:16, Ethernet0/0
      5.0.0.0/32 is subnetted, 1 subnets
O IA     5.5.5.5 [110/31] via 13.0.0.2, 00:00:19, Ethernet0/1
                 [110/31] via 12.0.0.2, 00:28:30, Ethernet0/0
      12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        12.0.0.0/24 is directly connected, Ethernet0/0
L        12.0.0.1/32 is directly connected, Ethernet0/0
      13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        13.0.0.0/24 is directly connected, Ethernet0/1
L        13.0.0.1/32 is directly connected, Ethernet0/1
      24.0.0.0/24 is subnetted, 1 subnets
O IA     24.0.0.0 [110/20] via 12.0.0.2, 00:41:27, Ethernet0/0
      34.0.0.0/24 is subnetted, 1 subnets
O IA     34.0.0.0 [110/20] via 13.0.0.2, 00:00:19, Ethernet0/1
      45.0.0.0/24 is subnetted, 1 subnets
O IA     45.0.0.0 [110/30] via 13.0.0.2, 00:00:19, Ethernet0/1
                  [110/30] via 12.0.0.2, 00:28:30, Ethernet0/0
R1#


R1#  sh ip ospf database

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1643        0x8000002A 0x00BFD5 3
2.2.2.2         2.2.2.2         2009        0x80000025 0x003461 2
3.3.3.3         3.3.3.3         1522        0x80000004 0x00C2DF 2
4.4.4.4         4.4.4.4         2     (DNA) 0x80000004 0x002D69 2

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.1        1.1.1.1         903         0x80000024 0x001BDE
13.0.0.1        1.1.1.1         1653        0x80000024 0x0040B4

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
2.2.2.0         2.2.2.2         769         0x80000024 0x00C842
2.2.2.0         4.4.4.4         7     (DNA) 0x80000001 0x0037E4
3.3.3.0         3.3.3.3         1775        0x80000002 0x00CA5B
3.3.3.0         4.4.4.4         2     (DNA) 0x80000001 0x001306
4.4.4.0         4.4.4.4         2     (DNA) 0x80000001 0x008A95
5.5.5.5         4.4.4.4         2     (DNA) 0x80000001 0x009875
24.0.0.0        2.2.2.2         769         0x80000024 0x0032BD
24.0.0.0        4.4.4.4         7     (DNA) 0x80000001 0x003CCE
34.0.0.0        3.3.3.3         1522        0x80000004 0x00D130
34.0.0.0        4.4.4.4         7     (DNA) 0x80000001 0x00B947
45.0.0.0        4.4.4.4         2     (DNA) 0x80000001 0x002ACB
R1#


R4#sh ip ospf virtual-links
Virtual Link OSPF_VL3 to router 3.3.3.3 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Ethernet0/1
 Topology-MTID    Cost    Disabled     Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:06
    Adjacency State FULL (Hello suppressed)
    Index 2/5, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
Virtual Link OSPF_VL2 to router 2.2.2.2 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 2, via interface Ethernet0/0
 Topology-MTID    Cost    Disabled     Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:08
    Adjacency State FULL (Hello suppressed)
    Index 1/4, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
R4#
R3>en
R3#sh ip ospf virtu
R3#sh ip ospf virtual-links
Virtual Link OSPF_VL0 to router 4.4.4.4 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface Ethernet0/1
 Topology-MTID    Cost    Disabled     Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:06
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
R3#

R2#sh ip ospf vir
R2#sh ip ospf virtual-links
Virtual Link OSPF_VL1 to router 4.4.4.4 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 2, via interface Ethernet0/1
 Topology-MTID    Cost    Disabled     Shutdown      Topology Name
        0           10        no          no            Base
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:02
    Adjacency State FULL (Hello suppressed)
    Index 2/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
R2#