Bridging Netkit Virtual devices and Dynamips Routers

While browsing Arden Packeer’s blog ( the other night I came across a mention of Netkit. After going to their site and reading a bit about it I knew this was going to be a really great technology to utilize in my home lab and something I had to tell you guys about.

To quote…

“Netkit has been conceived as an environment for setting up and performing networking experiments at low cost and with little effort. It allows to “create” several virtual network devices (full-fledged routers, switches, computers, etc.) that can be easily interconnected in order to form a network on a single PC.”

Why would you want Netkit in your lab/office? Well Netkit allows you to quickly and easily bring up multiple virtual devices with the aid of UML technology. Each one of these devices is essentially a Debian Linux system with most of the tools you could ever want already installed. Within minutes from starting Netkit you could have Web Servers, Mail Servers, DNS Servers, MySQL Databases, Quagga Powered routers and more up and running, eagerly awaiting your packets. The applications of something like this are limited only by ones imagination but here are a few suggestions:

* Bridge up to Dynamips routers and incorporate network services into your labs
* Incorporate Quagga Routers into your BGP labs
* Use virtual devices as end-user clients when testing solutions
* Test Fail-over and Redundancy Solutions related to Routing, Mail, DNS and Web services
* Use as a tool to learn more about Linux system administration (go ahead have fun without the risk of damaging something on your existing Linux desktop).

By utilizing UML technology Netkit essentially allows you to run multiple network devices with low memory and CPU consumption. This is vital if you are like me and you are thinking of incorporating this on servers which are already under some load.

Installation is a breeze, please refer to for instructions.

As for bridging virtual devices to their Dynamips counterparts, its made really easy by the tools found in the bridge-utils package. By issuing a few commands you can get your Linux box to function as a bridge and pass packets between a Dynamips router and a virtual device, in this case “pc1”.

First of all add tap interfaces to any of the Dynamips routers you wish to bridge to Netkit virtual devices. In the below example you can see that on router “A”, I have configured it to link its e0/2 interface with a local tap interface named tap0. I then configured router A’s e0/2 to have an IP address of

[[Router A]]
model = 3640
autostart = false
slot0 = NM-4E
slot1 = NM-4T
e0/2 = NIO_tap:tap0
e0/1 = C e0/0
S1/0 = B S1/0
idlepc = 0x605c9218

Next, start pc1, have it connect its eth0 to a local tap interface. Give the tap interface a null address and give pc1’s eth0 interface the ip address of
[root@pluto netkit]# vstart pc1 –eth0=tap,,

Ensure neither tap0 nor nk_tap_user1 (tap interface created by Netkit for pc1) have IP addresses.
[root@pluto netkit]# /sbin/ifconfig tap0 up
[root@pluto netkit]# /sbin/ifconfig nk_tap_user1 up

Create An Instance.
[root@pluto netkit]# /usr/sbin/brctl addbr br0

Enslave Network devices “tap0 and “nk_tap_user1” to take part in the bridging of br0.
[root@pluto netkit]# /usr/sbin/brctl addif br0 tap0
[root@pluto netkit]# /usr/sbin/brctl addif br0 nk_tap_user1

Ensure all interfaces involved are up.
[root@pluto netkit]# /sbin/ifconfig br0 up
[root@pluto netkit]# /sbin/ifconfig tap0 up
[root@pluto netkit]# /sbin/ifconfig nk_tap_user1 up

Configure interface br0 to take part in the network.
[root@pluto netkit]# /sbin/ifconfig br0 netmask up

You should now have connectivity between pc1 and your Dynamips router!!

If you would lke to learn more about Netkit or Briding in Linux please take a look at the following sites:

Netkit –


~ by networkingza on May 9, 2008.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: