Using vApp Network fencing

In this recipe, we will explore vApp Network fencing. We will see how we can use this feature.

Getting ready

To play with fencing, we need to have a Direct Organization Network (or isolated, but that's not as much fun) and some VM templates.

How to do it...

  1. Create a new vApp using the How to do it... button.
  2. Add two VMs to the vApp and name them.
  3. Connect the VMs to the Direct Organization Network using the Static - IP manual option.
  4. Set the manual IPs outside the range of the Static IP Pool for each VM.
  5. In the Configure Networking section, click on Fence vApp, as shown in the following screenshot:
  6. Finish the vApp creation.
  7. Deploy the vApp.
  8. After the vApp is deployed, double-click back into it and go to Virtual Machines:
  9. See that the VMs now have an internal and external IP. To communicate with the VMs, use the external IP.
  10. Now stop the vApp.
  11. Right-click on the vApp and choose Copy to....
  12. Name the vApp and click on OK.
  13. After the vApp has been copied, start both vApps (the original and the copy).
  14. Check the IPs of all VMs in all vApps.

How it works...

You may know vApp Network fencing from VMware Lab Manager, but the vCloud implementation is different.

Fencing allows you to re-use the same IPs and MAC addresses in multiple vApps. This is rather different from using an isolated network, as fencing allows full connection to the fenced VMs just with different IPs, as you can see in the following diagram:

The VMs inside the fence communicate using the internal IPs (.20 and .21), but appear to be using the external IPs (.100 and .101) for any communication to the outside. Communication is allowed out, but not in.

Fencing allows one to deploy a vApp with the same content multiple times and still use them without changing their IP or MAC addresses. However, you need to understand that the VMs inside are the same, meaning that if you have an Active Directory inside the vApp, things will go wrong. The AD will advertise itself with its internal IP that is not accessible via the outside; also, it will receive AD advertising from the original AD outside the vApp (the AD you copied it from) with the same IP.

What happens in the background is that for each fenced vApp, a new Edge device is deployed and configured. The Edge has the same name as the network; however, the HREF (the number behind the name) is different; refer to the following screenshot (compare the Names):

There's more...

Because we are again using a vApp router (Edge), we can have a look at the settings by performing the following steps:

  1. Right-click on the Organization Network in the vApp.
  2. Choose Configure Services.
  3. Click on Firewall and then on NAT.

Have a look at the Firewall and NAT values, as shown in the following table:

This setting allows the VMs in the fence (.20 and .21) to be reached from the VMs on the outside using the public IPs (.100 and .101). However, you should be rather careful with a configuration like that. Maybe opening up only certain ports for the inbound connection is a better idea.

In addition to all this, you can configure the external IP (DNAT) of each VM by performing the following steps:

  1. Right-click on the Organization Network in the vApp.
  2. Choose Configure Services.
  3. Click on NAT.
  4. Click on the DNAT rule and click on Edit. You should see the following screen:
  5. Change the Mapping Mode value to Manual and enter the IP under External IP.
  6. Click on OK and again on OK to activate these settings.