A Step by Step Guide
Whether you are a Systems Administrator looking for a way to simulate your current environment for testing or upgrade purposes or a student who is looking to create a lab for study purposes the ability to simulate a network connection over a WAN link is something that used to be thrown into the too hard basket. However with the prevelance of virtual computing and software router solutions such as those available through VMWare and Vyatta this is now a scenario that is easy to implement with minimum cost.
The following tutorial is a step by step guide on how to setup a virtual WAN using VMWare and Vyatta however the steps can be easily modified for other Virtual hosting platforms.
The only prerequisites needed are a server with sufficent hardware specs to run ESX or ESXi version 3i through 4i. and enough storage space to hold the Virtual Machines. This tutorial also assumes you have installed your version of ESX onto the host and are ready to create the Virtual infrastucture.
The scenario in this tutorial is a network consisting of a main site and 2 regional sites connected over a WAN. The main site is called London and the 2 regional sites are called Sydney and Tokyo.
Step 1 Virtual Switches
Create a virtual Switch for each site with no bindings to the hosts adapter we will let ESX handle all the networking internally. This is done by doing the following from Virtual Centre Manager (steps may differ slightly depending on your version of ESX)
Select Host -> Configuration Tab -> Networking -> Add Networking
Check Virtual machine option -> Next
Check Create Virtual Switch option -> Uncheck network adapter binding -> Next
Give the Virtual Switch a meaningful name (in our scenario we start with London) -> Next -> Finish
Do the same to create the other 2 Virtual Switches. This forms the basis of the network. Each Virtual Switch becomes a logical representation of a network segment.
At this stage you can add Virtual Servers to these Virtual Switches. as an example you could place 2 domain controller VM in the Main Site and one in each regional side in preparation to create an Active Directory Domain.
Step 2 Routers
The next step is to create the routers that will be responsible for routing traffic between these 3 sites(Virtual Switches). To do this we need to create Virtual Routers and the easiest way we have found is to use Vyatta. Vyatta is revolutionizing the networking industry by delivering a software-based, open-source, network operating system that is portable to standard x86 hardware as well as common virtualization and cloud computing platforms. They have a freely downloadable template already configured for ESX and ESXi that can be imported to your host and used to create Virtual machines capable of acting as routers and firewalls.
Vyatta can be downloaded here
Once you have downloaded Vyatta and imported it your host create a virtual machine from the template and start it up. You will be presented with a simple setup screen where you configure the routers basic properties. All you need to do here is ensure you create 2 nics for each router to handle the LAN and WAN side of the device.
You need to create one router per Virtual Switch
Step 3 Routing
The last step is to configure the Virtual Routers to route traffic between them. This is a simple task of assigning I.P Adresses to the LAN and WAN Interfaces of the Virtual Routers and configuring a routing Protocol. When configuring the I.P Addresses remember basic I.P adressing rules to ensure the routers can see each other. Below is an example of a correct addressing Scheme.
Virtual Router LAN Interfaces
Virtual Router WAN Interfaces
Configuring the I.P Adresses is as simple as going to the CLI (Command Line Interface) on each Virtual Router and typing the following where xxx is the I.P Address (remember to set 1 LAN and 1 WAN interface)
set interfaces ethernet eth0 address xxx.xxx.xxx/24
set interfaces ethernet eth1 address xxx.xxx.xxx/24
To configure the routing protocol type the following commands
set protocols rip interface eth0
set protocols rip interface eth1
set protocols rip redistribute connected
Once this is done to all 3 routers they should be able to ping each other.
As long as all VM's on a Virtual Switch are configured in the same I.P range and point to the LAN interface of the Vyatta router as the gateway then you should be able to ping across Virtual switches to VM's on the other Virtual Switches.
There are a multitude of other commands you can use on the Vyatta routers to configure them but this is beyond the scope of this tutorial.
Congratulations you have setup a virtual WAN