Step 18d. AS-External LSAs of mixed ‘type 1/type 2 metric’ with the same advertised destination¶
Goals¶
The goal of this step is to demonstrate OSPF’s behavior when multiple ASBRs advertise the same external destination using different metric types (Type-1 and Type-2).
OSPF always prefers Type-1 (E1) routes over Type-2 (E2) routes for the same destination, regardless of the metric values. This is because E1 routes include internal topology in the cost calculation, making them more accurate.
Configuration¶
This configuration is based on Step 18. Some ASBRs use Type-1 metrics while others use Type-2 metrics for the same destination.
The configuration in omnetpp.ini is the following:
[Config Step18d]
description = "AS-External LSAs of mixed 'type 1/type 2 metric' with the same advertised destination"
extends = Step18
network = OSPF_Area_External_Same_Dest
*.R*.ospf.ospfConfig = xmldoc("ASConfig_Area_ExternalRoute_Mixed_Dest.xml")
*.configurator.config = xml("<config> \
<interface hosts='R3' towards='R4' address='192.168.0.x' netmask='255.255.255.x' /> \
<interface hosts='R4' towards='R3' address='192.168.0.x' netmask='255.255.255.x' /> \
\
<interface hosts='R3' towards='N1.*' address='192.168.9.x' netmask='255.255.255.x' /> \
<interface hosts='R5' towards='N1.*' address='192.168.9.x' netmask='255.255.255.x' /> \
\
<interface among='host1 host2 R1 R2 R3' address='192.168.11.x' netmask='255.255.255.x' /> \
<interface among='R3 R4 R5 host3' address='192.168.22.x' netmask='255.255.255.x' /> \
<interface hosts='N1.host[*]' address='192.168.9.x' netmask='255.255.255.x' /> \
\
<route hosts='host*' destination='*' netmask='0.0.0.0' interface='eth0' /> \
</config>")
The OSPF configuration:
<?xml version="1.0"?>
<OSPFASConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="OSPF.xsd">
<!-- Areas -->
<Area id="0.0.0.0">
<AddressRange address="R3>R4" mask="R3>R4" />
<AddressRange address="R4>R3" mask="R4>R3" />
</Area>
<Area id="0.0.0.1">
<AddressRange address="R1>switch1" mask="R1>switch1" />
<AddressRange address="R1>R2" mask="R1>R2" />
<AddressRange address="R1>R3" mask="R1>R3" />
<AddressRange address="R2>switch2" mask="R2>switch2" />
<AddressRange address="R2>R1" mask="R2>R1" />
<AddressRange address="R2>R3" mask="R2>R3" />
<AddressRange address="R3>R1" mask="R3>R1" />
<AddressRange address="R3>R2" mask="R3>R2" />
</Area>
<Area id="0.0.0.2">
<AddressRange address="R4>R5" mask="R4>R5" />
<AddressRange address="R5>R4" mask="R5>R4" />
<AddressRange address="R5>switch3" mask="R5>switch3" />
</Area>
<!-- Routers -->
<Router name="R1" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.1" interfaceMode="Passive" />
<PointToPointInterface ifName="ppp0" areaID="0.0.0.1" />
<PointToPointInterface ifName="ppp1" areaID="0.0.0.1" />
</Router>
<Router name="R2" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.1" interfaceMode="Passive" />
<PointToPointInterface ifName="ppp0" areaID="0.0.0.1" />
<PointToPointInterface ifName="ppp1" areaID="0.0.0.1" />
</Router>
<Router name="R3" RFC1583Compatible="true">
<PointToPointInterface ifName="ppp0" areaID="0.0.0.1" />
<PointToPointInterface ifName="ppp1" areaID="0.0.0.1" />
<PointToPointInterface ifName="ppp2" areaID="0.0.0.0" />
<ExternalInterface toward="N1" advertisedExternalNetworkAddress="192.168.9.0" advertisedExternalNetworkMask="255.255.255.0" externalInterfaceOutputCost="10" externalInterfaceOutputType="Type1" />
</Router>
<Router name="R4" RFC1583Compatible="true">
<PointToPointInterface ifName="ppp0" areaID="0.0.0.2" />
<PointToPointInterface ifName="ppp1" areaID="0.0.0.0" />
</Router>
<Router name="R5" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.2" interfaceMode="Passive" />
<PointToPointInterface ifName="ppp0" areaID="0.0.0.2" />
<ExternalInterface toward="N1" advertisedExternalNetworkAddress="192.168.9.0" advertisedExternalNetworkMask="255.255.255.0" externalInterfaceOutputCost="5" externalInterfaceOutputType="Type2" />
</Router>
</OSPFASConfig>
Results¶
When ASBRs advertise the same destination with mixed metric types:
OSPF always prefers E1 (Type-1) routes over E2 (Type-2) routes.
Even if an E2 route has a lower advertised cost, the E1 route will be selected.
This preference reflects OSPF’s design: E1 routes provide more accurate end-to-end cost calculation by including internal topology.
All routers will select an ASBR advertising E1, even if they are closer to an ASBR advertising E2.
The routing tables clearly show the preference for E1 routes, demonstrating OSPF’s route selection hierarchy: Intra-area > Inter-area > E1 > E2.
Sources:
omnetpp.ini,
OSPF_Area_External.ned,
ASConfig_Area_ExternalRoute_Mixed_Dest.xml
Discussion¶
Use this page in the GitHub issue tracker for commenting on this tutorial.