Table Of Contents
Table Of Contents

Step 18. AS-External LSAs of ‘type 1 metric’ with different advertised destination

Goals

The goal of this step is to demonstrate AS-External LSAs (Type-5 LSAs) with Type-1 metrics.

OSPF routers can advertise routes to destinations outside the OSPF domain using AS-External LSAs. These external routes can use two metric types:

  • Type-1 (E1): The metric is the sum of the external cost plus the internal OSPF cost to reach the ASBR (Autonomous System Boundary Router). This allows OSPF to select the closest exit point.

  • Type-2 (E2): The metric is only the external cost; internal cost is ignored. Type-2 is the default.

This step demonstrates Type-1 metrics with different external destinations.

Configuration

This step uses the OSPF_Area_External network with ASBRs advertising external routes.

../../../_images/OSPF_Area_External.png

The configuration in omnetpp.ini is the following:

[Config Step18]
description = "AS-External LSAs of 'type 1 metric' with different advertised destination"
network = OSPF_Area_External

# ToDo: R5 has a cost of 13 to the external network

*.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='N2.*' address='192.168.10.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>")

*.R*.ospf.ospfConfig = xmldoc("ASConfig_Area_ExternalRoute_Type1.xml")

# application parameters
*.host*.numApps = 1
*.host*.app[0].typename = "UdpBasicApp"
*.host*.app[0].destAddresses = "N1.host[0]"
*.host*.app[0].destPort = 5000
*.host*.app[0].messageLength = 1024B
*.host*.app[0].sendInterval = 1s
*.host*.app[0].startTime = 10s
*.host*.app[0].stopTime = 100s

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="R3>N1" advertisedExternalNetworkMask="R3>N1" 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="N2" advertisedExternalNetworkAddress="R5>N2" advertisedExternalNetworkMask="R5>N2" externalInterfaceOutputCost="5" externalInterfaceOutputType="Type1" />
  </Router>

</OSPFASConfig>

Results

With Type-1 external routes:

  1. ASBRs (e.g., R3, R5) generate AS-External LSAs for external networks.

  2. The LSAs specify Type-1 metric (E1).

  3. When routers calculate routes to these external destinations, they use: Total Cost = External Cost + Internal Cost to ASBR

  4. Routers select the ASBR with the lowest total cost. This may result in choosing a closer ASBR even if it advertises a higher external cost, as long as the total cost remains lower.

  5. Different routers may choose different ASBRs for the same destination based on their location in the topology.

Type-1 metrics are useful when the external cost is comparable to internal OSPF costs and you want traffic to exit the AS at the nearest point.

Sources: omnetpp.ini, OSPF_Area_External.ned, ASConfig_Area_ExternalRoute_Type1.xml

Discussion

Use this page in the GitHub issue tracker for commenting on this tutorial.