The IP routing files
Routing files are files with .irt or .mrt extension, and their names are passed in the routingFileName parameter to IPv4RoutingTable modules. RoutingTables are present in all IP nodes (hosts and routers).
Routing files may contain network interface configuration and static routes. Both are optional. Network interface entries in the file configure existing interfaces; static routes are added to the route table.
Interfaces themselves are represented in the simulation by modules (such as the PPP module). Modules automatically register themselves with appropriate defaults in the IPv4RoutingTable, and entries in the routing file refine (overwrite) these settings. Interfaces are identified by names (e.g. ppp0, ppp1, eth0) which are normally derived from the module's name: a module called "ppp[2]" in the NED file registers itself as interface ppp2.
An example routing file (copied here from one of the example simulations):
ifconfig: # ethernet card 0 to router name: eth0 inet_addr: 172.0.0.3 MTU: 1500 Metric: 1 BROADCAST MULTICAST Groups: 225.0.0.1:225.0.1.2:225.0.2.1 # Point to Point link 1 to Host 1 name: ppp0 inet_addr: 172.0.0.4 MTU: 576 Metric: 1 ifconfigend. route: 172.0.0.2 * 255.255.255.255 H 0 ppp0 172.0.0.4 * 255.255.255.255 H 0 ppp0 default: 10.0.0.13 0.0.0.0 G 0 eth0 225.0.0.1 * 255.255.255.255 H 0 ppp0 225.0.1.2 * 255.255.255.255 H 0 ppp0 225.0.2.1 * 255.255.255.255 H 0 ppp0 225.0.0.0 10.0.0.13 255.0.0.0 G 0 eth0 routeend.
The ifconfig...ifconfigend. part configures interfaces, and route..routeend. part contains static routes. The format of these sections roughly corresponds to the output of the ifconfig and netstat -rn Unix commands.
An interface entry begins with a name: field, and lasts until the next name: (or until ifconfigend.). It may be broken into several lines.
Accepted interface fields are:
- name: - arbitrary interface name (e.g. eth0, ppp0)
- inet_addr: - IP address
- Mask: - netmask
- Groups: Multicast groups. 224.0.0.1 is added automatically, and 224.0.0.2 also if the node is a router (forwarding==true).
- MTU: - MTU on the link (e.g. Ethernet: 1500)
- Metric: - integer route metric
- flags: BROADCAST, MULTICAST, POINTTOPOINT
The following fields are parsed but ignored: Bcast,encap, HWaddr.
Interface modules set a good default for MTU, Metric (as 2e9/bitrate) and flags, but leave inet_addr and Mask empty. inet_addr and mask should be set either from the routing file or by a dynamic network configuration module.
The route fields are:
Destination Gateway Netmask Flags Metric Interface
Destination, Gateway and Netmask have the usual meaning. The Destination field should either be an IP address or "default:" (to designate the default route). For Gateway, * is also accepted with the meaning 0.0.0.0.
Flags denotes route type:
- H "host": direct route (directly attached to the router), and
- G "gateway": remote route (reached through another router)
Interface is the interface name, e.g. eth0.