Ipv4RoutingTable

Package: inet.networklayer.ipv4

simple module Ipv4RoutingTable

Stores the routing table. (Per-interface configuration is stored in InterfaceTable.)

For hosts, the routerId module parameter should be empty (“”), in which case the loopback IPv4 address will be set to 127.0.0.1/8. For routers which have a routerId set, the loopback address will be set to routerId. (See also RFC 2072 “Router Renumbering Guide”.)

RouterId may also be set to the string "auto", in which case the highest interface address will be chosen as routerId; the loopback address will remain 127.0.0.1/8.

The routing table is read from a file (parameter routingFile); the file can also fill in or overwrite interface settings. The file format is documented here.

Note that many protocols don’t require routerId to be routable, but some others do – so it is probably a good idea to set up routable routerIds.

This module has no gates; all functionality can be accessed via member functions of the C++ module class. For detailed info, please see the C++ documentation of the class (Doxygen).

See also: InterfaceTable

Author:: Jochen Reber

inet.networklayer.ipv4.Ipv4RoutingTableIpv4RoutingTablesimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

ExtUpperIpv4NetworkLayer

compound module

Provides a network layer that connects the simulation to a real network on the host computer using a TUN device. Allows simulated applications to send and receive packets through the host’s networking stack at the IP layer. Contains standard components like routing table and ARP, and uses ExtUpperIpv4 with a TUN device for external connectivity.

Ipv4NetworkLayer

compound module

Network layer of an IPv4 node.

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“{routingTableStatusText}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

interfaceTableModule

string

The path to the InterfaceTable module

routerId

string

“auto”

For routers, the router id using IPv4 address dotted

netmaskRoutes

string

“*”

Maintain netmask routes for interfaces

forwarding

bool

true

Turns IP forwarding on/off

multicastForwarding

bool

false

Turns multicast forwarding on/off

useAdminDist

bool

false

Use Cisco-like administrative distances

routingFile

string

“”

Routing table file name

Properties

Name

Value

Description

class

Ipv4RoutingTable

display

i=block/table

Signals

Name

Type

Unit

Description

mrouteAdded

inet::Ipv4MulticastRoute

mrouteChanged

inet::Ipv4MulticastRoute

mrouteDeleted

inet::Ipv4MulticastRoute

routeAdded

inet::Ipv4Route

routeChanged

inet::Ipv4Route

routeDeleted

inet::Ipv4Route

Source code

//
// Stores the routing table. (Per-interface configuration is stored in
// ~InterfaceTable.)
//
// For hosts, the `routerId` module parameter should be empty (""),
// in which case the loopback IPv4 address will be set to 127.0.0.1/8.
// For routers which have a `routerId` set, the loopback address will be set to
// `routerId`. (See also RFC 2072 "Router Renumbering Guide".)
//
// `RouterId` may also be set to the string `"auto"`, in which case the
// highest interface address will be chosen as `routerId`; the loopback address
// will remain 127.0.0.1/8.
//
// The routing table is read from a file (parameter `routingFile`);
// the file can also fill in or overwrite interface settings.
// The file format is documented <a href="irt.html">here</a>.
//
// Note that many protocols don't require `routerId` to be routable, but some
// others do -- so it is probably a good idea to set up routable `routerIds`.
//
// This module has no gates; all functionality can be accessed via member
// functions of the C++ module class. For detailed info, please see the C++
// documentation of the class (Doxygen).
//
// @see ~InterfaceTable
// @author: Jochen Reber
//
simple Ipv4RoutingTable extends SimpleModule like IRoutingTable
{
    parameters:
        @class(Ipv4RoutingTable);
        string interfaceTableModule;   // The path to the InterfaceTable module
        string routerId = default("auto"); // For routers, the router id using IPv4 address dotted
                          // notation; specify "auto" to select the highest
                          // interface address; should be left empty ("") for hosts
        string netmaskRoutes = default("*"); // Maintain netmask routes for interfaces
        bool forwarding = default(true);  // Turns IP forwarding on/off
        bool multicastForwarding = default(false); // Turns multicast forwarding on/off
        bool useAdminDist = default(false);     // Use Cisco-like administrative distances
        string routingFile = default("");  // Routing table file name
        displayStringTextFormat = default("{routingTableStatusText}");
        @display("i=block/table");
        @signal[routeAdded](type=inet::Ipv4Route);
        @signal[routeDeleted](type=inet::Ipv4Route);
        @signal[routeChanged](type=inet::Ipv4Route);
        @signal[mrouteAdded](type=inet::Ipv4MulticastRoute);
        @signal[mrouteDeleted](type=inet::Ipv4MulticastRoute);
        @signal[mrouteChanged](type=inet::Ipv4MulticastRoute);
}

File: src/inet/networklayer/ipv4/Ipv4RoutingTable.ned