# MPLS-TE with OSPF

In the MPLS-TE Basics series, we used ISIS as our IGP. In this article we will swap ISIS for OSPF and briefly explore the OSPF LSAs which enable MPLS-TE.

### Lab <a href="#dab12312-b3ce-49a7-9c3d-8e0f355489c3" id="dab12312-b3ce-49a7-9c3d-8e0f355489c3"></a>

<figure><img src="https://1203572585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgAMH3CMtmYTBkob03NUj%2Fuploads%2FVGVD0NsKwntcCmQUo5AR%2FUntitled%206.png?alt=media&#x26;token=db79d6e1-c7b4-439f-a401-159386122fcc" alt=""><figcaption></figcaption></figure>

On each router I’ll simply remove ISIS and add OSPF. All links will be in area 0.

```
#R1
no router isis
! The above command automatically removes the isis statements under interfaces

router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
 mpls traffic-eng area 0
 mpls traffic-eng router-id lo0
!
int Gi1
 ip ospf network point-to-point
```



Let’s stop here and examine the OSPF database so far:

```
show ip ospf data

            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         35          0x80000002 0x0059AD 2         

                Type-10 Opaque Area Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Opaque ID
1.0.0.0         1.1.1.1         52          0x80000001 0x0058D1 0
```



We see a new Type-10 Opaque LSA. This is used to disseminate TE information such as bandwidth availability, link affinity, TE metric, etc.

```
show ip ospf data opaque-area 

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

                Type-10 Opaque Area Link States (Area 0)

  LS age: 126
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.0
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 0
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x58D1
  Length: 28
  Fragment number : 0

    MPLS TE router ID : 1.1.1.1

    Number of Links : 0
```



The LSA has no links, as R1 has not discovered any neighbors yet. All we see here is the MPLS TE RID. Let’s enable OSPF on R2 and then check the LSA again.

```
#R2
no router isis
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
 mpls traffic-eng area 0
 mpls traffic-eng router-id lo0
!
int Gi1
 ip ospf network point-to-point
!
int Gi2
 ip ospf network point-to-point
!
int Gi3
 ip ospf network point-to-point
```



We now see the TE information for R1 Gi1 and R2 Gi1:

```
show ip ospf data

            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         41          0x80000003 0x006B75 3         
2.2.2.2         2.2.2.2         26          0x80000006 0x00048F 5         

                Type-10 Opaque Area Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Opaque ID
1.0.0.0         1.1.1.1         283         0x80000001 0x0058D1 0       
1.0.0.0         2.2.2.2         42          0x80000001 0x005CC5 0       
1.0.0.1         1.1.1.1         41          0x80000001 0x00FCD6 1       
1.0.0.1         2.2.2.2         42          0x80000001 0x006F1E 1



show ip ospf data opaque-area 

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

                Type-10 Opaque Area Link States (Area 0)

  LS age: 252
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.0
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 0
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x58D1
  Length: 28
  Fragment number : 0

    MPLS TE router ID : 1.1.1.1

    Number of Links : 0

  LS age: 11
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.0
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 0
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x5CC5
  Length: 28
  Fragment number : 0

    MPLS TE router ID : 2.2.2.2

    Number of Links : 0

  LS age: 10
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.1
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xFCD6
  Length: 132
  Fragment number : 1

    Link connected to Point-to-Point network
      Link ID : 2.2.2.2
      Interface Address : 10.1.2.1
      Neighbor Address : 10.1.2.2
      Admin Metric : 1
      Maximum bandwidth : 125000000
      Maximum reservable bandwidth : 93750000
      Number of Priority : 8
      Priority 0 : 93750000     Priority 1 : 93750000   
      Priority 2 : 93750000     Priority 3 : 93750000   
      Priority 4 : 93750000     Priority 5 : 93750000   
      Priority 6 : 93750000     Priority 7 : 93750000   
      Affinity Bit : 0x0
      IGP Metric : 1

    Number of Links : 1

  LS age: 11
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.1
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 1
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x6F1E
  Length: 132
  Fragment number : 1

    Link connected to Point-to-Point network
      Link ID : 1.1.1.1
      Interface Address : 10.1.2.2
      Neighbor Address : 10.1.2.1
      Admin Metric : 1
      Maximum bandwidth : 125000000
      Maximum reservable bandwidth : 93750000
      Number of Priority : 8
      Priority 0 : 93750000     Priority 1 : 93750000   
      Priority 2 : 93750000     Priority 3 : 93750000   
      Priority 4 : 93750000     Priority 5 : 93750000   
      Priority 6 : 93750000     Priority 7 : 87500000   
      Affinity Bit : 0x0
      IGP Metric : 1
          
    Number of Links : 1
```



The Link ID 1.0.0.0 describes the router itself - its own MPLS TE RID. The Link ID 1.0.0.X describes each link, where X is the link index.



We’ll configure the rest of the routers in the topology. I’ll only show XR3, as the rest of the configuration will be similar on every other router.

```
#XR3
no router isis 1
router ospf 1
 mpls traffic-eng router-id lo0
 area 0
  mpls traffic-eng
  int Gi0/0/0/0
   network point-to-point
  int Gi0/0/0/1
   network point-to-point
  int Gi0/0/0/2
   network point-to-point
```



Examine the OSPF LSDB on R1 again:

```
R1#show ip ospf data | be Type-10
                Type-10 Opaque Area Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Opaque ID
1.0.0.0         1.1.1.1         990         0x80000001 0x0058D1 0       
1.0.0.0         2.2.2.2         749         0x80000001 0x005CC5 0       
1.0.0.0         3.3.3.3         50          0x80000001 0x0060B9 0       
1.0.0.0         4.4.4.4         139         0x80000001 0x0064AD 0       
1.0.0.0         5.5.5.5         8           0x80000001 0x0068A1 0       
1.0.0.0         6.6.6.6         52          0x80000001 0x006C95 0       
1.0.0.1         1.1.1.1         748         0x80000001 0x00FCD6 1       
1.0.0.1         2.2.2.2         749         0x80000001 0x006F1E 1       
1.0.0.1         4.4.4.4         139         0x80000001 0x00ACCB 1       
1.0.0.1         6.6.6.6         46          0x80000001 0x00FEAA 1       
1.0.0.2         2.2.2.2         138         0x80000001 0x00A815 2       
1.0.0.2         4.4.4.4         65          0x80000001 0x007046 2       
1.0.0.2         6.6.6.6         22          0x80000001 0x006634 2       
1.0.0.3         2.2.2.2         64          0x80000001 0x00CDF7 3       
1.0.0.3         4.4.4.4         51          0x80000001 0x00940C 3       
1.0.0.3         6.6.6.6         22          0x80000002 0x00A1FD 3       
1.0.0.4         3.3.3.3         50          0x80000001 0x00DBEC 4       
1.0.0.4         5.5.5.5         8           0x80000001 0x00D1DA 4       
1.0.0.5         3.3.3.3         50          0x80000001 0x005E77 5       
1.0.0.6         3.3.3.3         45          0x80000001 0x003D7B 6
```



You can see every router has originated a 1.0.0.0 LSA. Additionally routers have advertised their own 1.0.0.X LSAs, one for each interface. These can overlap without an issue. For example, there are multiple 1.0.0.1 LSAs, but each from a different advertising router.



You may wonder why this LSA is called Opaque _area_. There are three LSA types which are Opaque LSAs:

* Type 9 Link-local - this is used for OSPFv3 to learn the IPv6 link-local address of a directly connected neighbor
* Type 10 Area-local - this is used by MPLS-TE, and only flooded within the area
* Type 11 AS scope - this is used when opaque information needs to be flooded for external prefixes to the entire OSPF domain. I have seen this used with SR when a type 5 LSA has an associated prefix SID which is advertised with a type 11 Opaque so that it is flooded “alongside” the type 5 LSA.



The first eight bits (the first 1 in the LSA IDs above) is used for the Opaque Type. Type 1 is Traffic Engineering LSA. Here is a full list of Opaque Types:

[https://www.iana.org/assignments/ospf-opaque-types/ospf-opaque-types.xhtml](https://www.iana.org/assignments/ospf-opaque-types/ospf-opaque-types.xhtml)



The last 24 bits of the LSA ID is used for the Opaque ID, which you can see in the furthest-right hand column in the output above. In all our examples so far, this is a number below 255 so this fits neatly into the last octect of the LSA ID.



The word “Opaque” refers to the fact that this information is not necessary to the core functionality of OSPF, which is choosing best paths. Instead, OSPF is carrying this “extra” information for other purposes, such as MPLS-TE. OSPF simply assists with populating the TED. It does not need the information contained in the Opaque LSAs to preform SPF.
