Sunday, 5 February 2012

Juniper OSPF Discontiguous Backbone (Virtual-Links)

Note: This is blog post is part of a series of articles dealing with Juniper Junos rather than Cisco IOS which is what some readers may be expecting. 

Traffic cannot traverse different ospf areas without going through the OSPF backbone and OSPF expects that the backbone area (area 0) is contiguous.  OSPF area membership is interface/link based.

So it is possible to use some kind of virtual technique to logically extend the OSPF backbone.  One of the tools in our toolbox is "virtual-links" which uses a non-backbone area to provide transit capability to an OSPF ABR.

In this example:

R1 is an ABR with lo0.0 in area 0 and em1.12 in area 12
R2 is a normal router with lo0.0 and em1.12 in area 12, with em1.23 in area 23
R3 is a normal router with lo0.0 and em1.23 in area 23

The starting configs are shown below:


R1 (ABR OSPF Area 0 / 23)
root@R1> show configuration | display set
set system host-name R1
set interfaces em1 vlan-tagging
set interfaces em1 unit 12 vlan-id 12
set interfaces em1 unit 12 family inet address 10.1.12.1/24
set interfaces lo0 unit 0 family inet address 1.1.1.1/32
set routing-options router-id 1.1.1.1
set protocols ospf area 0.0.0.0 interface lo0.0
set protocols ospf area 0.0.0.12 interface em1.12

R2 (OSPF Area 12 / 23)
root@R2> show configuration | display set
set system host-name R2
set interfaces em1 vlan-tagging
set interfaces em1 unit 12 vlan-id 12
set interfaces em1 unit 12 family inet address 10.1.12.2/24
set interfaces em1 unit 23 vlan-id 23
set interfaces em1 unit 23 family inet address 10.1.23.2/24
set interfaces lo0 unit 0 family inet address 2.2.2.2/32
set routing-options router-id 2.2.2.2
set protocols ospf area 0.0.0.12 interface em1.12
set protocols ospf area 0.0.0.23 interface em1.23
set protocols ospf area 0.0.0.12 interface lo0.0

R3 (OSPF Area 12 / 23)
root@R3> show configuration | display set
set system host-name R3
set interfaces em1 vlan-tagging
set interfaces em1 unit 23 vlan-id 23
set interfaces em1 unit 23 family inet address 10.1.23.3/24
set interfaces lo0 unit 0 family inet address 3.3.3.3/32
set routing-options router-id 3.3.3.3
set protocols ospf area 0.0.0.0 interface lo0.0
set protocols ospf area 0.0.0.23 interface em1.23


Let's verify OSPF is up and running and we have neighbors

root@R1> show ospf interface
Interface           State   Area            DR ID           BDR ID          Nbrs
lo0.0               DR      0.0.0.0         1.1.1.1         0.0.0.0            0
em1.12              BDR     0.0.0.12        1.1.1.1         2.2.2.2            1

root@R2> show ospf interface
Interface           State   Area            DR ID           BDR ID          Nbrs
em1.23              BDR      0.0.0.23        2.2.2.2         3.3.3.3            1
em1.12              DR      0.0.0.12        1.1.1.1         2.2.2.2            1
lo0.0               DR      0.0.0.12        2.2.2.2         0.0.0.0            0

root@R3> show ospf interface
Interface           State   Area            DR ID           BDR ID          Nbrs
em1.23              DR      0.0.0.23        2.2.2.2         3.3.3.3            1
lo0.0               DR      0.0.0.23        3.3.3.3         0.0.0.0            0

now check the routing table on R1 and R3

root@R1> show route terse

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 1.1.1.1/32         D   0                       >lo0.0
* 2.2.2.2/32         O  10          1            >10.1.12.2
* 10.1.12.0/24       D   0                       >em1.12
* 10.1.12.1/32       L   0                        Local
* 10.1.23.0/24       O  10          2            >10.1.12.2
* 224.0.0.5/32       O  10          1             MultiRecv

root@R3> show route terse

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 2.2.2.2/32         O  10          1            >10.1.23.2
* 3.3.3.3/32         D   0                       >lo0.0
* 10.1.12.0/24       O  10          2            >10.1.23.2
* 10.1.23.0/24       D   0                       >em1.23
* 10.1.23.3/32       L   0                        Local
* 224.0.0.5/32       O  10          1             MultiRecv
On R1, we cant see a route for 3.3.3.3/32 which is in OSPF Area 23, and on R3, we cant see a route for 1.1.1.1/32 which is in OSPF Area 0, since the connectivity between R1 and R3 traverses OSPF area 12.


To resolve this using virtual-links we need to add the virtual-link configuration to OSPF area 0 (this is implemented differently to the way IOS does it but personally I think this makes it much clearer as to what the configuration is doing, which is extending OSPF 0 to a new ABR)

root@R1> configure
Entering configuration mode

[edit]
root@R1# set protocols ospf area 0 virtual-link neighbor-id 2.2.2.2 transit-area 12
[edit]
root@R1# commit and-quit
commit complete
Exiting configuration mode

root@R2> configure
Entering configuration mode

[edit]
root@R2# set protocols ospf area 0 virtual-link neighbor-id 1.1.1.1 transit-area 12
[edit]
root@R2# commit and-quit
commit complete
Exiting configuration mode

Just to show what the OSPF config on R1 and R2 now looks like

root@R1> show configuration protocols ospf
area 0.0.0.0 {
    virtual-link neighbor-id 2.2.2.2 transit-area 0.0.0.12;
    interface lo0.0;
}
area 0.0.0.12 {
    interface em1.12;
}

root@R2> show configuration protocols ospf
area 0.0.0.23 {
    interface em1.23;
}
area 0.0.0.12 {
    interface lo0.0;
    interface em1.12;
}
area 0.0.0.0 {
    virtual-link neighbor-id 1.1.1.1 transit-area 0.0.0.12;
}


The virtual-link configuration establishes an on-demand point-to-point link

root@R1> show ospf interface
Interface           State   Area            DR ID           BDR ID          Nbrs
lo0.0               DR      0.0.0.0         1.1.1.1         0.0.0.0            0
vl-2.2.2.2          PtToPt  0.0.0.0         0.0.0.0         0.0.0.0            1
em1.12              BDR     0.0.0.12        2.2.2.2         1.1.1.1            1

root@R2> show ospf interface
Interface           State   Area            DR ID           BDR ID          Nbrs
em1.23              BDR     0.0.0.23        3.3.3.3         2.2.2.2            1
em1.12              DR      0.0.0.12        2.2.2.2         1.1.1.1            1
lo0.0               DR      0.0.0.12        2.2.2.2         0.0.0.0            0
vl-1.1.1.1          PtToPt  0.0.0.0         0.0.0.0         0.0.0.0            1

Let's check that R1 and R3 now have visibility of each others loopbacks in the routing table:

root@R1> show route terse

inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 1.1.1.1/32         D   0                       >lo0.0
* 2.2.2.2/32         O  10          1            >10.1.12.2
* 3.3.3.3/32         O  10          2            >10.1.12.2
* 10.1.12.0/24       D   0                       >em1.12
* 10.1.12.1/32       L   0                        Local
* 10.1.23.0/24       O  10          2            >10.1.12.2
* 224.0.0.5/32       O  10          1             MultiRecv

root@R3> show route terse

inet.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 1.1.1.1/32         O  10          2            >10.1.23.2
* 2.2.2.2/32         O  10          1            >10.1.23.2
* 3.3.3.3/32         D   0                       >lo0.0
* 10.1.12.0/24       O  10          2            >10.1.23.2
* 10.1.23.0/24       D   0                       >em1.23
* 10.1.23.3/32       L   0                        Local
* 224.0.0.5/32       O  10          1             MultiRecv

Yes, lets verify IP connectivity

root@R1> ping 3.3.3.3 source 1.1.1.1 count 3
PING 3.3.3.3 (3.3.3.3): 56 data bytes
64 bytes from 3.3.3.3: icmp_seq=0 ttl=63 time=7.210 ms
64 bytes from 3.3.3.3: icmp_seq=1 ttl=63 time=2.663 ms
64 bytes from 3.3.3.3: icmp_seq=2 ttl=63 time=2.657 ms

--- 3.3.3.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 2.657/4.177/7.210/2.145 ms

Success!

No comments:

Post a Comment