Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 2

Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 2

Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 3

Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 4

Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 5

Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 8

Warning: include(net.top.html): Failed to open stream: No such file or directory in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 12

Warning: include(): Failed opening 'net.top.html' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 12
Hands-On Networking: Experiment 18.2 (An Emulab Approach) Home > Student > Experiments > Emulab > 18.2

Chapter 18: Experiment 18.2 - Install And Configure A NAT Box

The following script is intended to be a simple illustration of the possibilities. It simply sets up three machines in a straight line. On our Emulab FC4-STD is required because our FreeBSD image does not have iptables.

  
set ns [new Simulator]
source tb_compat.tcl

set server [$ns node]
tb-set-node-os $server FC4-STD
set client1 [$ns node]
tb-set-node-os $client1 FC4-STD
set client2 [$ns node]
tb-set-node-os $client2 FC4-STD

set link0 [$ns duplex-link $server $client1 100Mb 0ms DropTail]
set link1 [$ns duplex-link $server $client2 100Mb 0ms DropTail]

$ns rtproto Static
$ns run

You now ssh to both client1 and server. On client1, ssh to server and type hostname. You should see the obvious, server. Now on server type iptables -t nat -A PREROUTING -p tcp -d 10.1.1.2 --dport 22 -j DNAT --to 10.1.2.3. The effect will be that an ssh request coming in on that port on the server will be forwarded to client2. Now type hostname and you will see client2. Interesting, and of course the additional possibilities are endless.
Warning: include(net.bottom.html): Failed to open stream: No such file or directory in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 54

Warning: include(): Failed opening 'net.bottom.html' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/activities/books/networking/labbook/exp/emulab/exp18.2.php on line 54