Warning: preg_match(): Delimiter must not be alphanumeric, backslash, or NUL in /var/www/html/activities/books/networking/labbook/ch/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/ch/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/ch/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/ch/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/ch/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/ch/emulab/exp18.2.php on line 8

 

 


Douglas E. Comer


Computer Science Department
Purdue University
West Lafayette, IN 47907

webmaster: W. David Laverell


Companion Topics

Home

Book Information

Purpose of Site

Getting Started

Students

Faculty

"What's New"

"Coming Attractions"

"C Pointers"

Acknowledgements

 

 
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.



This site is maintained by W. David Laverell of the Computer Science Department at Calvin College. For assistance or corrections, please contact him at lave@calvin.edu.