Virtualizing our Testlabs

The advantages of virtualizing are well known, so I won’t go into much detail here. Personally, I have to use a lot of virtualization, especially when studying and testing. Nowadays we can virtualise or emulate anything. In this article I outline a menthod I used to emulate both cisco routers using GNS3, as well as some linux servers with VirtualBox. I then proceed to allow the two to interact, that is, the virtual linux servers are connected to the virtual cisco router, and that cisco router in turn is connected to a physical sonicwall. The topology is outlined below:

I made a quick screencast of how to set this all up, which you can view here. For quick reference I include a test guide below. Enjoy!

  • Everything to left of the sonicwall is virtualized
  • You need to create two loopback adapters:

Loopback # 1 : call this “to physical”
Loopback # 2 : call this “to virtual”

  • Bridge “to physical” to the physical interface (be careful, you can only use bridging once in the windows OS. It also slows down the net connection… so use it wisely)
  • Install GNS with IOS images
  • Setup the following:

Where:

C0 is bound to the “to physical” loopback adapter
C1 is bound to the “to virtual” loopback adapter

-Configure both interfaces of the cisco as you desire
-Configure routing on both the cisco and sonicwall to prevent IP spoofs

  • Install VirtualBox
  • Install the two images of ubuntu
  • Bridge the ubuntu machines to the “to virtual” loopback
  • Setup the IP config of the machines as per usual
  • At this point, the cisco should be able to ping sonicwall and the internet with no problems
  • However, ubuntu machines should be able to ping cisco only.
  • When trying to ping ubuntu -> WAN, ping request paths correctly, but reply goes over to the physcial interface of the bridge rather than over the logical interface of the bridge from where it came from
  • Add a static route on the physical interface to point to the ciscošŸ˜‰
–Ā NOTE : enabling IP router on the phycical machineĀ may also be necessary in some cases
Update
Lately I downloaded the new version of GNS3 and noticed a new “QEMU host”. Looks like you can run a virtual host using qemu right from within GNS3….. you gotta love that program, seriously, the GNS3 developers are amazing… kudos!!!