Static routing in NetSim

Static Routing

How to Setup Static Routes in RIP and OSPF

Step1 : In inter-networks, Static Routes can be set for any scenario having a minimum of 3 routers, 2 switches and 3 wired nodes. The easiest way to do this is to first run the scenario with routing protocol set as RIP/OSPF and save the Configuration file

Step 2 : Open the Configuration file with Visual studio. Expand the Router configuration and set the Static Routing information in Application Layer property of the device, by enabling the Static routing status. Then set the appropriate Static routing file name and file path.
RIP
By default:





Change to:





OSPF
By default:





Change to:





Note:
1. Update this information in any one of the router
2. A sample StaticRouting.txt file will be available inside “C:\Program Files\NetSim standard\Docs\Sample_Configuration\Internetworks”. Appropriately modify it for the scenario.
The StaticRouting.txt file contains
1. Device Id of the Router
2. List of entries to add in the routing table
DEVICE_ID:1
ip route 192.168.0.0 255.255.255.0 192.168.0.1 [1]
ip route 192.168.1.0 255.255.255.0 192.168.1.1 [1]
DEVICE_ID:2
ip route 192.168.2.0 255.255.255.0 192.168.2.1 [1]
ip route 192.168.3.0 255.255.255.0 192.168.3.1 [1]

The above format is per standard Cisco command for static routes
ip route dest_ip mask gateway_ip [distance ]

1. The ip route is the Cisco command to add the static route
2. The dest_ip is the Network address for the destination network
3. The mask is the Subnet mask for the destination network
4. The gateway_ip is the IP address of the next-hop router
5. The distance is the administrative distance for the route. The default is 1 .

Step 3 : After this, run this configuration file through CLI and static routes will be used for routing.

How to fail a node in NetSim

In this section we explain node failure using MANET-DSR as an example

Using Device Id, Identify the Device ID of the particular device.

The fn_NetSim_DSR_Run( ) is the main function to handle all the protocol functionalities

DSR_Run( )

strcpy(pszFilepath,pszIOPath);
strcat(pszFilepath,”/Output.txt”);
fp = fopen(pszFilepath,”r”);
i=0;
if(fp)
{
while(fgets(pszConfigInput,500,fp)!= NULL)
{
sscanf(pszConfigInput,”%d %d”,&NodeArray[i],&TimeArray[i]);
i+=1;
}
}

for(i=0;i<100;i++) if((pstruEventDetails->nDeviceId == NodeArray[i])&&(pstruEventDetails->dEventTime >= TimeArray[i]))
// Node failure happens after a value of time storted in an array
{ // This just returns instead of running DSR functionality when the node is failed
pstruEventDetails->nInterfaceId = 0;
return 0;
}

Note: Add the above lines of code after the variable declarations in the function
Build the .dll by clicking Build ->Build Solution. (The dll will be created inside the Visual studio project->Debug)