You are here:   Research
Register   |  Login
The quickest way to find articles is to use the below search option.

However, if you go to the end of this page, you also find the Blog archive (calendar format) that allows for browsing of older articles.

Search:

Using a virtual router for your lab and test environment

Dec 13

Written by:
12/13/2012 9:29 AM  RssIcon

When build lab and proof-of-concept solutions in a virtual environment it's very useful to also have a virtual router to enable multiple networks to connect, and to simulate a larger environments.

Depending on virtualization platform you can use built-in network configurations to route, and bandwidth-limit network traffic. In this article you learn about creating a virtual router that works with all modern virtual platforms. You have two different options in this article:

  • Option 1 is using a Windows Server 2012 based router.
  • Option 2 is using a Linux (Vyatta) based router.

Update 2014-05-04: There is now a video available for Option 1 in this article.

Scenario

The step-by-step guides in this article configure a virtual router for the fictive ViaMonstra network. For a full IP plan for ViaMonstra network, see http://viamonstra.com/?page_id=25

ViaMonstra has the following three local networks:

New York: 192.168.1.0/24
Stockholm: 192.168.2.0/24
Liverpool: 192.168.3.0/24

In addition ViaMonstra also have Internet access. In a real world (physical) network you would have many routers, but in a virtual environment where all virtual machines are running on the same host you only need one router. This also means that in this guide there are three internal virtual networks (virtual switches in Hyper-V), and one external. In the step-by-step guides I assume you have created the following virtual networks:

Base Configuration

  1. Create the following virtual networks (virtual switches)
    1. External (connected to physical network adapter of your host)
    2. New York (Internal network)
    3. Stockholm (Internal network)
    4. Liverpool (Internal network)
  2. Create a virtual machine named GW01 with four network adapters (1 GB RAM and 60 GB disk) and use following network configuration
    1. Connect network adapter #1 to the External virtual network
    2. Connect network adapter #2 to the New York virtual network
    3. Connect network adapter #3 to the Stockholm virtual network
    4. Connect network adapter #4 to the Liverpool virtual network
  3. On the virtual machine settings, make a note of the Mac Address for each network adapter. In my setup I had the following:
    1. Adapter #1 (External): 00:15:5D:83:40:21
    2. Adapter #2 (New York): 00:15:5D:83:40:22
    3. Adapter #3 (Stockholm): 00:15:5D:83:40:23
    4. Adapter #4 (Liverpool): 00:15:5D:83:40:24

GW01 created with four network adapters.

 

Option 1 - Using a Windows Server 2012 VM with Routing and Remote Access.

  1. Install Windows Server 2012 on GW01 and set the computer name to GW01.
  2. Using Network Connections, configure the networks to the following (use the Mac Address noted earlier to find correct adapter):
    1. Adapter #1:
      1. Name: Internet
      2. IP Address: DHCP
    2. Adapter #2:
      1. Name: New York (192.168.1.0)
      2. IP Address: 192.168.1.1/24
    3. Adapter #3:
      1. Name: Stockholm (192.168.2.0)
      2. IP Address: 192.168.2.1/24
    4. Adapter #4:
      1. Name: Liverpool (192.168.3.0)
      2. IP Address: 192.168.3.1/24

Networks configured in Network Connections.

 

  1. Using Server Manager, add the Remote Access role. Accept the default settings, but on the Role services page also select Routing.
  2. Using Routing and Remote Access, right-click GW01 (local), and select Configure and Enable Routing and Remote Access.
  3. Use the following settings for the Configure and Enable Routing and Remote Access Setup Wizard:
    1. Configuration:
      1. Network address translation (NAT)
    2. NAT Internet Connection:
      1. Select the Internet network interface.

         

Selecting the Internet network interface.

 

  1. Network Selection:
    1. Select the New York network
  2. Name and Address Translation Services
    1. I will set up name and address services later
  1. Done!

    

Option 2 - Using the Vyatta 6.5 Open Source Router.

You can download the free version of Vyatta Open Source Router fon vyatta.org (http://www.vyatta.org/downloads) and a community fork (VyOS) on http://vyos.net/wiki/Main_Page. Note that the free version does not come with a UI for configuring the router, only command line and config files.

Credit goes to Stefan Stranger for writing the initial guide (for version 4.0).

  1. If you want you can reduce the GW01 virtual machine memory to 128 MB. 1 GB is really overkill for Vyatta J
  2. As far as disk goes you can run Vyatta on 1 GB drive (Vyatta recommends 2 GB for production), but I normally keep the 60 GB disk anyway.
  3. Install Vyatta 6.5 by booting the GW01 virtual machine on the vyatta-livecd-virt_VC6.5R1_i386.iso file

Booting the GW01 virtual machine on the vyatta-livecd-virt_VC6.5R1_i386.iso file

  1. Log on as vyatta, using the vyatta password.
  2. Start the installation by running the following command (was install-system in earlier versions)
    1. install system
  3. The setup options are quite self-explanatory, but say No to create a RAID volume (Vyatta thinks you have two drives, when you really only have one).
  4. Once setup is completed, shutdown the VM, eject the CD, and restart the GW01 virtual machine.

    The command for shutdown is: poweroff

  5. Note: You did shutdown the VM and eject the CD, right? (otherwise any changes made later will be lost)
  6. Login and configure the network adapters by running the following commands:
    1. configure
    2. set interfaces ethernet eth0 address dhcp
    3. set interfaces ethernet eth1 address 192.168.1.1/24
    4. set interfaces ethernet eth2 address 192.168.2.1/24
    5. set interfaces ethernet eth3 address 192.168.3.1/24
    6. commit
    7. save
    8. exit
  7. Now you can review the network adapters by running the following commands
    1. sudo ifconfig | more
    2. Show interfaces Ethernet

  1. Configure the NAT configuration by running the following commands:
    1. configure
    2. set nat source rule 10 outbound-interface eth0
    3. set nat source rule 10 source address 192.168.1.0/24
    4. set nat source rule 10 translation address masquerade
    5. commit
    6. save
    7. exit
    8. reboot
  2. Done!

Happy Routing / Johan

9 comment(s) so far...


Gravatar

Re: Using a virtual router for your lab and test environment

There seems to be something missing under Option 1. Between 3b "Select the Internet network interface" and the next part which says "Select the New York network". What's missing between those two parts?

As for Option 2, I got it set up exactly as described, and can ping out to the Internet from the Vyatta router. But I can't get any of my virtual machines on my only virtual (New York) subnet to connect to the Internet. I'm using the Hydration Kit from the SCCM SP1 book and have DC01, CM01, PC0001, and PC0002 built. But none of them will go through the Vyatta router and out to the Internet. Help!

By kringle777 on   4/30/2014 10:28 AM
Gravatar

Re: Using a virtual router for your lab and test environment

Option 1 is not using Vyatta, it's using Windows Server 2012, and that setup is pretty straight forward... First you select NAT, yhen what interfaces that are used... Here is an old video (for 2008 R2) www.youtube.com/watch?v=Eb_7wWFO600 but the main topics still applies.

/ Johan

By Arwidmark on   5/1/2014 6:35 AM
Gravatar

Re: Using a virtual router for your lab and test environment

I tried both options. What I'm saying is that your instructions are somehow missing something in Option 1. Check it out. Between the selecting of the Internet network interface and the selecting of the New York network. It doesn't make sense, sorry.

After that, I tried Option 2. Thanks for the video link. Maybe it will point me in the right direction.

Chris

By kringle777 on   5/1/2014 9:15 AM
Gravatar

Re: Using a virtual router for your lab and test environment

Hey Chris,

I verified the instructions, and couldn't find anything missing in them... That being said, I decided to record the steps when verifying, so I have published (today) a new video that will guide you through the whole setup: youtu.be/i3tovlbf46k

/ Johan

By Arwidmark on   5/4/2014 5:05 PM
Gravatar

Re: Using a virtual router for your lab and test environment

Hello.

I followed option 1 but i realized that my IP address scheme on my host machine is the same as the one in the book, and this lab. Is there a way around this? Every time i boot up the GW01 I lose internet access on my host machine. Also i am unable to ping between DC01 New York Site, and DC03 Stockholm site. Should i just point all my vm's towards the outside interface and not bother with the virtual router?

Thanks

By ecabrera81 on   6/4/2014 7:46 AM
Gravatar

Re: Using a virtual router for your lab and test environment

As long as you don't mind DC01 handling DHCP on your home network, that will work.

I would just change the home network to something that is not commonly used for lab and test environments, like 192.168.10.0/24

/ Johan

By Arwidmark on   6/9/2014 2:31 AM
Gravatar

Re: Using a virtual router for your lab and test environment

Never mind i worked it out. It seems a few of the NIC adpaters for DC01, MDT01, and PC001 got corrupted or just needed to be reinstalled in Hyper-V Did the reinstall, and setup the router via 2012R2 as above and all is working fine now. I am able to ping to DC01 over to DC03 Stockholm.

By ecabrera81 on   6/9/2014 11:13 AM
Gravatar

Re: Using a virtual router for your lab and test environment

I have followed the instructions but somewhere I'm having an issue. I can ping the DC from GW01 but neither my DC or CM server can reach outside. I can also ping GW01 from both the DC and the CM server. I'm not sure what is wrong.

By zak.godwin@outlook.com on   8/19/2014 11:49 AM
Gravatar

Re: Using a virtual router for your lab and test environment

Hi Zak,

Difficult to say, but most time people mix up the network cards in the virtual machine. Since it's only takes about ten minutes to redo the entire config I often recommend to start over from scratch again. Often quicker than to troubleshoot.

/ Johan

By Arwidmark on   8/20/2014 6:35 AM