OSPF Superbackbone rules
===========

  • PE-routers are advertising themselves as Area Border Routers. The superbackbone appears as another area to the CE-routers.
  • Routes redistributed into MP-BGP from OSPF will appear as inter-area routes in other OSPF sites if the original route was an intra-area or inter-area route and as external routes if the original route was an external route.

As a consequence to the second rule, routes from the backbone area at one site
appear as inter-area routes (not as backbone routes) in backbone areas at other
sites, since the super-backbone appears as another area behind the PE-router (acting as ABR). (Routes from area 0 at one site appear as inter-area routes in area 0 at another site)

Receiving PE router will check if the domain id of an OSPF route in MP-BGP update is same as  itself. If so, superbackbone concept will be used.

OSPF Domain id derives from OSPF process id.


OSPF Domain Identifier
============
Domain id, Route Type and Router id are three BGP extended communities attributes used in OSPF MPLS ××× Enviroment.
All BPG extended communities attributes are comprised of two-octet type field and six-octet value.

If two OSPF instances are in the same OSPF domain, then either:


  • They both have the NULL Domain Identifier (six-byte zero value), OR
    Actually, we cannot tell whether it is from same domain from NULL domain id.
  • Each OSPF instance has the primary Domain Identifier of the other as one of its own Domain Identifiers.
    We can have more than one domain id, but one of them should be primary domain     id. Advertised route is associated with primary domain id.

By default, OSPF domain id consists of OSPF process id.

R3_PE#sh ip bgp vpnv4 all 192.168.1.0
BGP routing table entry for 1:200:192.168.1.0/24, version 28
Paths: (1 available, best #1, table CustomerB)
  Not advertised to any peer
  Local
    5.5.5.5 (metric 2809856) from 5.5.5.5 (5.5.5.5)
      Origin incomplete, metric 50, localpref 100, valid, internal, best
      Extended Community: RT:1:200 OSPF DOMAIN ID:0x0005:0x000000CA0200 OSPF RT:0.0.0.0:5:1 OSPF ROUTER ID:10.1.1.21:1281,
      mpls labels in/out nolabel/23

000000CA0200 -> CA is process id 202.


How OSPF set routes' metric redistributed back from BGP?
============

R3_PE#sh ip bgp vpnv4 all
BGP table version is 35, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 1:100 (default for vrf CustomerA_R1)
*> 10.1.1.8/30      0.0.0.0                  0         32768 ?    _
*>i10.1.1.16/30     5.5.5.5                  0    100      0 ?     |
*> 172.16.1.0/24    10.1.1.9                65         32768 ?     | -> redistributed into R1 (same domain id)
*>i172.16.10.0/24   5.5.5.5                 65    100      0 ?     |
*>i210.1.1.0        5.5.5.5                 84    100      0 ?    _|
Route Distinguisher: 1:200 (default for vrf CustomerB)
*> 10.1.1.12/30     0.0.0.0                  0         32768 ?    _
*>i10.1.1.20/30     5.5.5.5                  0    100      0 ?     |
*> 172.16.1.1/32    10.1.1.14               65         32768 ?     | -> redistributed into R2 (different domain id)
*>i172.16.2.1/32    5.5.5.5                 65    100      0 ?     |
*>i192.168.1.0      5.5.5.5                 50    100      0 ?    _|

R1_CE_A#sh ip route
O E2 220.2.2.0/24 [110/20] via 10.1.1.10, 00:01:06, Serial1/0
     172.16.0.0/24 is subnetted, 2 subnets
O IA    172.16.10.0 [110/129] via 10.1.1.10, 00:15:26, Serial1/0
C       172.16.1.0 is directly connected, FastEthernet0/0
     10.0.0.0/30 is subnetted, 2 subnets
C       10.1.1.8 is directly connected, Serial1/0
O IA    10.1.1.16 [110/65] via 10.1.1.10, 00:15:26, Serial1/0
O E1 210.1.1.0/24 [110/148] via 10.1.1.10, 00:11:54, Serial1/0

Route type and route metric will be inherited from same domain. Metric will be copied from bgp.

R2_CE_B#sh ip route
     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C       172.16.1.0/24 is directly connected, Loopback0
O E2    172.16.2.1/32 [110/65] via 10.1.1.13, 01:37:50, Serial1/0
     10.0.0.0/30 is subnetted, 2 subnets
C       10.1.1.12 is directly connected, Serial1/0
O E2    10.1.1.20 [110/1] via 10.1.1.13, 01:37:50, Serial1/0
O E2 192.168.1.0/24 [110/50] via 10.1.1.13, 01:07:39, Serial1/0

Routes will be redistributed as external routes from different domain. Plesae note that OSPF will use default external type (type 2) even if redistributed route has route type with E1. Metric will be copied from bgp.

Note:

Whether or not domain id is identical, when bgp metric is not present (i.e. metric = 0), redistributed route will use metric 1.

R3_PE#sh ip bgp vpnv4 all  10.1.1.20/30
BGP routing table entry for 1:200:10.1.1.20/30, version 19
Paths: (1 available, best #1, table CustomerB)
  Not advertised to any peer
  Local
    5.5.5.5 (metric 2809856) from 5.5.5.5 (5.5.5.5)
      Origin incomplete, metric 0, localpref 100, valid, internal, best
      Extended Community: RT:1:200 OSPF DOMAIN ID:0x0005:0x000000CA0200 OSPF RT:0.0.0.2:2:0 OSPF ROUTER ID:10.1.1.21:512,
      mpls labels in/out nolabel/22

R2_CE_B#sh ip route
O E2    10.1.1.20 [110/1] via 10.1.1.13, 01:37:50, Serial1/0
...

Basically, I am not one hundred percent this is true since I cannot find any reference. This conclusion is just from my lab. ^_^


Routing Loop
=========

a. Down bit


            OSPF Router with ID (10.10.10.5) (Process ID 101)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
6.6.6.6         6.6.6.6         450         0x80000002 0x0026EF 2
10.10.10.5      10.10.10.5      451         0x80000001 0x00E22A 2

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.1.8        10.10.10.5      250         0x80000001 0x000186
172.16.1.0      10.10.10.5      251         0x80000001 0x00EEAB
172.16.10.0     6.6.6.6         453         0x80000001 0x00EA72

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
210.1.1.0       6.6.6.6         411         0x80000001 0x00E350 0
220.2.2.0       6.6.6.6         411         0x80000001 0x00CDD9 0
R5_PE#sh ip os da su
R5_PE#sh ip os da summary 172.16.1.0

======================================================================

            OSPF Router with ID (10.10.10.5) (Process ID 101)

                Summary Net Link States (Area 0)

  LS age: 259
  Options: (No TOS-capability, DC, Downward)
  LS Type: Summary Links(Network)
  Link State ID: 172.16.1.0 (summary Network Number)
  Advertising Router: 10.10.10.5
  LS Seq Number: 80000001
  Checksum: 0xEEAB
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 65

The keyword "Downward" will be present to prevent LSA type 3 routing loop. When PE router receives type 3 route with down-bit set, it will not redistribute the route into iBGP update.

Down-bit is introduced in the Option field of LSA header. Down-bit is only support in LSA type 3 (summary route) header.


R1_CE_A#sh ip os da summary 10.1.1.16

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

                Summary Net Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 1748
  Options: (No TOS-capability, DC, Downward)
  LS Type: Summary Links(Network)
  Link State ID: 10.1.1.16 (summary Network Number)
  Advertising Router: 10.10.10.3
  LS Seq Number: 80000001
  Checksum: 0xBCC4
  Length: 28
  Network Mask: /30
        TOS: 0  Metric: 1


                Summary Net Link States (Area 1)

  LS age: 1747
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 10.1.1.16 (summary Network Number)
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xAB33
  Length: 28
  Network Mask: /30
        TOS: 0  Metric: 65

Down-bit set will be cleared when the route is advertised to another area or redistributed into other domains.


b. OSPF Route tag or ××× route tag

The down bit is not set because LSA Type 5 does not support the down bit. The redistributed route is propagated across the OSPF domain.

The OSPF tag field is only present in the external OSPF routes (type-5 LSA or
type-7 LSA). This technique therefore cannot detect cross-domain loops involving
internal OSPF routes.

  • Whenever a router redistributes a BGP route into OSPF, the tag field in the type-5 (or type-7) LSA is set to the AS-number of the redistributing router
  • The tag field from an external OSPF route is propagated across OSPF domains when the external OSPF route isredistributed into another OSPF domain
  • PE-routers filter external OSPF routes based on their tag field and do not redistribute routes with tag field equal to the BGP AS-number into MP-BGP

R3_PE#sh ip os da external 192.168.1.0

            OSPF Router with ID (10.1.1.13) (Process ID 201)

                Type-5 AS External Link States

  LS age: 904
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 192.168.1.0 (External Network Number )
  Advertising Router: 10.1.1.13
  LS Seq Number: 80000001
  Checksum: 0xEE3E
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 50
        Forward Address: 0.0.0.0
        External Route Tag: 3489660929

        0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| LS age | Options | 5 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Link State ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Advertising Router |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| LS sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| LS checksum | length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Network Mask |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|E| TOS | metric |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Forwarding address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| External Route Tag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
External Route Tag will be kept when route redistributed into other domain. This field is only used when BGP update is redistributed into OSPF. (only available in LSA type 5)


Sham Link
=========

A sham-link is required between any two ××× sites that belong to the same OSPF area and share an OSPF backdoor link. If no backdoor link exists between the sites, no sham-link is required.

When a sham-link is in use, the PE routers will receive intra-area OSPF routes
two ways. One way is via the backdoor link. The other way is via the sham-link.


R3_PE#sh ip route vrf CustomerA

Routing Table: CustomerA
Codes: 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

Gateway of last resort is not set

     172.16.0.0/32 is subnetted, 2 subnets
O IA    172.16.1.1 [110/65] via 10.1.1.9, 00:05:52, Serial1/0
O IA    172.16.2.1 [110/66] via 5.5.5.5, 00:05:52
     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
C       10.1.1.8/30 is directly connected, Serial1/0
C       10.10.10.3/32 is directly connected, Loopback1
B       10.10.10.5/32 [200/0] via 5.5.5.5, 00:07:28
O       10.1.1.24/30 [110/259] via 10.1.1.9, 00:05:52, Serial1/0
O       10.1.1.16/30 [110/65] via 5.5.5.5, 00:05:52

Routes in red are calculated by SPF algorithms, sham-link is prefered. These routes will never get redistributed into BGP.

R3_PE#sh ip bgp vpnv4 all
BGP table version is 38, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 1:100 (default for vrf CustomerA)
*> 10.1.1.8/30      0.0.0.0                  0         32768 ?
r>i10.1.1.16/30     5.5.5.5                  0    100      0 ?
* i10.1.1.24/30     5.5.5.5                259    100      0 ?
*>                  10.1.1.9               259         32768 ?
*> 10.10.10.3/32    0.0.0.0                  0         32768 ?
*>i10.10.10.5/32    5.5.5.5                  0    100      0 ?
*> 172.16.1.1/32    10.1.1.9                65         32768 ?
r>i172.16.2.1/32    5.5.5.5                 65    100      0 ?
Route Distinguisher: 1:200 (default for vrf CustomerB)
*> 10.1.1.12/30     0.0.0.0                  0         32768 ?
*>i10.1.1.20/30     5.5.5.5                  0    100      0 ?
*> 172.16.1.1/32    10.1.1.14               65         32768 ?
*>i172.16.2.1/32    5.5.5.5                 65    100      0 ?

Routes in red are advertised over sham-link, since these two routes prefered, R3_PE will not redistribute the route into BGP, the other end of PE router does that redistribution.

When sham-link enabled, you will see in LSA type 1

 Link connected to: another Router (point-to-point)
  (Link ID) Neighboring Router ID: 10.1.1.10
  (Link Data) Router Interface address: 0.0.0.12
   Number of TOS metrics: 0
    TOS 0 Metrics: 1

Sham-link will be considered as point-to-point link.

Sham-link OSPF Process Snapshot

OSPF PE-CE Routing Protocol in MPLS ×××_休闲


However, after establishing the adjacency, hello will be suppressed and periodic LSA refresh is not needed as DoNotAge is set.

R3_PE#sh ip os sham-links
Sham Link OSPF_SL1 to address 10.10.10.5 is up
Area 0 source address 10.10.10.3
  Run as demand circuit
  DoNotAge LSA allowed. Cost of using 1 State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40,
    Hello due in 00:00:04
    Adjacency State FULL (Hello suppressed)
    Index 2/2, 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

BGP Extended Commutinies Attributes
==========

In MPLS ×××, BGP ECA is very important, it does the following business:

Route Distinguisher: ××× identifier and unique all ipv4 routes
Route Target: used to filter routes when site belongs to multiple vpn

OSPF Domain ID
OSPF Router ID
OSPF Route Type

Used by OSPF for route transparency

××× lable: each vpn route will also get a label, label will be transfered by BGP and used when normal traffic flows in ×××.