Saturday, March 13, 2010

Install GNS3 on Mac OSX Leopard

October 28, 2009 by Greg Ferro · 21 Comments 


Go to http://​www​.gns3​.net/downloadDynagen at Sourceforge and download.

Open the GNS3 pack­age and copy it to your Applications folder.

gns3-install-osx-0.jpg

and copy­ing:

gns3-install-osx-1.jpg

Now you can run the GNS3 and it will tell you to install Dynagen. Dynagen is a python wrap­per that sim­pli­fies the dynamips emulator.

Dynamips is basic­ally a MIPS CPU emu­la­tion soft­ware with some code to emu­late the Cisco hard­ware. Dynagen extends this to read a text file for the con­fig­ur­a­tion and makes it easier

Copy Dynagen to your Applications Folder.

gns3-install-osx-3.jpg

Configuring GNS3 Preferences

General

I have cre­ated a dir­ect­ory in my Documents folder to store my GNS3 data and IOS images.

gns3-install-osx-4.jpg

Dynamips

The Executable path for dynamips isn’t straight­for­ward because it’s a file. Be default, OS X wants it to be a dir­ect­ory (because all pro­grams are actu­ally dir­ect­or­ies in OS X) so you will need to manu­ally enter

/​Applications/​Dynagen/​dynamips

When dynamips runs, it cre­ates a num­ber of files that are images of the memory etc, that the MIPS CPU emu­lator needs to ref­er­ence about the hard­ware archi­tec­ture and memory spaces.


Caption Text.

Caption Text.(Click for a full size image)

I would always enable the sparse memory fea­ture to save memory when run­ning mul­tiple images of the same type.

gns3-install-osx-5.jpg

If you have everything cor­rect, you should be able to press the TEST but­ton and get a suc­cess mes­sage in green as shown:

gns3-install-osx-6.jpg

Capture

I haven’t used this fea­ture as yet and may post some­thing on this in the future.

Pemu

PEMU does not work on MAC OS X (as far as I know and these set­tings make no dif­fer­ence.). This is becuase the bin­ary that emu­lates the PIX/​ASA has only been com­piled for the Windows and Linux platforms.

Working and Unzipping IOS Images

Cisco IOS images are com­pressed so as to use the least amount of flash memory. Historically, flash memory was expens­ive and not very large. As a res­ult, IOS was com­pressed and the first thing IOS usu­ally does these days on star­tup is to uncom­press the image from Flash to RAM. When using GNS3/​Dynagen, you can save star­tup time by uncom­press­ing the IOS images.

Cisco IOS images are com­pressed using one of three formats, zip, mzip or STAC. The IOS image name will tell you which com­pres­sion is being used. For the fol­low­ing file­name, the let­ters MZ are the key:

c7200-advsecurityk9-mz.124-20.T1

The first let­ter tells you whether the image runs from flash, memory or ROM. (in the olden days, RAM was also expens­ive and the image would often run from flash, and only dynamic inform­a­tion was stored in RAM. That is, the pro­gram was always executed from Flash, not form memory. Today, RAM is cheap so the flash image is always copied to memory at boot time.)

  • f — flash
  • m — RAM
  • r — ROM
  • l — the image will be relo­cated at run time

and the second let­ter tells you what the com­pres­sion type is:

  • z– zip compression
  • x — mzip com­pres­sion
  • w — “STAC” com­pres­sion

For most images, ZIP com­pres­sion is used and you can use a stand­ard soft­ware pack­age. For those images that use mzip com­pres­sion, you can down­load the Zipeg soft­ware which sup­ports mzip.

Naming Convention

When unzip the file, it is a con­ven­tion to rename it with a .image exten­sion. This makes sure you don’t con­fuse it with a ‘nor­mal’ image.

Which IOS image should you use ?

Because dyna­gen is an emu­lator for the MIPS CPU, you can only images that run on Cisco router hard­ware that uses the MIPS pro­cessor. This means most of the older routers, and not many of the new ones. Your best bet is to use 7200 series images, but also the C1700, C2600, C2691, C3600 and C3700 fam­il­ies used MIPS CPU’s. The C3700 is prob­ably your seond best bet.

Configuring the IOS details

We need to tell Dynamips where the IOS image is.

gns3-install-osx-7.jpg

Press Shift-⌘-I or use the Menu, Edit, IOS Images and Hypervisors to get this screen:


Caption Text.

Configuring the Dynagen parameters.(Click for a full size image)

Point the Image file: to the dir­ect­ory where you IOS images are are stored. I prefer to cre­ate a GNS dir­ect­ory in my Documents and a sub-​​directory for IOS. Thus my dir­ect­ory is:

/Users/gregferro/Documents/GNS/IOS/c7200-adventerprisek9-mz.124-24.T1.image

You must click Save to write the para­met­ers and it will look like:


Caption Text.

(Click for a full size image)

We will set the IDLEPC in the next sec­tion but you need to leave it blank for now.

You can have mul­tiple images for a plat­form, but if you are using sparse­mem (as I recom­mend you should to save memory), then run the same image for every router. In fact, I would typ­ic­ally only use a single router and a single image for all my GNS3/​Dynagen use.

Setting the IDLEPC value

Drag the router model that you con­figured in the pre­vi­ous sec­tion onto the screen and click the play but­ton to start the emulator.


Caption Text.

(Click for a full size image)

You need to con­nect to the router and move out of the of Setup mode. This is because Setup Mode uses all avail­able CPU cycles and will cause your IDLEPC value to be wrong for nor­mal use.

gns3-install-osx-17.jpg

And make you sure you get out of the Automated Setup utility.

gns3-install-osx-18.jpg

This win­dow will pop up while dynamips cal­cu­lates the unused CPU com­mand that are being repeated (Note the “Please wait while cal­cu­lat­ing an IDLE PC” text in the corner)

gns3-install-osx-16.jpg

Right click on the router and select the IdlePC from menu:

gns3-install-osx-15.jpg

The sys­tem will offer a list of pos­sible IDLEPC val­ues, select one of the val­ues that has a an aster­isk next to it.

gns3-install-osx-19.jpg

And now you will have an IDLE PC value configured.

gns3-install-osx-20.jpg

CPU and Memory

There are many other sites that talk about how much CPU and Memory you need to run GNS3. But using Dynagen V0.11 and GNS3 V3.5 will use 100% of CPU. This is because the con­fig­ur­a­tion file will spawn mul­tiple dynamips hyper­visors. I pre­sumse that this allows bet­ter use of mul­ticore processors,and is prob­ably best for for MS Windows. For the fol­low­ing net­work layout:

gns3-install-osx-21.jpg

Here is the Activity Monitor for my mod­i­fied con­fig. What I did was reduce the num­ber of hyper­visors cre­ated when GNS3 starts by edit­ing the .net text file that GNS3 creates.

gns3-install-osx-22.jpg

GNS3 will put the fol­low­ing text into the .net file. This text spawns another dynamips instance on the IDP port specified.

[localhost:7202]
work­ing­dir = /Users/gregferro/Documents/GNS/BE-WAN-Emulator-V1.1_working
udp = 10200
[[7200]]
image = /Users/gregferro/Documents/GNS/IOS/c7200-advipservicesk9-mz.124 – 20.T1.image
idlepc = 0x61301b6c
ghos­tios = True
sparse­mem = True

Why did I change it ?

Because each dynamips pro­cess seems to burn up 100% of CPU. I have been able to reduce this. Having four dynamips instances try­ing to grab CPU resources stoped me from using web brows­ing. By redu­cing the num­ber of hyper­visors to two, it works a lot more efficiently.

Wrap Up

So there are some notes on installing and using GNS3 on Mac OS X Snow Leopard. I expect I will con­tinue to tune and modify parts of the con­fig­ur­a­tion. I have a feel­ing that V0.11 of dyna­gen works less good than the pre­vi­ous ver­sion I was run­ning. i think I might give that go. However, my pre­vi­ous Dynamips wasn’t using GNS3 as I con­figured everything from the com­mand line. GNS3 makes set­ting up the net­works a lot easier, so I expect that I will use both the com­mand line and GNS3 for dif­fer­ent pur­poses. GNS3 for quick and dirty test­ing, and the com­mand line for much lar­ger and more com­plic­ated test­ing (more about how to do this here.

Please rate this post:

  Why Rate Posts?
1 Star - It\\\'s Crud2 Stars - It\\\'s Tosh3 Stars - Something\\\'s missing4 Stars - Needs works5 Stars - Good Enough6 Stars - Good7 Stars - Excellent8 Stars - Brilliant9 Stars - Astonishing10 Stars - Awesomely Godlike? (4 votes, average: 10.00 out of 10)
Loading ... Loading ...

Comments

21 Responses to “Install GNS3 on Mac OSX Leopard”
  1. As usual– great post Greg. I like the break­down of the IOS nam­ing con­ven­tion in rela­tion to it being ziped or mziped. I use zip­peg but have had the last two images that I tried to unzip not load when run­ning dynamips. If I leave them alone they seem to be fine. Another recent issue I have seen has some­thing do do with per­mis­sions when I start the app but I think I just has some files that need to be cleaned up.

    • Greg Ferro says:

      I find that clean­ing the TMP dir­ect­ory from time to time is a good idea. But per­mis­sions can be a big prob­lem on OS X and can take some troubleshoot­ing to sort out.

  2. TAS says:

    Great Writeup ! I have/​had played with GNS3 on MacOSX Leopard and it works pretty good.

  3. Excellent post Greg, you write the “exaust­ive guide” to GNS3 on Mac.
    Great work

  4. Fernando says:

    Great explan­a­tion, thank you. I am run­ning into an issue being able to open a ter­minal win­dow to access the CLI. I get the fol­low­ing error:
    Last login: Wed Dec 9 22:26:45 on ttys000
    Nandos-​​MacBook-​​Pro:~ iNando$ tel­net loc­al­host 2007 ; exit
    Trying ::1…
    tel­net: con­nect to address ::1: Connection refused
    Trying fe80::1…
    tel­net: con­nect to address fe80::1: Connection refused
    Trying 127.0.0.1…
    tel­net: con­nect to address 127.0.0.1: Connection refused
    tel­net: Unable to con­nect to remote host
    logout

    [Process com­pleted]

    Any ideas, please?

    • Greg Ferro says:

      Your are try­ing to con­nect to port 2007 on the dynamips hyper­visor and it isn’t there. Because you also have IPv6 enabled on your net­work adapter, it then goes and attempts to con­nect to the other addresses on the loop­back address.

      Check that your dynamips hyper­visor is run­ning, and that the emu­lated router is run­ning on port 2007. Or check the port num­bers that GNS3 is con­figured to run the ports on.

  5. Chris says:

    Good info Greg! I con­figured everything exactly as instruc­ted. I’m using a 1700 IOS, Snow Leopard. I left the IOS files as .bin files instead of chan­ging the exten­sion to .image. Those are the only dif­fer­ences. Here’s what hap­pens when I try to con­sole into the router:

    Last login: Sun Jan 24 13:51:30 on ttys000
    tel­net loc­al­host 2000 ; exit
    AlarMacBP:~ a1arc0n$ tel­net loc­al­host 2000 ; exit
    Trying ::1…
    tel­net: con­nect to address ::1: Connection refused
    Trying fe80::1…
    tel­net: con­nect to address fe80::1: Connection refused
    Trying 127.0.0.1…
    Connected to loc­al­host.
    Escape char­ac­ter is ‘^]’.
    Connected to Dynamips VM “R0” (ID 0, type c1700) — Console port

    It pretty much stops there. I hit ‘enter’ a couple times and noth­ing. Any ideas?

    • Greg Ferro says:

      Open a ter­minal win­dows and attempt to tel­net on port 7201 or port 7200 after you “turn the IOS on”. If you get a con­nec­tion, then you have the wrong port con­figured in the ter­minal script. That’s the most likely cause.

      • Chris says:

        I made some changes so the 1st 2 tel­net attempts are longer made. Here’s what I get now:

        Last login: Sun Jan 24 16:46:41 on ttys001
        AlarMacBP:~ a1arc0n$ tel­net 127.0.0.1 2000
        Trying 127.0.0.1…
        Connected to loc­al­host.
        Escape char­ac­ter is ‘^]’.
        Connected to Dynamips VM “R0” (ID 0, type c1700) — Console port

        I tried as you sug­ges­ted and port 7200 and port 7201 don’t yield a con­nec­tion. However, port 2000 does. Results are the same as above and still no Router> prompt.

      • Chris says:

        Here’s my login script also:

        /​usr/​bin/​osascript –e ‘tell applic­a­tion “Terminal” to do script with com­mand “tel­net %h %p ; exit“‘ –e ‘tell applic­a­tion “Terminal” to tell win­dow 1 to set cus­tom title to “%d” ’

      • Chris says:

        Here’s my ter­minal script also:

        /​usr/​bin/​osascript –e ‘tell applic­a­tion “Terminal” to do script with com­mand “tel­net %h %p ; exit“‘ –e ‘tell applic­a­tion “Terminal” to tell win­dow 1 to set cus­tom title to “%d” ’

  6. Diego says:

    hi Greg, i’ve used your guide but when I press the TEST but­ton I get an error mes­sage in RED:
    “Failed to start Dynamips”

    any sug­gests??

    • Chrised says:

      I had the same prob­lem. Then I changed the execut­able path to:
      /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin and the test worked. I’m a new­bie so not sure if this is correct.

      • Greg Ferro says:

        Yep. that’s how it work.

      • Diego says:

        Thanks now it works!!!
        But I have another prob­lem: I can’t con­nect to the port 7200 using tel­net..
        here my error

        Macintosh-​​2:~ dv$ tel­net loc­al­host 7200
        Trying ::1…
        tel­net: con­nect to address ::1: Connection refused
        Trying fe80::1…
        tel­net: con­nect to address fe80::1: Connection refused
        Trying 127.0.0.1…
        tel­net: con­nect to address 127.0.0.1: Connection refused
        tel­net: Unable to con­nect to remote host

        using ssh is the same in fact

        Macintosh-​​2:~ dv$ ssh dv@localhost –p 7200
        ssh: con­nect to host loc­al­host port 7200: Connection refused

        I think my 7200 port is locked but my fire­wall isn’t work­ing and the remote login pref­er­ences is allowed to all user without password.

  7. A Grateful Reader says:

    Thanks for the tip of chan­ging the work­ing dir­ect­ory for dynamips on one of those screen­shots.
    It was fail­ing to start dynamips until I changed it away from the default /​tmp setting.

  8. Diego says:

    I’ve see where is the prob­lem:
    using /Applications/GNS3.app/Contents/Resources/dynamips-0.2.8-RC2-OSX-Leopard.intel.bin the dynamips demon won’t start! So that tel­net loc­al­host 7200 can’t find the pro­cess behind the port.

    I’ve used the dir­ect­ory sug­gests by Greg /​​Applications/​​Dynagen/​​dynamips in gns3, still the demon won’t start. In fact in this dir­ect­ory there is the script “Dynamips server”. This script starts the demon, so the com­mand tel­net loc­al­host 7200 works.

    But
    1. if I launch manu­ally “Dynamips server” I’ve an error in gns3: “ser­vice just star­ted on port 7200″ and gns3 try to start the server on the port 7201
    2. obvi­ously even if the server starts on port 7200 i can made a tel­net con­nec­tion but I’ve to con­fig­ure manu­ally the cisco emu­lator without the graphic inter­face of gns3 but using text com­mand to cre­ate the router and the link.

Trackbacks

Check out what others are saying about this post...
  1. […] того момента пока вчера я не нашел отличное описание по шагам для тупых, что надо делать чтобы запустить […]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!