Terminal Server in Dynamips

I find using a terminal server to connect to routers while labbing very efficient. I personally don’t like having 10 windows open when configuring devices. I tried it back when I started studying for my R&S but found I made more errors than worth. Since then I have gotten used to jumping between terminal sessions on one screen.

Like most I used Dynamips when I studied for the SP. I built a quad-core PC at home with Ubuntu. My laptop at the time was running Windows XP, but during my 4 months trial I got a Mac Book Pro. Obviously I had to study whenever I had time regardless of the platform. So I configured the same setup across all three platforms.

Configuring a terminal server in Dynamips requires a real interface to be bridged to a virtual router interface. This is done by using a loopback interface. This is done very differently on the three  platforms:

  • Windows XP (32-bit)
  • Ubuntu 9.10 (64-bit)
  • Snow Leopard 10.6 (32/64-bit)

The .NET file I used for the Internetwork Expert SP labs are at the bottom of the article.

Windows

Installing a loopback interface on windows is easy. Refer to this link for step-by-step instructions. Once installed, the loopback interface is configured the same as any normal interface. I gave my loopback interface the address 172.16.16.5.

Dynamips on Windows uses the Winpcap library to accomplish the bridging between this logical loopback interface and the interface you will assign in Dynamips. Dynamips provides a command line utility to list the available interfaces on Windows hosts, usually installed with a shortcut on the desktop called “Network Device List”.

Get the NPF device ID and enter it under your terminal server config in the .NET file:

[[Router IETS]]
 model = 3640
 console = 2015
 disk0 = 64
 F0/0 = NIO_gen_eth:\Device\NPF_{B00A38DD-F10B-43B4-99F4-B4A078484487}
 cnfg = c:\dynamips\initial.configs\IETS.initial.config.txt

The highlighted line bridges the terminal server’s F0/0 interface to the Eth0 interface on PC. Packets that exit F0/0 are dumped out on to the real network through Eth0, and return packets are forwarded back to the virtual router instance accordingly.

Feel free to download my terminal server config file at the the bottom of this article.

LINUX

Dynamips runs far more efficient on Linux in my experience. The CPU/memory allocation is far better. On Linux systems, like Ubuntu, this is done using the NIO_linux_eth NIO descriptor.

Now there are different ways to do this, but this worked for me. Firstly you need to create a logical loopback interface, called a TAP interface.

$~~sudo apt-get install uml-utilities

Then give the interface an IP address:

ifconfig tap0 172.16.16.5 netmask 255.255.255.0 up

Now the problem on Ubuntu is once a TAP interface is configured and the PC is rebooted, the config is lost. An easy work around is to ensure it’s configured at startup. Add the following to /etc/rc.local:

modprobe tun
tunctl
ifconfig tap0 172.16.16.5 netmask 255.255.255.0 up

Reboot and confirm you have the tap interface configured. Then add the following to your .NET file

[[Router IETS]]
 model = 3640
 console = 2015
 disk0 = 64
 F0/0 = NIO_tap:tap0
 cnfg = /dynamips/initial.configs/IETS.initial.config.txt

MAC OSX

Firstly download and install the TUNTAP package from here to create the virtual TAP interfaces .

Mac is different in that the virtual TAP interface should only be brought up after executing the .NET file. I have had some funnies if not done in this order.

So firstly add the following to you .NET file:

[[Router IETS]]
 model = 3640
 console = 2015
 disk0 = 64
f0/0 = NIO_tap:/dev/tap0
cnfg = /dynamips/initial.configs/IETS.initial.config.txt

Then bring up the TAP interface with the right IP address:

@~  sudo ifconfig tap0 172.16.16.5 netmask 255.255.255.0 up

Here is the .NET file I used for Internetwork Expert SP material:

INE-sp-default

Feel free to download the terminal server config file I used.

IETS.initial.config

The above steps to bridge virtual router interfaces with real host interfaces, could also be used to allow your virtual network to communicate with the real world.

Advertisements

14 thoughts on “Terminal Server in Dynamips

  1. Thanks a bunch, I just wrote of this the orbs day. I needed to research what you have done. This will save me a good bit of time. Do you mind if I share your info on GNS3Vault… Good stuff. How much RAM were/are you using on the Ubuntu box? I have a quad core that I am building around to do the exact same thing plus my laptop is a Mac Book Pro as well; I run Win 7 pro 64 on top of it sometimes via VMWare so a few things that I need to run still in the Windows world. Again thanks for the info

    JCB

  2. Just trying to work out, what advantage does this have over having a tabbed terminal (if on Windows, SecureCRT, Poderosa, Putty Connection Manager, the terminal within Linux, or iTerm in OS X), SSHing into the machine and doing a “telnet localhost 200X”?

    All I do is open up a new tab, name the tab to be the correct router name, and then telnet to the routers console port in Dynamips/Dynagen.

    1. A terminal server has the ability to send a command/s to all devices using “send *”. I use this function along with macro and TCL scripts.
      On real kit I used it specifically to wipe devices and install base-configs.
      Besides that I prefer seeing config from different devices on the same screen. I found it quicker to spot config faults.
      It is more personally preference than one being more correct than the other.

  3. Hey Ruhann,

    I personally use 1 of 2 methods.

    1) iTerm is really efficient once you get going with it. Open up all the devices in a separate tab. Moving between tabs is done with Apple-key and . Also, everytime there is new output in one of the tabs, that tab header goes a different colour! Sending output to all tabs is also quite simple, use Apple-key Shift and “i”

    2) If i’m accessing my mac remotely to do labs, then I use an ssh session via secure-crt. I then use screen.

  4. Just wondering, if there is any way to access hypervisor via configured loop-back terminal server. So I can remotely reload the router as required. At this moment, I am using RDP, but I wish if I could have access to hypervisor remotely via telnet or at least there is a way to access hypervisor remotely other then RDP. I am running GNS3 0.7.2 on windows 7. Thank you.

    1. Dont believe that is possible.
      I used to connect remotely to my dynamips server using SSH. From there I would start the hypervisor and load the .net file in dynagen.
      In a second session I would then telnet to the server’s IP and the virtual terminal server’s Port. (used to be 2015)

      That is how I had full remote connectivity.
      HTH

  5. Late last night/real early this morning 12 routers running EIGRP, OSPF and BGP. Redistributed the routing tables between EIGRP and OSPF… It was just amazing… later today connecting to real gear to have a few multi national corps setup. It’s real odd the things that get you really excited and bring you mass amounts of joy. Maybe peering some BGP routers with HSRP into …

    JCB

  6. I don’t get it. It appears I have everything configured correctly. My Terminal server can’t ping my tap0. (tap0 = 172.16.1.24/27). I gave fa0/0 the IP of 172.16.1.25/27 and added F0/0 = NIO_tap:tap0 to my .net file. Nothing.

    [[ROUTER TS2]]
    model = 3660
    console = 2006
    f0/0 = NIO_tap:tap0
    idlepc = 0x60438688

    http://i427.photobucket.com/albums/pp360/xtropx/RUNNINGCONFIG.png (Router Config)

    Driving me NUTS. Just trying to get a nice telnet session into my access server to be able to configure all my routers and follow along with instructional videos…

    1. Your subnet mask on the TAP0 does not match. But that is not your problem.
      The linux setup above was done on ubuntu desktop 64-bit. If you cannot ping your TAP interface on the 3640, then it is possible for the NIO_tap to be different than the one I specified.
      Once the TermServer is started and the TAP0 interface locally is up you should be able to ping between the two.
      Confirm you have no blank space at the end of the line, if you running ubuntu.
      HTH

  7. Hello, and thank you. I was running this on ubuntu 32-bit on an old Poweredge 2650 in my closet – since then I have opted for a 64-bit VM in workstation. Dynagen/Dynamips was not running well on the Poweredge: routers would not load completely, or at all, especially when I would un-comment F0/0 = NIO_tap:tap0 in my .net file. When I corrected my rather obvious subnet mistake I lost network connectivity to the box. Putting it on a different network meant I couldn’t access it from the rest of my home network, i.e. couldn’t telnet into my access server from my LAN, etc. Made the transition and everything is now running smoothly. It still would have been nice to figure out what exactly was wrong there, but for now, this will suffice.

Please leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s