When you’re running multiple hypervisors in your lab you may want to separate them and isolate the networks. Still you want all of them to access internet.
In my home lab I’m running Citrix XenServer 6.5, Microsoft Hyper-V3 and VMware vSphere 5.5. My lab environment are being rebuilt from scratch many times per year so I tend to automate as much as possible.
So all my hypervisors are running on the 10.110.88.x network. In this blog post I’ll show you how to create isolated networks, a virtual router and the best way to do RDP to the VM’s on the isolated network.
Now let’s configure a Virtual Router based upon Windows 2012 R2 and the Routing and Remote Access Role. The only prerequisite are that you name your network interfaces as Internal and External. The rest is handled by the Powershell script. Let’s take it step-by-step.
Check that you have internal and external access on your Router VM.
Set the IP address on the internal network interface. This is going to be the Router IP address that you use as a DNS forwarder and in DHCP.
Install the Routing and Remote Access Role.
Configure the NAT Gateway.
Verify the configuration by launching Routing and Remote Access.
Configure DNS Forwarder to point to your Router Address.
Configure DHCP Scope Options.
The Powershell script:
Get-NetAdapter | Select Name,MacAddress
Get-NetAdapter -Name Internal | New-NetIPAddress -IPAddress 192.168.1.1 -AddressFamily IPv4 -PrefixLength 24
Install-WindowsFeature Routing -IncludeManagementTools
Install-RemoteAccess -VpnType Vpn
cmd.exe /c "netsh routing ip nat install"
cmd.exe /c "netsh routing ip nat add interface $ExternalInterface"
cmd.exe /c "netsh routing ip nat set interface $ExternalInterface mode=full"
cmd.exe /c "netsh routing ip nat add interface $InternalInterface"
That’s how you configure a Virtual Router with Powershell. All credits goes to the awesome Johan Arwidmark and his blog post Install a Virtual Router based on Windows Server 2012 R2 using PowerShell.
So how do I connect through RDP to the private isolated 192.168.1.x network from my home network 10.110.88.x? Well Microsoft RDP now supports RDP-in-RDP, but then I would need to RDP to the Router VM which has an 10.110.88.x address and then manually do RDP to the rest of the VM’s on that network. That’s a lot of work!
When I launch a connection to my isolated network, it will automatically connect through RDP to my Jump Host (the Virtual Router) and then create a new RDP session to the VM in question. Without me lifting a finger!