NetServ tutorial: step-by-step instruction


  1. Start the provided VM and login as the geni user.
  1. Open the tutorial slides found at:


Go to slide number 7 and leave it there for reference.

  1. Open Firefox and point it to the following URL:

Please note that you must replace "50" with your own user number throughout this tutorial.

  1. You will see the traffic visualization in your browser as follows:

Install NetServ module

  1. Open a terminal window, update NetServ software, and go to your NetServ user directory.
cd /netserv-root
svn up

cd tutorial/user50
ls -l
  1. The following files have been prepared for each user:


  1. Build the Example module and upload it to the NetServ repository.
  1. Send a SETUP message to the NetServ router to install the module.

While you are watching the browser window type the following command into the terminal window.

./ 1

The traffic will be redirected to D2 (the node on the lower right) and NetServ.Example will be added to the list of NetServ modules currently installed.

  1. The SETUP message looks like this:
$ cat setup-request-1.txt 
SETUP NetServ.Example_1.0.0 NETSERV/0.1
user: user50
ttl:  600
filter-proto: udp
filter-port: 20050
properties: debug = false, ip =

  1. Send a REMOVE message to the NetServ router to remove the module.
  1. The REMOVE message looks like this:
$ cat remove-request.txt 
REMOVE NetServ.Example_1.0.0 NETSERV/0.1
user: user50

Develop NetServ module

  1. Open with gedit or your favorite editor.
gedit NetServ/ & is a typical NetServ packet processing module and it extends the NetServ.BuildingBlock.service.PktProcessorActivator class.

  1. Modify

Comment out processPkt() marked as scenario #1, and uncomment processPkt() scenario #2.

  1. Compile and upload the new version of the module.
  1. While you're watching the browser screen, install the module into the NetServ router with the following command.
./ 2

Note that the "2" argument will make the script send setup-request-2.txt, which includes two IP addresses in the properties header.

$ cat setup-request-2.txt 
SETUP NetServ.Example_1.0.0 NETSERV/0.1
user: user50
ttl:  600
filter-proto: udp
filter-port: 20050
properties: debug = false, ip =

  1. Update the module properties by sending another SETUP message.

By sending a SETUP message for a module that is already installed, you can update its properties and refresh its TTL.

Try sending setup-request-3.txt to the NetServ router:

./ 3

This SETUP request contains a non-existing IP address as the packet destination, which will make the NetServ node drop the incoming packets.

  1. also contains an embedded web server. Thus, it is not only a packet processing module but also a server module. The embedded web server is started when the module is installed (in initialize() method) and stopped when the module is removed (in cleanup() method). See the startHttpServer() method for what the web server does.
  1. Open a new tab on your browser and go to the following URL (replace "XX" with your own user number):

The embedded web server will respond with the current packet count as shown below.

screenshot of the embedded webserver html page

Run NetServ node locally

  1. Open another terminal window and start the NetServ router.

Type the "GENI User" password when asked.

cd /netserv-root/core/linux/
sudo su
.  setenv-i386-ubuntu
./  conf-default.xml

The conf-default.xml file specifies a sample configuration for a single container.

  1. Open two more terminal windows (they don't have to be big).

On one window, start Netcat in server mode, listening on UDP port 22222:

nc -u -l 22222

On the other window, start Netcat in client mode, connecting to the UDP port 22222 on the localhost:

nc -u 22222

Test the chat-like connection by typing something in the Netcat client window. You should see the same characters appear on the server window.

  1. Open another terminal window and build the UDPEcho module.
cd /netserv-root/apps/udpecho/modules
  1. Install the UDPEcho module into the local NetServ router.
cd test

You can switch to the NetServ router window and see the log output of the installation process.

  1. See UDPEcho in action!

Type something in the Netcat client window and see what happens. See also the debugging output from the UDPEcho module in the NetServ router window.

  1. Remove the UDPEcho module.

Type something again in the Netcat client window and see what happens.

  1. Stop NetServ by pressing <CTRL> + C.

(Optional) Process Layer 2 frames in NetServ

  1. Rebuild NetServ for layer 2 frame processing and run it.
cd /netserv-root/core/linux
sudo su
.  setenv-i386-ubuntu
./  conf-default.xml
  1. Set up the newly created TAP interface.

Open a new terminal window and type the following:

sudo ip link set netserv101 up
sudo ip addr add dev netserv101

Type the "GENI User" password when asked.

  1. Check that the TAP interface is up and running.
  1. Rebuild the UDP echo module.
cd /netserv-root/apps/udpecho/modules
make all
  1. Install the UDP echo module.
cd test
  1. Ping an IP host address in the TAP subnet, so that the ping request would go through the TAP interface to NetServ.

Take a look at the NetServ terminal window, you will see ARP requests being intercepted. You can stop the ping by pressing <CTRL> + C in its terminal window.

  1. Set up a manual ARP table entry for the ping destination address.
sudo arp -s 01:02:03:04:05:06
  1. Ping again.

Now you can see that NetServ is replying to your ping requests!

  1. Remove UDP echo and install it again.

By removing the UDP echo module the ping will stop receiving replies.

  1. Take a look at the UDP echo code.
gedit /netserv-root/apps/udpecho/modules/src/NetServ/apps/UDPEcho/ &

Note that when using TAP transport processFrame() gets called instead of processPkt().

Please take a quick survey

Please complete these very quick surveys. :-)

Further information

NetServ home page:

Mailing list:

Feedback or questions:

Jae Woo Lee <>

Roberto Francescangeli <>

Last modified 12 years ago Last modified on 03/13/12 18:14:25

Attachments (2)

Download all attachments as: .zip