Skip to main content

4. Setting OSPF tags, BGP ORIGIN and AS_PATH attributes

The OSPF external route tag is a "32-bit field attached to each external route . . . It may be used to communicate information between AS boundary routers; the precise nature of such information is outside the scope of [the] specification." [RFC1247]

OSPF imports information from various routing protocols at all its ASBRs. In some instances, it is possible to use protocols other than EGP or BGP across autonomous systems. It is important, in BGP, to differentiate between routes that are external to the OSPF routing domain but must be considered internal to the AS, as opposed to routes that are external to the AS.

Routes that are internal to the AS and that may or may not be external to the OSPF routing domain will not come to the various BGP speakers via IBGP. Therefore, ASBRs running BGP must have knowledge of this class of routes so that they can advertise these routes to the various external AS without waiting for IBGP updates about these routes.

Additionally, in the specific instance of an AS intermixing routers running EGP and BGP as external gateway routing protocols, using OSPF as an IGP, the network administrator does not have to configure IBGP on every ASBR running EGP and not running BGP, if this information can be carried in the OSPF tag field.

We use the external route tag field in OSPF to intelligently set the ORIGIN and AS_PATH attributes in BGP. Both the ORIGIN and AS_PATH attributes are well-known, mandatory attributes in BGP. The exact mechanism for setting the tags is defined below.

The tag is broken up into sub-fields shown below. The various sub-fields specify the characteristics of the route imported into the OSPF routing domain.

The high bit of the OSPF tag is known as the "Automatic" bit. When this bit is set to 1, the following sub-fields apply:

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|a|c|p l| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   a    is 1 bit called the Automatic bit, indicating that the
Completeness and PathLength bits have been generated
automatically by a router. The meaning of this characteristic
and its setting are defined below.

c is 1 bit of Completeness information. The meaning of this
characteristic and its settings are defined below.

pl are 2 bits of PathLength information. The meaning of this
characteristic and its setting are defined below.

ArbitraryTag (or "at")
is 12 bits of tag information, which defaults to 0 but can be
configured to anything else.

AutonomousSystem (or "as")
is 16 bits, indicating the AS number corresponding to the
route, 0 if the route is to be considered as part of the local
AS.

When the Automatic bit is set to 0, the following sub-fields apply:

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|a| LocalInfo |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   a    is 1 bit called the Automatic bit, set to 0.

LocalInfo (or "li")
is 31 bits of an arbitrary value, manually configured by the
network administrator.

The format of the tag for various values of the characteristics bits is defined below.

4.1. Semantics of the characteristics bits​

The Completeness and PathLength characteristics bits define the characteristic of the route imported into OSPF from other ASBRs in the autonomous system. This setting is then used to set the ORIGIN and NEXT_HOP attributes when re-exporting these routes to an external BGP speaker.

  • The "a" bit or the Automatic characteristic bit is set when the Completeness and PathLength characteristics bits are automatically set by a border router.

For backward compatibility, the Automatic bit must default to 0 and the network administrator must have a mechanism to enable automatic tag generation. Nothing must be inferred about the characteristics of the OSPF route from the tag bits, unless the tag has been automatically generated.

  • The "c" bit of the Completeness characteristic bit is set when the source of the incoming route is known precisely, for instance, from an IGP within the local autonomous system or EGP at one of the autonomous system's boundaries. It refers to the status of the path information carried by the routing protocol.

  • The "pl" or the PathLength characteristic sub-field is set depending on the length of the AS_PATH that the protocol could have carried when importing the route into the OSPF routing domain. The length bits will indicate whether the AS_PATH attribute for the length is zero, one, or greater than one.

Routes imported from an IGP will usually have an AS_PATH of length of 0, routes imported from an EGP will have an AS_PATH of length 1, BGP and routing protocols that support complete path information, either as AS_PATHs or routing domain paths, will indicate a path greater than 1.

The OSPF tag is not wide enough to carry path information about routes that have an associated PathLength greater than one. Path information about these routes will have to be carried via IBGP. Such routes must not be exported from OSPF into BGP.

For brevity in the following sections, the keywords O and P refer to the BGP ORIGIN and AS_PATH attributes respectively. Likewise, we use the abbreviations , "l" and "nh" for the local_AS and next_hop_AS respectively in the following sections.

4.2. Configuration parameters for setting the OSPF tag​

  • There must be a mechanism to enable automatic generation of the tag characteristic bits.

  • Configuration of an ASBR running OSPF must include the capability to associate a tag value, for the ArbitraryTag, or LocalInfo sub-field of the OSPF tag, with each instance of a routing protocol.

  • Configuration of an ASBR running OSPF must include the capability to associate an AS number with each instance of a routing protocol.

Associating an AS number with an instance of an IGP is equivalent to flagging those set of routes imported from the IGP to be external routes outside the local autonomous system.

Specifically, when the IGP is RIP [RFC1058], it should be possible to associate a tag and/or an AS number with every interface running RIP on the ASBR.

4.3. Manually configured tags​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0| LocalInfo |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

This tag setting corresponds to the administrator manually setting the tag bits. Nothing shall be inferred about the characteristics of the route corresponding to this tag setting.

For backward compatibility with existing implementations of OSPF currently deployed in the field, this must be the default setting for importing routes into the OSPF routing domain. There must be a mechanism to enable automatic tag generation for imported routes.

The OSPF tag to BGP attribute mappings for these routes must be

   a=0, li=Arbitrary_Value  =>  O=<INCOMPLETE>, P=<l>

4.4. Automatically generated tags​

4.4.1. Routes with incomplete path information, pl = 0.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|0|0|0| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with incomplete path information and cannot or may not carry the neighbour AS or AS path as part of the routing information.

The OSPF tag to BGP attribute mappings for these routes must be

                   a=1,c=0,pl=00,as=0 => O=<EGP>, P=<l>

4.4.2. Routes with incomplete path information, pl = 1.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|0|0|1| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with incomplete path information and carry the neighbour AS as part of the routing information.

The OSPF tag to BGP attribute mappings for these routes must be

                a=1,c=0,pl=01,as=nh => O=<EGP>, P=<l, nh>

This setting should be used for importing EGP routes into the OSPF routing domain. This setting can also be used when importing BGP routes whose origin= and AS_PATH=; if the BGP learned route has no other transitive attributes, then its propogation via IBGP can be suppressed.

4.4.3. Routes with incomplete path information, pl >= 1.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|0|1|0| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with truncated path information.

The OSPF tag to BGP attribute mappings for these routes must be

                        a=1,c=0,pl=10,as=don't care

These are imported by a border router, which is running BGP to a stub domain, and not running IBGP to other ASBRs. This causes a truncation of the AS_PATH. These routes must not be re-exported into BGP at another ASBR.

4.4.4. Routes with complete path information, pl = 0.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|1|0|0| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with either complete path information or are known to be complete through means other than that carried by the routing protocol.

The OSPF tag to BGP attribute mappings for these routes must be

                   a=1,c=1,pl=00,as=0 => O=<IGP>, P=<l>

This should be used for importing routes into OSPF from an IGP.

4.4.5. Routes with complete path information, pl = 1.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|1|0|1| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with either complete path information, or are known to be complete through means other than that carried by the routing protocol. The routing protocol also has additional information about the neighbour AS of the route.

The OSPF tag to BGP attribute mappings for these routes must be

                 a=1,c=1,pl=01,as=nh => O=<IGP>, P=<l, nh>

This setting should be used when the administrator explicitly associates an AS number with an instance of an IGP. This setting can also be used when importing BGP routes whose origin= and AS_PATH=; if the BGP learned route has no other transitive attributes, then its propogation via IBGP can be suppressed.

4.4.6. Routes with complete path information, pl >= 1.​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|1|1|0| ArbitraryTag | AutonomousSystem |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

These are routes imported from routing protocols with complete path information and carry the AS path information as part of the routing information.

The OSPF tag must be set to

                        a=1,c=1,pl=10,as=don't care

These routes must not be exported into BGP because these routes are already imported from BGP into the OSPF RD. Hence, it is assumed that the BGP speaker will convey this information to other BGP speakers via IBGP.

Note that an implementation may import BGP routes with a path length of 1 and no other transitive attributes directly into OSPF and not send these routes via IBGP. In this situation, it must use tag settings corresponding to 4.1.2.2, or 4.1.2.5.

4.5. Miscellaneous tag settings​

       0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|x|1|1| Reserved for future use |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The value of pl = 3 is reserved during automatic tag generation. Routers must not generate such a tag when importing routes into the OSPF routing domain. ASBRs must ignore tags which indicate a pl = 3.

4.6. Summary of the tag sub-field setting​

The following table summarises the various combinations of automatic tag settings for the Completeness and PathLength sub-field of the OSPF tag and the default behaviour permitted for each setting.

      Completeness := 0 | 1 ;
PathLength := 00 | 01 | 10 | 11;
ORIGIN := <INCOMPLETE> | <IGP> | <EGP>;

AS_PATH := valid AS path settings as defined in BGP.

pl = 00 pl = 01 pl = 10 pl = 11
+----------------------------------------------------------------
|
c = 0 | <EGP><l> <EGP><l,nh> never export reserved
c = 1 | <IGP><l> <IGP><l,nh> out of band reserved
|

The "out of band" in the table above implies that OSPF will not be able to carry everything that BGP needs in its routing information. Therefore, some other means must be found to carry this information. In BGP, this is done via IBGP.