In this tutorial I will show one method of routing between multiple virtual host-only networks in VMware Workstation 8. This can be useful for simulating a large multi-site network in a lab environment at little cost. In order to do so, we will be using Vyatta [vee-ah-tah] Network OS and simulating the following simple 3 site network.
Step 1 -Create Virtual Networks
This tutorial assumes you already have your VM’s created, so we will jump right to the networking.
-In the VMware Virtual Network Editor, create an interface for each virtual network you wish to simulate and route. For my example, I will need 2 interfaces for each site. One for the LAN interface and one for the WAN interface.
-Edit > Virtual Network Editor > Add Network. I have setup my virtual networks as follows.
Step 2 – Create Vyatta VM
I will be using Vyatta 6.2 and working from the CLI (command line interface) and also showing you how to enable the GUI web interface. Vyatta 6.3 is the latest distribution since posting and now requires you to have a paid subscription to access the web interface. If the web interface does not interest you, use the latest version.
-Once you have downloaded the Vyatta LiveCD, you will need to create a new VM.
-Open VMware > File > New Virtual Machine > Typical configuration > select the Vyatta ISO as the Installer Disc Image > Vyatta is Debian based Linux OS, Debian 6 works fine for Guest OS > Give a name and location for the VM > 2GB disk space is enough for Vyatta > Choose “Customize Hardware” > You need only give Vyatta 512MB of RAM > Finish
-Now you will need to install the Vyatta OS. Once the CLI finishes loading, log in with the default credentials. Username: vyatta Password: vyatta (Note: the password will not show as you type).
-Type ‘install-system’ and press enter (no quotes) to start install process.
-Type ‘Y” to continue install.
-Vyatta will scan the drives and ask how you would like to create the required root partition. I will choose ‘Auto’.
-If you only have one drive, choose the recommended one. In my case ‘sda’.
-It will warn you any existing data on the drive will be lost of you continue. Since I have nothing on this drive I will enter ‘Y’.
-You will then be asked how big of a root partition you want to create. I will only be using this drive for Vyatta, so will allocate all available space.
-Choose to copy the recommended configuration files to the drive. The path is provided in the [brackets].
-You will then be prompted to change the default Vyatta admin password. You will need to remember this in order to log in to the CLI or web interface.
-Select which drive for the GRUB boot loader.
-Once the GRUB is configured, we will want to shutdown the VM so the virtual interfaces can be added. To shutdown, simply type ‘shutdown’ and hit enter. Vyatta will confirm that you want to do so, choose Yes.
Step 3 – Configure the Routers
-With the Vyatta VM shutdown, you will want to add all the interfaces it will be routing. Remember, in this tutorial I am simulating 3 physical routers. I will need to add the LAN and WAN interface for each router.
-Before powering on the Vyatta VM, make sure you have disconnected the Vyatta ISO disc
-Power on Vyatta and log in using the admin password you set during installation. The user name should still be vyatta.
-Issue a ‘show interfaces’ command and you should see all attached interfaces.
-In order to make any configurations, you must enter configuration mode. To do so, simply enter ‘configure’.
-Now you can configure each router. First assign an IP address to each interface. I will assign mine as follows
eth0 > 192.168.2.2/24 > Site 1 LAN
eth1 > 220.127.116.11/16 > Site 1 WAN
eth2 > 192.168.3.2/24 > Site 2 LAN
eth3 > 18.104.22.168/16 > Site 2 WAN
eth4 > 192.168.4.2/24 > Site 3 LAN
eth5 > 22.214.171.124/16 > Site 3 WAN
-To assign an IP to an interface: set interfaces ethernet eth0 address 192.168.2.2/24
-Assign the proper IP for the remaining interfaces. If you wish, you can also enter a description for the interface: set interfaces ethernet eth0 description “Site 1 LAN”
-After you have configured any IP and descriptions you need, you must issue a ‘commit’ command and a ‘save’ command. If you are done making configurations, enter ‘exit’ to leave configuration mode.
-You can issue another ‘Show interfaces’ command to make sure all the configurations you made are correct.
The last step is to implement a routing protocol. I will use RIP since the hop limitation does not matter in this scenario. Make sure you are back in configuration mode.
-Advertise interface: set protocols rip interface eth0 (issue this command for each interface)
-Redistribute the connected routes: set protocols rip redistribute connected
-Commit and save changes.
Step 4 – Test Routing configuration
At this point you should be able to configure the NIC’s on your other VM’s. Make sure to assign a proper NIC and default gateway to each VM. For example, Server1 in the diagram above will be assigned to VMNet0 and have a default gateway of 192.168.2.2. Once you have the VM’s properly configured you should be able to ping any server at another “site”. If you are having trouble pinging another server, make sure you are allowing ICMP through the firewall or just disable it.
If you wish to make configuration changes from the Vyatta Web Interface, you must enabled HTTPS. This protocol is disabled by default.
-In configuration mode issue the following command: set service https
-Commit and save the change. You should be able to access the Web Gui from any router interface.
This is only a sampling of what you can do with Vyatta. If you wish to learn more visit http://vyatta.org