Step 17. Loop avoidance in multi-area OSPF topology¶
Goals¶
The goal of this step is to demonstrate how OSPF prevents routing loops in multi-area topologies.
In multi-area OSPF, there is a risk of routing loops if areas are not properly connected to the backbone (Area 0). OSPF has a rule that inter-area routes (learned via Summary LSAs) are only accepted from the backbone area. This ensures a hierarchical topology and prevents loops.
If an area is not directly connected to the backbone, it must use a virtual link to logically connect to Area 0.
Configuration¶
This step uses the OSPF_LoopAvoidance network with a topology that could
create loops if not properly configured.
The configuration in omnetpp.ini is the following:
[Config Step17]
description = "Loop avoidance in multi-area OSPF topology"
network = OSPF_LoopAvoidance
*.configurator.config = xml("<config> \
<interface hosts='R1' names='eth0' address='10.0.0.9' netmask='255.255.255.252' /> \
<interface hosts='R1' towards='R2' address='10.0.0.5' netmask='255.255.255.252' /> \
<interface hosts='R1' towards='R5' address='10.0.0.1' netmask='255.255.255.252' /> \
\
<interface hosts='R2' names='eth1' address='10.0.0.21' netmask='255.255.255.252' /> \
<interface hosts='R2' towards='R1' address='10.0.0.6' netmask='255.255.255.252' /> \
<interface hosts='R2' towards='R3' address='10.0.0.13' netmask='255.255.255.252' /> \
<interface hosts='R2' towards='R4' address='10.0.0.17' netmask='255.255.255.252' /> \
\
<interface hosts='R3' names='eth3' address='10.0.0.33' netmask='255.255.255.252' /> \
<interface hosts='R3' names='eth4' address='10.0.0.37' netmask='255.255.255.252' /> \
<interface hosts='R3' towards='R2' address='10.0.0.14' netmask='255.255.255.252' /> \
<interface hosts='R3' towards='R5' address='10.0.0.29' netmask='255.255.255.252' /> \
<interface hosts='R3' towards='R4' address='10.0.0.25' netmask='255.255.255.252' /> \
\
<interface hosts='R4' names='eth2' address='10.0.0.41' netmask='255.255.255.252' /> \
<interface hosts='R4' towards='R2' address='10.0.0.18' netmask='255.255.255.252' /> \
<interface hosts='R4' towards='R3' address='10.0.0.26' netmask='255.255.255.252' /> \
\
<interface hosts='R5' names='eth0' address='10.0.0.45' netmask='255.255.255.252' /> \
<interface hosts='R5' towards='R1' address='10.0.0.2' netmask='255.255.255.252' /> \
<interface hosts='R5' towards='R3' address='10.0.0.30' netmask='255.255.255.252' /> \
\
<route hosts='host*' destination='*' netmask='0.0.0.0' interface='eth0' /> \
</config>")
*.R*.ospf.ospfConfig = xmldoc("ASConfig_Area_Loop.xml")
# application parameters
*.R5.numApps = 1
*.R5.app[0].typename = "PingApp"
*.R5.app[0].destAddr = "R2"
*.R5.app[0].startTime = 60s
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="R1>R2" mask="R1>R2" />
<AddressRange address="R2>R1" mask="R2>R1" />
</Area>
<Area id="0.0.0.1">
<AddressRange address="R1>R5" mask="R1>R5" />
<AddressRange address="R1>switch1" mask="R1>switch1" />
<AddressRange address="R5>R1" mask="R5>R1" />
<AddressRange address="R5>R3" mask="R5>R3" />
<AddressRange address="R5>switch5" mask="R5>switch5" />
<AddressRange address="R3>R5" mask="R3>R5" />
<AddressRange address="R3>switch3" mask="R3>switch3" />
</Area>
<Area id="0.0.0.2">
<AddressRange address="R2>switch2" mask="R2>switch2" />
<AddressRange address="R2>R4" mask="R2>R4" />
<AddressRange address="R2>R3" mask="R2>R3" />
<AddressRange address="R4>switch4" mask="R4>switch4" />
<AddressRange address="R4>R2" mask="R4>R2" />
<AddressRange address="R4>R3" mask="R4>R3" />
<AddressRange address="R3>R2" mask="R3>R2" />
<AddressRange address="R3>R4" mask="R3>R4" />
<AddressRange address="R3>switch6" mask="R3>switch6" />
</Area>
<!-- Routers -->
<Router name="R1" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.1" interfaceMode="Passive" />
<BroadcastInterface ifName="eth1" areaID="0.0.0.1" />
<BroadcastInterface ifName="eth2" areaID="0.0.0.0" />
</Router>
<Router name="R2" RFC1583Compatible="true">
<BroadcastInterface ifName="eth1" areaID="0.0.0.2" interfaceMode="Passive" />
<BroadcastInterface ifName="eth0" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth2" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth3" areaID="0.0.0.0" />
</Router>
<Router name="R3" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth1" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth2" areaID="0.0.0.1" />
<BroadcastInterface ifName="eth3" areaID="0.0.0.1" interfaceMode="Passive" />
<BroadcastInterface ifName="eth4" areaID="0.0.0.2" interfaceMode="Passive" />
</Router>
<Router name="R4" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth1" areaID="0.0.0.2" />
<BroadcastInterface ifName="eth2" areaID="0.0.0.2" interfaceMode="Passive" />
</Router>
<Router name="R5" RFC1583Compatible="true">
<BroadcastInterface ifName="eth0" areaID="0.0.0.1" interfaceMode="Passive" />
<BroadcastInterface ifName="eth1" areaID="0.0.0.1" />
<BroadcastInterface ifName="eth2" areaID="0.0.0.1" />
</Router>
</OSPFASConfig>
Results¶
The configuration demonstrates potential loop scenarios:
Areas are configured in a way that could create routing loops.
OSPF’s loop prevention mechanisms ensure that:
Summary LSAs from non-backbone areas are ignored by ABRs
Only Summary LSAs received via the backbone are accepted for inter-area routing
If the topology violates OSPF’s hierarchical requirements (non-backbone area not connected to Area 0), routing may be suboptimal or certain networks may be unreachable.
The routing tables show how OSPF enforces the hierarchical structure to prevent loops.
This demonstrates the importance of proper area design and the backbone’s central role in OSPF multi-area networks.
Sources:
omnetpp.ini,
OSPF_LoopAvoidance.ned,
ASConfig_Area_Loop.xml
Discussion¶
Use this page in the GitHub issue tracker for commenting on this tutorial.