Using GNS3 With VMs on MacOSX Lion

  • View
    222

  • Download
    1

Embed Size (px)

Text of Using GNS3 With VMs on MacOSX Lion

  • 8/10/2019 Using GNS3 With VMs on MacOSX Lion

    1/26

    Getting GNS3 to work on Mac OS X 10.7 Lion withParallels Desktop 7 or VirtualBox 4.1.2 Johan HavermansSeptember 22 2011 (version 201110oct24 _22 DRAFT )

    Getting GNS 3 to work at on your Mac is pretty straightforward. Down-load the GNS 3 package for OS X and run. But if you want to connecta GNS3 virtual network to one or more Virtual Machine(s) running ei-ther in Parallels Desktop, VirtualBox of VMware 1 things get a bit uglier 1 I only tested my solution with Paral-

    lels Desktop 7 and VirtualBox 4.1.2and complicated, but it is possible. Since I prefer to document whatI do and my current document system is Mac only, I really wantedGNS3 to work on Mac OS X.In this note I try to give a brief description of what I did to make thishappen on Mac OS X 10.7 Lion. You will see how to: ...it took me about three weeks to gure

    it all out and I did not nd informationon the web about how to run GNS 3 onMac OS X 10.7 Lion, hence I made thisnote.

    . install a (tap)driver that allows the creation of virtual network cardson OS X Lion,

    . run GNS 3 on Mac OS X Lion so it can dynamically create virtualnetwork cards,

    . connect virtual machines running in Parallels Desktop 7 or Virtual-Box 4 to your virtualized network,

    . install a protocol analyzer called Wireshark that you can use on yourMac and in your virtualized GNS 3 network,

    . connect your virtualized network to a real network including theinternet and make your virtualized network accessible from yourMac and vice versa.

    Who am I and why do I need this stuff?

    I am a second year Telecom student at ACE Group T University Col-lege at Leuven, Belgium. We use GNS 3 to sniff with a protocol ana-

    lyzer what is going over the line and what is not from a security andnetwork design point of view. Next to this we use it 2 also for the Cisco 2 along with Ciscos Packet TracerCCNA track that is partly embedded in this program.

    Copyright notice

    You may freely distribute, use and modify this note as long as youmention my name when you refer or use this note in one piece or useparts of this note.

    You may freely distribute, use and modify my scripts that are men-tioned in this note as long as you mention my name when you refer oruse it as a whole or use parts of it.

    If you modify the scripts and you think others can also be helpedwith your modications, please notify me so I can update the scripts.

    Can you please give me your MS Word copy of this document?

    No. This is article is created in TeXShop- 64 and typeset in LATEX usingthe Tufte handout style from the MacTeX 2011 LATEX distribution forMac.

  • 8/10/2019 Using GNS3 With VMs on MacOSX Lion

    2/26

    getting gns3 to work on mac os x 10 .7 lion with parallels desktop 7 or virtualbox 4 .1 .2 2

    For the impatient

    GNS3 for Mac can be downloaded at http://www.gns3.net/downloadand runs just ne on itself.If however you want to connect your virtualized network in GNS 3 toone or more virtual machines you need to:

    Run GNS3 with root privileges To let GNS3 communicate with thingsoutside its virtual network, we have to nd a way to run GNS 3with root privileges.

    Use TAP nic driver that comes with Tunnelblick We will use virtualnetwork cards that emulate a nic 3 at OSI layer 3 (IP) and allows 3 nic = network interface card or net-

    work adaptorus to connect the GNS 3 network to a foreign object say a VirtualMachine running in Parallels Desktop or VirtualBox.

    Bridge the nic of your VM with the TAP nic We then bridge the nic of the VM 4 with our TAP nic and are able to connect our VM to the 4 VM = virtual machine

    GNS3 network.

    If you want to connect the GNS 3 virtual network to your real net-work you need to:

    Setup up and congure IP forwarding on your Mac To let our virtualnetwork be able to communicate with the internet, we need to turnour Mac into a router by enabling IP forwarding in OS X.

    Let the TAP nic tap0 be the gateway between the real network and thevirtual GNS 3 network and give tap0 an IP address.

    If you want to be able to sniff with a protocol analyzer what is goingover your real of virtualized network:

    Install Wireshark, an open source protocol analyzer,

    Make sure GNS 3 knows where to nd Wireshark and start snifng.

    Be sure to check out:

    how to save a GNS 3 project with router congurations (if any),

    how my three scripts might help you getting things mentioned onthis page up and running.

    http://www.gns3.net/downloadhttp://www.gns3.net/download
  • 8/10/2019 Using GNS3 With VMs on MacOSX Lion

    3/26

    getting gns3 to work on mac os x 10 .7 lion with parallels desktop 7 or virtualbox 4 .1 .2 3

    Contents

    Who am I and why do I need this stuff? 1Copyright notice 1Can you please give me your MS Word copy of this document? 1

    For the impatient 2Step 1: Install the tun-tap drivers 5

    Why use Tunnelblick? 5

    Step 2: Install GNS3 for Mac OS X 5Step 3: Download my scripts to launch GNS3 5

    Make the scripts executable 6

    Step 4: Install Wireshark 7Step 5: Make sure the preferences are set right in GNS3 7

    Activate the Cisco IOS images 8Step 6: Make a project in GNS3 - Launch GNS3 via the 1gns.sh script 9

    Picking the right components 10Conguring the PCs 11Do I have to create the tap nics /dev/tap1 or 2 rst? 12Congure the router(hardware) 12Connect the nodes to each other 13

    Step 7: Congure the router: dening the subnets 13Step 8: Connecting the VMs to the virtualized network 14Step 9: tap0 up - Connecting the virtualized network to your LAN 16

    Check your conguration 19

    Starting and shutting down GNS 3 with VMs 19In general: when to use what script? 20

    The "GNS3 didnt save my router cong" issue... 21Be smart and verify 21 How to open and save next time? 21

    Setting the IDLE PC parameter 21

    Why Parallels Desktop for Mac? 22Optional: Your Windows Guest OS - some tricks 23

    Use Coherence (Parallels) Seamless Mode (VirtualBox) 23To whom belongs this command line window? - t.bat 23Logging on and shutting down windows guest OSes 23

  • 8/10/2019 Using GNS3 With VMs on MacOSX Lion

    4/26

    getting gns3 to work on mac os x 10 .7 lion with parallels desktop 7 or virtualbox 4 .1 .2 4

    My batch le suite - simple batch les to do simple repetitive things 24

    Do I have to turn off my rewall in Lion to run GNS3? 24

    Help! some of my labels disappear in GNS 24

    HOWTO snifng on your virtual network with Wireshark 25

    Used sources 26

    Software 26

  • 8/10/2019 Using GNS3 With VMs on MacOSX Lion

    5/26

    getting gns3 to work on mac os x 10 .7 lion with parallels desktop 7 or virtualbox 4 .1 .2 5

    Step 1: Install the tun-tap drivers

    We use the tap kernel extension driver that comes with Tunnel- blick. Download Tunnelblick from http://code.google.com/p/tunnelblick/ . Drag the application to your /Applications folderand double click on it to launch it so it will install some stuff. Thetuntap drivers are provided as a kernel extension that we will loadvia a bash script ( 1gns.sh ) later.

    Why use Tunnelblick?

    Tun-tap consists of two separate drivers (kernel extensions) thatprovide two types of virtual network interface cards:

    a tun driver - emulates a nic on OSI layer 2 (ethernet),

    a tap driver - emulates a nic on OSI layer 3 (IP).

    OS X does not come with tuntap drivers as LINUX does, so we haveto install them ourselves. If you Google a bit, you probably ndhttp://tuntaposx.sourceforge.net/ . The only problem is that thisdriver does not seem to work well on Mac OS X 10 .7 Lion.

    Tunnelblick, an openVPN GUI client for Mac uses tun-tap too, and Q How many tap nics can you create?A 10: tap0 to tap9 .at the time of writing, it uses its own Lion compatible tun-tap driver.

    In this note, we will only use the tap driver.

    Step 2: Install GNS3 for Mac OS X

    Download GNS 3 from http://www.gns3.net/download . Luckily, we

    can download a binary package that will work on Mac OS X Lion.I downloaded the GNS3 v0.7.4 DMG package . Although the folks atGNS.net mention that this 0.7.4 version is an experimental version forMac, it does run stable enough to be useful on Mac OS X Lion.

    Step 3: Download my scripts to launch GNS3

    Download my scripts from http://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.zip . When you unzip I rst used the bridge.sh script from

    the guy behind DefaultrouteUK who isa CCIE but decided later to split it up inthree parts and change a few things.

    the package, you will nd three les:

    1 gns.sh to load the tap kernel extension driver, modify some permis-sions to let DynaMIPS run with root privileges and launch GNS 3with root privileges 5. 5 GNS3 needs to run with root privi-

    leges to be able to create the virtual tapnics dynamically in Mac OS X.2 tapup.sh to bring the tap nics 0 true 2 up.

    A few notes I have to make here:

    http://code.google.com/p/tunnelblick/http://code.google.com/p/tunnelblick/http://code.google.com/p/tunnelblick/http://tuntaposx.sourceforge.net/http://tuntaposx.sourceforge.net/http://www.gns3.net/downloadhttp://www.gns3.net/downloadhttp://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.ziphttp://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.ziphttp://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.ziphttp://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.ziphttp://dl.dropbox.com/u/9671505/GNSonMacOSXLion/GNS3onMacOSXLionScrips.ziphttp://www.gns3.net/downloadhttp://tuntaposx.sourceforge.net/http://code.goog