Router

 

This document gives a brief overview of the Router device configured in the device tree of the Network Designer. The devices support SNMP and TFTP .

 



 

Router Configuration

 

In this sample, the IP router with the following network configuration is simulated. As shown in the diagram, the Router has four interfaces. One local loop back interface and three network interfaces. According to this sample, the network interface with IP address 192.168.1.133 belongs to the users network where the simulated agent is running. The router agent implements the RFC 1213 MIB.

 

 

The configuration of the IP Router is given in the table below :

 

IP of the Interface Interface If Index Value Interface Type Network Connected

192.168.60.133

1

Network Interface

Connects the network 192.168.60.0 (netmask 255.255.255.0)

192.168.65.133

2

Network Interface

Connects the network 192.168.65.0 (netmask 255.255.255.0)

192.168.1.133

3

Network Interface

Connects the network 192.168.1.0 (netmask 255.255.255.0)

127.0.0.1

4

Local LoopBack Interface

 

 

To view the MIB values configured,  select  SNMP Agent Values option from the right-click menu of the device in the device tree.

 

Scripts Configured

 

The real time behavior of the sample router is defined by configuring Jython scripts and traps. The following table explains the router behavior and how it is achieved using scripts.  the router configuration and script files are available in <Simulator_Home>/examples/IpRouter directory.

 

To learn about the steps involved in defining your own scripts, refer to the topic Configuring Network Behavior.

 

Behavior of the Sample Router How this Behavior is Achieved Using Jython Scripts
  1. For every GET request made under icmp group of the RFC 1213 MIB,

  2. The value of the following nodes will be incremented by one:

    • udpInDatagrams

    • snmpInPkts

    • snmpInTotalReqVars

    • snmpInGetRequests

    • snmpOutPkts

    • snmpOutGetResponses

    • snmpOutTraps

    • udpOutDatagrams

  3. A Trap will be sent to the manager running at localhost,port 9000 with the icmpInMsgs as Varbind.

  1. Every 10th get request is considered as an erroneous request with BadVersion, Bad Community Name, Bad Community Uses, ASNParse Errors. The type of error is selected in random and the value of the node is incremented accordingly. No response will be received for this get request. A General Error will be thrown.

  1. TooBig Error Simulation: For every fifth get request on the icmpInMsgs Node, a TooBig error response will be thrown and the value of snmpOutTooBigs will be incremented by one.

  2. NoSuchName Error Simulation: For every fifth get request on the icmpInErrors Node, a NoSuchName error response will be thrown and the value of snmpOutNoSuchNames will be incremented by one

  3. BadValue Error Simulation : For every fifth get request on the icmpInDestUnreachs Node, a BadValue error response will be thrown and the value of snmpOutBadValue will be incremented by one .

  4. General Error Simulation: For every fifth get request on the icmpInTimeExcds Node, a General Error response will be thrown and the value of snmpOutGeneral Errors will be incremented by one.

Script Files configured

  1. get.py

  2. get_BadValue.py

  3. get_GeneralErrors.py

  4. get_NoSuchNames.py

  5. get_TooBig.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed when an SNMP Get Request is made under icmp group of the RFC 1213 MIB

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

 

  1. For every GET-NEXT request made under egp group of the RFC 1213 MIB,

  2. the value of the following nodes will be incremented by one:

    • udpInDatagrams

    • snmpInPkts

    • snmpInTotalReqVars

    • snmpInGetNexts

    • snmpOutPkts

    • snmpOutGetResponses

    • snmpOutTraps

    • udpOutDatagrams

  3. A trap will be sent to the manager running at localhost, port 9000 with the egpInMsgs as Varbind.

  1. Every 10th getnext request is considered as an erroneous request with BadVersion, Bad Community Name, Bad Community Uses, ASNParse Errors. The type of error is selected in random and the value of the node is incremented accordingly. No response will be received for this getnext request. A General Error will be thrown.

  1. TooBig Error Simulation: For every fifth get request on the egpInMsgs Node, a TooBig error response will be thrown and the value of snmpOutTooBigs will be incremented by one.

  2. NoSuchName Error Simulation: For every fifth get request on the egpInErrors Node, a NoSuchName error response will be thrown and the value of snmpOutNoSuchNames will be incremented by one.

  3. BadValue Error Simulation: For every fifth get request on the egpOutMsgs Node, a BadValue error response will be thrown and the value of snmpOutBadValue will be incremented by one.

  4. General Error Simulation: For every fifth GET request on the egpOutErrors, a General Error error response will be thrown and the value of snmpOutGeneral Errors will be incremented by one.

Script Files configured

  1. getnext.py

  2. getnext_BadValue.py

  3. getnext_GeneralErrors.py

  4. getnext_NoSuchNames.py

  5. getnext_TooBig.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed when an SNMP GET-NEXT request is made under egp group of the RFC 1213 MIB

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

  1. For every SET request made under ipRoutTable of the RFC 1213 MIB,

  2. the value of the following nodes will be incremented by one

    • udpInDatagrams

    • snmpInPkts

    • snmpInTotalSetVars

    • snmpInSetRequests

    • snmpOutPkts

    • snmpOutGetResponses

    • snmpOutTraps

    • udpOutDatagrams

  3. A trap will be sent to the Manager running at localhost, port 9000 with the ipRouteDestination values as Varbind.

  1. Every 10th set request is considered as an erroneous request with BadVersion, Bad Community Name, Bad Community Uses, ASNParse Errors. The type of error is selected in random and the value of the node is incremented accordingly. No response will be received for this set request. A General Error will be thrown .

  1. TooBig Error Simulation:For every fifth get request on the ipRouteMetric2 Node, a TooBig error response will be thrown and the value of snmpOutTooBigs will be incremented by one

  2. NoSuchName Error Simulation: For every fifth get request on the ipRouteMetric3 Node, a NoSuchName error response will be thrown and the value of snmpOutNoSuchNames will be incremented by one

  3. BadValue Error Simulation: For every fifth get request on the ipRouteMetric4 Node, a BadValue error response will be thrown and the value of snmpOutBadValue will be incremented by one

  4. General Error Simulation: For every fifth get request on the ipRouteMetric5 Node, a General Error error response will be thrown and the value of snmpOutGeneral Errors will be incremented by one.

Script Files configured

  1. set.py

  2. set_BadValue.py

  3. set_GeneralErrors.py

  4. set_NoSuchNames.py

  5. set_TooBig.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed when an SNMP SET request is made under ipRoutTable of the RFC 1213 MIB.

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

For a router device whose ipForwarding is set to forwarding (1),

  • Returns 'bad value' response if the manager attempts to change its value.

Script Files configured

  • ipForwarding.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed when an SNMP SET request is made on ipForwarding of the RFC 1213 MIB.

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

When a SNMP Set Request is made on ifAdminStatus of an interface in the router network with value down(2), 

  1. Updates the value of ifOperStatus of that specific interface with ifAdmin status value.

  2. Invalidates the specific route in the router device, by setting the ipRouteType to invalid(2).

  3. Sends a trap to the manager running at localhost, port 9000 with ifOperStatus and ipRouteType as varbinds with agent values.

Script File configured

  • ifAdminStatus.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed, when a SNMP Set Request is made on ifAdminStatus of the RFC 1213 MIB with the required instance.

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

When a SNMP Set Request is made on ifAdminStatus of an interface in the router network with value up(1), 

  1. Updates the value of ifOperStatus of that specific interface with ifAdmin status value.

  2.  Validates the specific route in the router device, by setting the ipRouteType to direct(3).

  3. Sends a trap to the manager running at localhost, port 9000 with ifOperStatus and ipRouteType as varbinds with agent values.

Script File configured

  • ifAdminStatus.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed, when a SNMP Set Request is made on ifAdminStatus of the RFC 1213 MIB.

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

 If a Get is made on the System group, for any of the nodes in the router network,

  1. Check the ipRoutType in the iprouteTable of the network interface :  (if  valid or invalid),

  2. If ipRoutType is invalid, 

  3. The ipOutNoRoutes will be incremented by one.

  4. The icmpInDestUnreachs of the icmp group will be incremented by one.

  5. The router sends a trap to the manager running at localhost, port 9000 with  ICMP destination unreachable (icmpInDestUnreachs of the icmp group) messages as varbinds

Script File configured

  • system.py

The following conditions and actions are defined in the script :

 

Condition to execute the script

 

The script will be executed, when a GET Request is made on the System group of the RFC 1213 MIB .

 

Actions to be performed when the script is executed

 

The actions specified in Column 1 are configured to be performed when the above condition is satisfied.

 

To view the scripts configured, select  SNMP Behavior option from the right-click menu of the device in the device tree. To create a network with the Router device, refer to section, Creating and Configuring a Network.

 

Using the Router Simulation