Table Of Contents
Table Of Contents

Internet Routing


INET Framework has models for several internet routing protocols, including RIP, OSPF and BGP.

The easiest way to add routing to a network is to use the Router NED type for routers. Router contains a conditional instance for each of the above protocols. These submodules can be enabled by setting the hasRip, hasOspf and/or hasBgp parameters to true.


**.hasRip = true

There are also NED types called RipRouter, OspfRouter, BgpRouter, which are all Router’s with appropriate routing protocol enabled.


RIP (Routing Information Protocol) is a distance-vector routing protocol which employs the hop count as a routing metric. RIP prevents routing loops by implementing a limit on the number of hops allowed in a path from source to destination. RIP uses the split horizon with poison reverse technique to work around the “count-to-infinity” problem.

The Rip module implements distance vector routing as specified in RFC 2453 (RIPv2) and RFC 2080 (RIPng). The behavior can be selected by setting the mode parameter to either "RIPv2" or "RIPng". Protocol configuration such as link metrics and per-interface operation mode (such as whether RIP is enabled on the interface, and whether to use split horizon) can be specified in XML using the ripConfig parameter.

The following example configures a Router module to use RIPv2:

**.hasRip = true
**.mode = "RIPv2"
**.ripConfig = xmldoc("RIPConfig.xml")

The configuration file specifies the per interface parameters. Each <interface> element configures one or more interfaces; the hosts, names, towards, among attributes select the configured interfaces (in a similar way as with Ipv4NetworkConfigurator). See the Network Autoconfiguration chapter for further information.

Additional attributes:

  • metric: metric assigned to the link, default value is 1. This value is added to the metric of a learned route, received on this interface. It must be an integer in the [1,15] interval.

  • mode: mode of the interface.

The mode attribute can be one of the following:

  • NoRIP: no RIP messages are sent or received on this interface.

  • NoSplitHorizon: no split horizon filtering; send all routes to neighbors.

  • SplitHorizon: do not sent routes whose next hop is the neighbor.

  • SplitHorizonPoisenedReverse (default): if the next hop is the neighbor, then set the metric of the route to infinity.

The following example sets the link metric between router R1 and RB to 2, while all other links will have a metric of 1.

  <interface among="R1 RB" metric="2"/>
  <interface among="R? R?" metric="1"/>


OSPF (Open Shortest Path First) is a routing protocol for IP networks. It uses a link state routing (LSR) algorithm and falls into the group of interior gateway protocols (IGPs), operating within a single autonomous system (AS).

OspfRouter is a Router with the OSPF protocol enabled.

The Ospfv2 module implements OSPF protocol version 2. Areas and routers can be configured using an XML file specified by the ospfConfig parameter. Various parameters for the network interfaces can be specified also in the XML file or as a parameter of the Ospfv2 module.

**.ospf.ospfConfig = xmldoc("ASConfig.xml")
**.ospf.helloInterval = 12s
**.ospf.retransmissionInterval = 6s

The <OSPFASConfig> root element may contain <Area> and <Router> elements with various attributes specifying the parameters for the network interfaces. Most importantly <Area> contains <AddressRange> elements enumerating the network addresses that should be advertized by the protocol. Also <Router> elements may contain data for configuring various pont-to-point or broadcast interfaces.

<?xml version="1.0"?>
<OSPFASConfig xmlns:xsi="" xsi:schemaLocation="OSPF.xsd">
  <!-- Areas -->
  <Area id="">
    <AddressRange address="H1" mask="H1" status="Advertise" />
    <AddressRange address="H2" mask="H2" status="Advertise" />
    <AddressRange address="R1>R2" mask="R1>R2" status="Advertise" />
    <AddressRange address="R2>R1" mask="R2>R1" status="Advertise" />
  <!-- Routers -->
  <Router name="R1" RFC1583Compatible="true">
    <BroadcastInterface ifName="eth0" areaID="" interfaceOutputCost="1" routerPriority="1" />
    <PointToPointInterface ifName="eth1" areaID="" interfaceOutputCost="2" />
  <Router name="R2" RFC1583Compatible="true">
    <PointToPointInterface ifName="eth0" areaID="" interfaceOutputCost="2" />
    <BroadcastInterface ifName="eth1" areaID="" interfaceOutputCost="1" routerPriority="2" />


BGP (Border Gateway Protocol) is a standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet.

BgpRouter is a Router with the BGP protocol enabled.

The Bgp module implements BGP Version 4. The model implements RFC 4271, with some limitations. Autonomous Systems and rules can be configured in an XML file that can be specified in the bgpConfig parameter.

**.bgpConfig = xmldoc("BGPConfig.xml")

The configuration file may contain <TimerParams>, <AS> and Session elements at the top level.

  • <TimerParams>: allows specifying various timing parameters for the routers.

  • <AS>: defines Autonomous Systems, routers and rules to be applied.

  • <Session>: specifies open sessions between edge routers. It must contain exactly two <Router exterAddr="x.x.x.x"/> elements.

<BGPConfig xmlns:xsi=""

    <connectRetryTime> 120 </connectRetryTime>
    <holdTime> 180 </holdTime>
    <keepAliveTime> 60 </keepAliveTime>
    <startDelay> 15 </startDelay>

  <AS id="60111">
    <Router interAddr=""/> <!--Router A1-->
    <Router interAddr=""/> <!--Router A2-->

  <AS id="60222">
    <Router interAddr=""/> <!--Router B-->

  <AS id="60333">
    <Router interAddr=""/> <!--Router C1-->
    <Router interAddr=""/> <!--Router C2-->
    <Router interAddr=""/> <!--Router C3-->
    <Router interAddr=""/> <!--Router C4-->
    <DenyRouteOUT Address="" Netmask=""/>
    <DenyASOUT> 60111 </DenyASOUT>

  <Session id="1">
    <Router exterAddr="" > </Router> <!--Router A1-->
    <Router exterAddr="" > </Router> <!--Router C1-->

  <Session id="2">
    <Router exterAddr="" > </Router> <!--Router A2-->
    <Router exterAddr="" > </Router> <!--Router B-->

  <Session id="3">
    <Router exterAddr="" > </Router> <!--Router B-->
    <Router exterAddr="" > </Router> <!--Router C2-->

Inside <AS> elements various rules can be sepecified:

  • DenyRoute: deny route in IN and OUT traffic (Address and Netmask attributes must be specified.)

  • DenyRouteIN : deny route in IN traffic (Address and Netmask attributes must be specified.)

  • DenyRouteOUT: deny route in OUT traffic (Address and Netmask attributes must be specified.)

  • DenyAS: deny routes learned by AS in IN and OUT traffic (AS id must be specified as the body of the element.)

  • DenyASIN : deny routes learned by AS in IN traffic (AS id must be specified as the body of the element.)

  • DenyASOUT: deny routes learned by AS in OUT traffic (AS id must be specified as the body of the element.)

Table Of Contents