Tag Archive : simulation

/ simulation

If you are a students / lecturer / alumnus of Cisco Networking Academy, you can use Packet Tracer for experiment with network especially using Cisco devices. Alternatively we can use dynamips to simulates network. In this article we will discuss about how to install Dynamips and Dynagen to emulates Cisco’s devices on Slackware.

In this article, I use:

  1. Slackware64 14.0 with multilib support.
  2. Dynamips 0.2.8 RC3 for linux
  3. Dynagen

Multilib support is not a must as there are two version of dynamips for Linux, 32-bit and 64-bit.

Dynamips and Dynagen Overview

Dynamips is a software that emulates Cisco IOS on a traditional PC (means our everyday machine). This project started by Christophe Fillot. Initially it emulates Cisco 7200 device and now supports Cisco 3600 series (3620, 3640, and 3660), 2700 series (3725, 2745) and 2600 series (2610 to 2650XM, 2691).

Cristophe Fillot states that this project goals are:

  1. Obtain the Materialsto be used as a training platform, which software used in real world. Allow people to become more familiar with Cisco devices.
  2. Test and experiment the numerous and powerful features of Cisco IOS.
  3. Check quickly configurations to be deployed later on real routers

Note that, this is just an emulator, which can’t replace real router. You can read more from his site on http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator.

Dynagen is a text-based front end for Dynamips, which use the “Hypervisor” mode for communication with Dynamips. Dynagen is no longer officially maintained, however Dynagen is still updated and developed for used on GNS3.

Dynagen can run on any platform which supports Python.

Obtain the Materials

Now download the materials. The Dynamips and Dynagen we used are provided by GNS3 (http://www.gns3.net)

If you use Slackware 32-bit, you can download Dynamips 0.2.8-RC3-community for Linux 32-bit. If you use Slackware64, you can download Dynamips 0.2.8-RC3-community for Linux 64-bit. If you use multilib support, you can choose either 32-bit or 64-bit, but I recommended you to use the 64-bit one.

Next, download the source for dynagen. The one we use is dynagen-0.11.0tar.gz. You can obtain it on Sourceforge which located here.

If you have not installed libpcap before, you need to download and install it first.

Installation

Create a new directory /opt/dynamips. The dynamips will be installed to /opt/dynamips and dynagen will be installed to /opt/dynagen (will be created later) respectively.

Now go to /opt.dynamips. Create bin and images directories. Move your dynamips-0.2.8-RC3-community-x86_64.bin (or dynamips-0.2.8-RC3-community-x86.bin) to /opt.dynamips/bin.

Next, copy your dynagen file to /opt. Extract it with the following command:

tar -xf dynagen-0.11.0.tar.gz dynamips-0.2.8-RC3-community-x86_64.bin

You should have a new directory dynagen-0.11.0. Now rename it to dynagen. Thus you now have /opt/dynagen. Then creat a new directory /opt/dynagen/labs.

Remember that you need libpcap if you haven’t install it.

Preparing Cisco IOS Images

Dynamips emulates Cisco devices. Technically speakin, it is running real Cisco IOS images. Thus, to have dynamips run properly (maybe the right word is: to be able to run dynamips), you need to provide Cisco IOS. They can be obtained by dumping the real machines, if you have. Another way is used the images provided by other people. Unfortunately, neither I or dynamips official can not provide you with the images. And yes, you should find it by yourself.

The images supported by dynamips (by current version) are (at least what I have):

  1. 7200
  2. 4000 series
  3. 4500 series
  4. 3600 series (3620, 3640, and 3660)
  5. 2900 series (
  6. 2700 series (3725, 2745)
  7. 2600 series (2610 to 2650XM, 2691)
  8. 1600 series
  9. 1000 series

Place the images on /opt/dynamips/images/.

The Cisco images are compressed. This compressed images will work just fine with Dynamisp, however the boot process is slowed significantly with decompression process. It is recommended to decompress the images beforehand so the emulator doesn’t have to. Do the following if you want:

unzip -p "images file.bin" > "images file.image"

Yes you can substitute with your images filename. Note that for some images, you must uncompressed it first to work with Dynamips.

Usage

Using dynamips and dynagen, we are working with virtual lab. The configuration of all routers, switch, and interconnections that make up the virtual lab are stored on a single “network file”. This file is simply an INI file-like.

Lets start up with a simple virtual lab. Create a new directory /opt/dynagen/labs/simple. Next, create a new file simple1.net write following to it.

# Simple lab
[localhost]
[[7200]]
image = /opt/dynamips/images/c7200-jk9s-mz.124-13b.bin
npe = npe-400
ram = 160
[[ROUTER R1]]
s1/0 = R2 s1/0
[[router R2]]
# Nothing to do

We create a simple net with two routers, R1 and R2. The network is running on localhost, the same machine which run Dynagen. In this network we register a cisco device, router 7200 and specify the images as /opt/dynamips/images/c7200-jk9s-mz.124-13b.bin.  For each instance of 7200 will use an NPE-400 and use 160MB of RAM resource.

Now the topology. R1 has a serial port name S1/0 which is connected to R2’s port of S1/0.  This connection is virtual connection. Dynagen will automatically install a PA-8T adapter in Port 1 on both R1 and R2. On R2, we can omit the adapter as the adapter has been specified before.

In order to run this virtual lab, first start up the dynamips server. Invoke following command:

dynamips -H 7200 &

The 7200 is not the Cisco device, but a port dynamips listening to. Next, load the configuration file to dynagen:

dynagen /opt/dynagen/labs/simple1.net

And there you should see the Cisco IOS is running 😀

Installing Packet Tracer for Slackware

December 5, 2015 | Article | No Comments

Packet Tracer, a wonderful tool for experiment with network, especially for Cisco based device. If you have read previous article about netkit, you will notice that we can only simulate network using linux devices. In this article we will discuss about installation of Packet Tracer Slackware.

In this article I use:

  1. Slackware64 14.0 with multilib enable. Note that for 64-bit, multilib is a must.
  2. Packet Tracer 5.3

Why Packet Tracer?

If you aim for taking Cisco Certified Network certification (either CCNA, CCNP, CCIE, etc), you are strongly need this. Taking Cisco certification required deep understanding of Cisco’s devices as well as networking. Packet Tracer is designed by Cisco to make students learn Cisco’s devices easily.

Another thing I want to emphasize is that Packet Tracer is officially made by Cisco itself. Included with it are some sample projects you can look with various networking scheme, such as simple network with switch, router, etc; A simple VoIP network; network for IP telephone; and much more.

In short, PacketTracer offers following features:

  • Design a physical network
  • Focus on Cisco’s devices.
  • Complete connectivity simulations: perform ping, traceroute, etc.
  • Compatible with HTTP, TCP/IP, Telnet, SSH, TFTP, DHCP and DNS.
  • Rich Cisco device, from analog device (such as analog TV, splitter, etc), to digital device (such as switch, router, PC, etc)
  • Less memory consumption

Acquiring the Materials

Unfortunately, Cisco doesn’t distribute Packet Tracer freely. You must become students, lecturer, or alumnus of Cisco Networking Academy to obtain this tool. In this article, we will only discussing how to install it on Slackware. Therefore, I can’t provide you with some materials. And don’t ask me to provide it, please.

Fortunately, you can search on google. There are many kind people out there provide you with Packet Tracer. Again. I myself search the net to obtain it. The one I use here is Packet Tracer 5.3.3.

You can convert either .deb (package for debian/ubuntu) files or .rpm (for fedore/redhat) files to .tgz using tools such as deb2tgz and rpm2tgz and install it automatically. It is so easy that you can do it by yourself, so we will discuss the more complex one, install from the installer, .bin file. I use PacketTracer533_i386_installer-rpm.bin which include tutorials.

Installation

Now open terminal and go to where you download the file (in this case PacketTracer533_i386_installer-rpm.bin). Our goal now is extracting the package from the installer and later create Slackware package for it.

Now run the installer or initialize setup. You should become root and make sure the installer is executable. Once you run the binary installer file, the content of the “PacketTracer533_i386_installer-rpm.bin” will be extraceted to /tmp folder.

Now view the EULA (End User License Agreement), there you will be asked to press the ENTER key. Don’t do this. Instead, go to /tmp and press CTRL + C combination key to abort the installation. Yes, I’m being serious.

Now go to /tmp/selfextract.XXXXXX folder where XXXXXX is the random string assigned by computer. There should be one. If there are more than one similar directories, you should check any of directories which has Fedore RPM packages. It should not be difficult.

Now go to that directory and convert the .rpm package to .tgz package. Use following command:

rpm2tgz PacketTracer-5.3_3-u.i386.rpm

Then install the converted .tgz file by installpkg tool.

installpkg PacketTracer-5.3_3-u.i386.tgz

The Packet Tracer now should be installed on /usr/local/PacketTracer5 directory. Now, create a symbolic link of Cisco Packet Tracer to /usr/bin directory.

Now, we need to add executable symbolic link of Cisco Packet Tracer to /usr/bin directory to be able to start program from command line interface shortly by packettracer command.

ln -s /usr/local/PacketTracer5/packettracer /usr/bin/packettracer

You can now test whether Packet Tracer is installed completely by invoking packettracer command. Here is the screenshot

pt

What if you want to do some experiment for networking but you don’t have enough resource for it? Not enough PC / switch / router, or maybe don’t have any? You could use Virtual Machine such as VirtualBox and QEMU to emulates hardware. But as you can see, it is painfully and consume lot of resource such as memory and CPU utilization. What if you want to emulates dozens or event hundreds machines? See the point?

So what is the cheapest way to do so? Netkit can answer that. In this article we will installing Netkit to do emulation on Linux (and only linux). In this article I use:

  1. Slackware64 14.0 multilib. If you have Slackware64, you need to enable multilib. Using Slackware 32-bit can proceed.
  2. Netkit version 2.8
  3. Netkit Filesystem
  4. Netkit kernel

The netkit can be downloaded from their official site, here.

What is Netkit

So what is Netkit?

Netkit is an environment for setting up and performing networking experiments at low cost and with little effort. Low cost means you don’t need to setup many computers nor consume many resources on your workstations. 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. Networking equipments are virtual but feature many of the characteristics of the real ones, including the configuration interface.

Emulating a network with Netkit is a matter of writing a simple file describing the link-level topology of the network to be emulated and some configuration files that are identical to those used by real world networking tools. Netkit then takes care of starting (emulated) network devices and of interconnecting them as required. Alternatively, networks can be described by using an XML-based language known as NetML. Starting from a network description in NetML, it is possible to automatically obtain configuration files which can be used with real routers, or Netkit scripts which can be used to emulate the described network.

Unlike Virtual Machine, Netkit use Linux Kernel to emulate device. Therefore, only Linux machine is supported. Netkit exploits open source software and heavily based on the User Mode Linux (UML) variant of the Linux kernel.

Obtaining the Materials

Now, let’s download the required materials. Netkit is composed of three components: the main system, the kernel, and the filesystem. We will download it separately. Again, you can download all of them here.

The main system is the core or the main engine for netkit. The one we use here is Netkit version 2.8 which can be downloaded here.

The filesystem is the “storage” or filesystem used by any of netkit machine. The one we use can be downloaded here.

Last one is the kernel. The kernel is a user process application which emulates linux system. The one we use can be downloaded here.

Install them

In this article we will use /opt directory as the root for installation. Now copy all files we have downloaded to /opt. Use these commands to extract them.

tar -jxf netkit-*

You should notice that we have new directory named netkit. Inside it, you will get some directory such as bin, fs, kernel, check_configuration.d. Netkit doesn’t need to be installed. Thus you can use them directly (but need to be configured, will be described on next section).

Setting the Environment Variable

Before using, we need to set the environment. You need to set following environment variable on your shell. You can set them by using export. These commands must be used on your shell.

export NETKIT_HOME=/opt/netkit
export PATH="${PATH}:${NETKIT_HOME}/bin"
export MANPATH="${MANPATH}:${NETKIT_HOME}/man"

It might be simple, but it will be painful if you want to use netkit on multiple shell, or use netkit multiple times as you need to type them everytime you want to use netkit. The smart way would be save it to some file that will be read by your shell everytime you open terminal. In this case we use bash, and we need to set the configuration locally. Thus we need to modify our .bashrc file. Edit your ~/.bashrc and add following lines.

export NETKIT_HOME=/opt/netkit
export PATH="${PATH}:${NETKIT_HOME}/bin"
export MANPATH="${MANPATH}:${NETKIT_HOME}/man"

When you are done, proceed to next stage.

Checking Configuration

Although I have stated that we can use netkit directly, but we need to check whether netkit can be run or not. At least you have to finish previous stage (setting the environment variables) before proceeding.

Now, open your terminal and go to /opt/netkit. Then invoke following command:

./check_configuration.sh

You should have no problem and will receive message like this:

>  Checking path correctness... passed.
>  Checking environment... passed.
>  Checking for availability of man pages... passed.
>  Checking for proper directories in the PATH... passed.
>  Checking for availability of auxiliary tools:
awk          : ok
basename     : ok
date         : ok
dirname      : ok
find         : ok
getopt       : ok
grep         : ok
head         : ok
id           : ok
kill         : ok
ls           : ok
lsof         : ok
ps           : ok
readlink     : ok
wc           : ok
port-helper  : ok
tunctl       : ok
uml_mconsole : ok
uml_switch   : ok
passed.
>  Checking for availability of terminal emulator applications:
xterm          : found
konsole        : found
gnome-terminal : not found
passed.
>  Checking filesystem type... passed.
>  Checking whether 32-bit executables can run... passed.

[ READY ] Congratulations! Your Netkit setup is now complete!
Enjoy Netkit!

If you don’t get congratulations, you should recheck your installation again. Either way, congratulation! You have installed netkit.

Social media & sharing icons powered by UltimatelySocial