Routing Experiment

The following script builds a simple network of three nodes connected in a straight line. Notice that the statement rtproto Static, which is part of every script I have ever written, is commented out. This means that there will be no routing set up automatically. Nodes can talk to each other using their absolute identifications (eg, through the control network, but node0 will be able to ping node1 but not node2.

#generated by Netbuild 1.03
set ns [new Simulator]
source tb_compat.tcl

set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]

tb-set-node-os $node0 FC4-STD
tb-set-node-os $node1 FC4-STD
tb-set-node-os $node2 FC4-STD

set link0 [$ns duplex-link $node0 $node1 100Mb 0ms DropTail]
set link1 [$ns duplex-link $node1 $node2 100Mb 0ms DropTail]

#$ns rtproto Static
$ns run
#netbuild-generated ns file ends.

Three things need to happen for node0 to be able to ping node2:

  1. node0 needs a route to node2.

  2. node2 needs a route to node0.

  3. node1 needs to do IP forwarding.

The first two are not so bad. See 18.3 for the FC4 syntax to add a route. The third is easy as well. On node1 just type sudo echo 1 > /proc/sys/net/ipv4/ip_forward. Then ping away.