March 30, 2008

A world beyond network device simulators ...

You have probably already heard about different network device simulators like Boson NetSim, Cisco Packet Tracer, etc. All of these applications are capable of simulating few functions of network devices. The problem is that these applications are only simulators - they can only simulate features which were ported from real devices to algorithms into these simulators. And what's more, they will never be able to simulate real situations, as it would mean to rewrite the real codes from real devices to algorithms on simulators. This would be very expensive. On the other hand, there is one very big advantage of these simulators: you can pause, stop, restart, or do whatever with your simulated topology and simulated devices. You can even see animations of how are the packets flowing from point A to point B. In this way, network simulators are perfect tools for teaching network technologies as students learn not just the theory, but they can see how are these different packets exchanged between devices and what's happening to them.

So I think we can end this up by saying that network device simulators are great for teaching and for low level troubleshooting (e.g. CCNA level). When we face a situation, where the simulators are not enough for us (lack of supported commands, features, etc.), we can try to get some real devices with full features. If you work in a big networking company maybe you will find a way to get some spare devices from storage for testing, but generally it's a problem. Networking devices are sometimes very expensive and it's definitely hard to get in touch with higher level of devices like Cisco 38xx, 45xx, 5xxx, 65xx, 72xx, 12xxx, ...

There are some virtual laboratories provided by training partners, where the real devices are already interconnected into labs, and the console ports are shared via telnet or other type of remote CLI connection. You can then order and schedule these labs use them for your training. It's especially handy when you are preparing to get your next CC*P or CCIE :-)

The last option is to get a device emulator. Emulators "emulate" the real hardware like CPU, memory, interfaces, etc. VMWare, MS VirtualPC, VirtualBox are applications capable of emulating the X86 computers hardware. With these applications you can build up your virtual network of end devices. Maybe you have seen some emulators for game consoles like PlayStation emulators, SNES, etc which emulating special hardware. The only disadvantage of emulators is that because the emulators are emulating only the hardware, you will still need some operating system to run on this virtual hardware. This sometimes means additional licenses for operating systems and applications. And now comes the best: there is also an emulator for Cisco gears too!

Dynamips is an emulator for the MIPS CPU platform. Most of the Cisco routers are using MIPS CPUs. Dynamips is not only emulating the CPU, but the whole case with many different networking interfaces. It does support LAN and WAN interfaces like Ethernet cards, ATM, Serial, T1, etc. It supports emulation of the Cisco 7200, 3700, 3600 and 2600 series platforms. You can run Dynamips on Linux, Windows and even MacOS. You can even start Dynamips on more computers connected through a network and then connect together via IP sockets the dynamips emulated boxes. A pretty nice feature is also that you can connect the virtual interface of a router to a real interface of your PC. In this way you can connect a bunch of virtual routers even to real gears! Because Dynamips only emulates the Cisco case with CPU and stuff, if you want to really use it you will need the IOS file to run it on.


Dynagen is a wrapper around Dynamips which allows to create a topology based on emulated routers. Dynagen uses a connections definition in a special format saved in a lab file with ".net" extension.


For this topology, the .net file contents are:

# Fullmesh topology
# Serial + Frame Relay + Switch
autostart = false
ghostios = true
sparsemem = true


    idlepc = 0x6262a240
    ghostios = true
    mmap = true
    image = c7200.bin
    npe = npe-400
    ram = 160
    disk0 = 32

    [[ROUTER R1]]
    F0/0 = NIO_gen_eth:\Device\NPF_{312F26FF-F960-4442-AF71-2633843F88FD}
    F2/0 = SW1 1
    S1/0 = R2 S1/0
    S1/4 = R6 S1/4
    S1/2 = R3 S1/2
    S1/3 = R4 S1/3
    S1/6 = R5 S1/6
    S1/7 = F1 1
    #F0/0 = SW1 1

    [[router R2]]
    F0/0 = NIO_gen_eth:\Device\NPF_{312F26FF-F960-4442-AF71-2633843F88FD}
    F2/0 = SW1 2
    S1/1 = R3 S1/1
    S1/5 = R4 S1/5
    S1/4 = R5 S1/4
    S1/3 = R6 S1/3
    S1/7 = F1 2

    [[router R3]]
    F0/0 = NIO_gen_eth:\Device\NPF_{312F26FF-F960-4442-AF71-2633843F88FD}
    F2/0 = SW1 3
    S1/4 = R4 S1/4
    S1/3 = R5 S1/3
    S1/5 = R6 S1/5
    S1/7 = F1 3

    [[router R4]]
    F2/0 = SW1 4
    S1/0 = R5 S1/0
    S1/2 = R6 S1/2
    S1/7 = F1 4

    [[router R5]]
    F2/0 = SW1 5
    S1/1 = R6 S1/1
    S1/7 = F1 5

    [[router R6]]
    F2/0 = SW1 6
    S1/7 = F1 6

    [[ethsw SW1]]
    1 = dot1q 1
    2 = dot1q 1
    3 = dot1q 1
    4 = dot1q 1
    5 = dot1q 1
    6 = dot1q 1
#    7 = access 1
#    8 = dot1q 1 NIO_gen_eth:\Device\NPF_{312F26FF-F960-4442-AF71-2633843F88FD}

    [[FRSW F1]]
   1:102 = 2:201
   1:103 = 3:301
   1:104 = 4:401
   1:105 = 5:501
   1:106 = 6:601
   2:203 = 3:302
   2:204 = 4:402
   2:205 = 5:502
   2:206 = 6:602
   3:304 = 4:403
   3:305 = 5:503
   3:306 = 6:603
   4:405 = 5:504
   4:406 = 6:604
   5:506 = 6:605


For Dynagen you have to start the Dynamips in a "Hypervisor" mode:


and then open the lab .net file in Dynagen:


after entering the "telnet /all" command in the Dynagen's console, new telnet windows will be opened connected to console ports of emulated devices. Now you can start to configure your virtual devices :-)

One of my favorite features of Dynagen is the ability to capture packets into a Wireshark compatible file on a virtual wire that interconnects two emulated routers. In this way now you can sniff packets even on ATM or Serial interfaces! It's great for troubleshooting and learning more about networking.

clip_image002[10]GNS3 is like Dynagen on steroids :-D GNS3 is again a wrapper around Dynamips but towards Dynagen it has a graphical user interface and it's much easier to use. What's more, the new version of GNS3 has support also for Pemu which is a PIX emulator built on Qemu.




Afaik, the official statement from Cisco (well, read the IOS license) is that you cannot run IOS on different hardware than genuine Cisco. So it looks like it might be "not legal" to use all these emulator stuff. You should definitely not use them for production networks and don't try to sell it as a solution (virtual laboratories, etc.)