Gns3 And Vmware Lab On Ubuntu Linux

In this module we are going to setup, configure and test an entire network topology on your stand-alone PC using Virtualization. This article is useful for Learning and testing Networks, Also helpful for making home labs for industry certification exams such as Cisco and Linux certifications.

In this module we will -

  1. Install GNS3 and VMware on LInux.
  2. Configure Cisco Router.
  3. Use Wireshark and PackEth test and troubleshoot the network.

Things that you’ll need -

1. Licensed version of VMware Workstation (get 30-days trial version from http://vmware.com/
2. Graphical Network Simulator – GNS3 http://gns3.net/
3. Cisco IOS that are supported by GNS3/dynamips.
4. Damn Small Linux – DSL http://www.damnsmalllinux.org/download.html/

Installing GNS3 on Ubuntu Linux:

  1. Download GNS3 source package on the Desktop
  2. Install GNS3 as follows -
  3. Extract the contents of the .tgz file using the command
  4. tar -xvf ~/Desktop/<file_name>.tar.gz

    (eg. tar -xvf ~/Desktop/GNS3-0.7-src.tar.gz)

  5. Login as root using the command
  6. sudo su
  7. It is always a good practice to have a static path configured for all the GNS3 files and projects. I use /home/gns3/ directory.
  8. mkdir /home/gns3

    Move the extracted files to /home/gns3/

    mv GNS3-0.7-src/* /home/gns3/

    To make gns3 available as an executable binary -

    echo "gksu /home/gns3/gns3" > /bin/gns3
    chmod 777 /bin/gns3
  9. Now gns3 can be launched by using the command gns3 anywhere in the terminal and is launched with super-user previlidges.
  10. Now install dynamips using the command
    sudo apt-get install dynamips
  11. Installing VMware Workstation:

    The VMware workstation .bundle file is installed by using the command

    ./vmware.bundle

    The VMware workstation is installed with all the default options. We are using VMware workstation v7.

    Launch VMware Workstation as super user using the command

    gksu vmware

    As we can see in the above network diagram we need 4 different Virtual networks for different hosts on the network vmnet2, vmnet3, vmnet4, vmnet5.

    The virtual network editor is opened by clicking on Edit → Virtual Network Editor

    The Various Host-only VMnet adapters are added -

    The new virtual Network Adapters could be verified by using the command -

    /sbin/ifconfig

    Note: The Virtual Network Adapter vmnet1 and vmnet8 are used for Bridge and NAT communication respectively and should not be modified.

    After clicking on save, various virtual network adapters are created as shown in the picture below

    • vmnet2 – 192.168.2.0 (Use local DHCP, Connect to Host Virtual Adapter)

    • vmnet3 – 192.168.3.0 (Use local DHCP, Connect to Host Virtual Adapter)

    • vmnet4 – 192.168.4.0 (Use local DHCP, Connect to Host Virtual Adapter)

    • vmnet5 – 192.168.5.0 ((Use local DHCP, Connect to Host Virtual Adapter)

    Creating a Virtual Machine :

    Four Virtual Machines are created on VMware workstation as follows -

  1. Download Damn Small Linux .iso file.
  2. Open VMware workstation as super-user.
  3. Click File → New → Virtual Machine
  4. Select Custom(Advanced)
  5. Chose the highest Hardware Compatibility
  6. Select the Installer Disk Image (ISO) and use the damn small linux iso path
  7. Chose Linux and ‘Other linux 2.6x Kernel’ from the drop down list as version.
  8. Rename it as dsl2 and specify the path to save the virtual machine.
  9. Select the No. of processors and cores.
  10. Use 100 Mb Memory space(RAM).
  11. In network Connection Select “Do not use a network Connection”.
  12. In I/O adapter type, use recommended LSI Logic.
  13. Select Create New Virtual disk.
  14. Virtual Disk type as SCSI.
  15. Maximum Disk size at 8 GB.
  16. Keep the default Disk file name.
  17. Now click on Customize Hardware and do as follows -
  18. Click on Add
  19. Select Network Adapter
  20. Choose “custom: Specific Virtual Network” and select the vmnet2.
  21. Click on finish.
  22. Click on Save.
  23. Select “Automatically power on this virtual machine after creation” and click Finish.
  24. The Virtual Machine is now powered on.
  25. Any other operating system can be used instead of Damn Small Linux, But since DSL is a live CD, the memory usage is considerably low. To interact with the guest virtual machine, use ctrl + g and to interact with the host machine use ctrl+alt. The virtual machine is stopped by ctrl + E.

    Similarly 4 virtual machines are created but with different Virtual Network Adapters(vmnet).

    DSL1 = 192.168.2.0/24 (vmnet2)
    DSL2 = 192.168.3.0/24 (vmnet3)
    DSL3 = 192.168.4.0/24 (vment4)
    DSL4 = 192.168.5.0/24 (vmnet5)

    Configuring GNS3:
    GNS3 is launched using the command

     gns3.

    Go to Edit → Preferences

  1. Create directories project, images, capture beneath /home/gns3 directory.
  2. We keep /home/gns3/project as project directory for all our projects and /home/gns3/images for all the cisco IOS in the general settings.
  3. In the dynamips section the dynamips executable path is set to /usr/bin/dynamips. Click on test to verify if dynamips is working.
  4. /home/gns3/capture for all the wireshark captures.
  5. Qemu for asa firewall path is entered as /home/gns3/qemuwrapper/qemuwrapper.py

Now copy the Cisco IOS into the /home/gns3/images directory. Go to edit → IOS images and Hypervisors and add the cisco IOS image file.

Now we are ready to create the topology.

Drag and drop the two routers and four cloud nodes into the work space. Now configure the router and clouds as shown in the snap shots and connect them.

Configuring RIP protocol to enable routing between the two routers as follows:

Open telnet console session for Router1 and Router2 -

  1. Answer ‘No’ for initial configuration option.
  2. ‘>’ is non-privileged mode, type ‘enable’ to enter into privileged mode ‘#’.
  3. Type ‘show ip int brief’ to get the brief list of all the interfaces present on router.
  4. To configure the router type ‘config terminal’
  5. To configure the interface IP address use the command ‘int fa <intface_id>’ Eg. Int fa 0/0
  6. ‘Ip address <ip add> <subnet_mask>’ to assign the ip. Eg. ip address 192.168.1.1 255.255.255.0
  7. Similarly assign to all the three interfaces.
  8. Note: use the command ‘no shutdown’ on all the interfaces and ‘exit’ command to come back to the global configuration mode.
  9. All the interfaces of both the routers must be assigned appropriate IP addresses and ‘no shutdown’ command is a must.
  10. Type ‘do write’ to save the configuration. You need to do this often to save the configuration so that it stays during next start-up.

Now to start routing.. Use the following commands in global configuration mode:

  1. Router rip’ to enable RIP routing.
  2. ‘Version 2’ to use RIP v2
  3. ‘Network <ip address>’ to enable rip on those particular IP configured interfaces.
  4. Do these steps on both the routers and the routing will start.

Note:

you may have to set the default gateway for the Virtual boxes to the router’s interface IP.
You can also add Ethernet Switches provided in the GNS3 to build switched networks.

Now we can sniff on the router using Wireshark on the interfaces by right clicking on the router interface and clicking on capture. The routing issues can be easily debugged.

Thus now the Virtual linux boxes with different subnets are able to communicate with each other.

To take a step further, you can use PackEth package to frame a packet and send it to the router using the host virtual interfaces. Various protocol hacks could be performed on the router and the guest virtual machine.


This post is tagged , , , , , , , , , , , , ,

  • Brad
    Do I have to use vmware workstation 7.1 for 189 or will free vmware server to do the job?
  • you can use vmware server too.. :)
  • Brad
    Can I use workstation or free server to do the job?
  • Good one, Can you give one post for PackEth as well ?
  • ya.. sure will do that. :)
blog comments powered by Disqus

Categories