Infrastructure Ramp: VM Network

In the past, i have either developed on a standalone SharePoint box, or have had a sysadmin create a dc etc for me to develop against. I am trying to ramp up my infrastructure skills atm, so am setting up a vm based farm containing a dc, sql and SharePoint (note that initially i will have one vm for the sql and dc, and one for SharePoint, due to memory considerations). Each vm will have access to the internet, using the host as the gateway (via ICS / Loopback Adapter) and external machines will be able to access http sites on the web server.

Note this article does not go up to the installation of SharePoint – it just talks about setting up the domain, and network infrastructure, although iis is set up at the the end for testing purposes.

Below are my rough notes for future reference…

 

Network Overview

First off, I set up two new server 2008 vms, one to be a SQL / DC box, and one to eventually be a SharePoint box (referred to as Web in this article). The VMs NICs were assigned IP addresses in the 192.168.0.X range.

I also wanted to allow the vms to see the internet, and each other, as well as for external machines to see them. Ideally the VMs should be externally accessible through host headers. To permit this, the host machine containing the VMs needed to be set up with a loopback adapter and internet connection sharing (ICS) with port forwarding.

The network settings on the host, sql/dc vm and the web vm will be as follows:

Host (loopback adapter)

IP Address: 192.168.0.1
Subnet Mask: 255.255.255.0
Default Gateway: (left blank)
DNS Server: 192.168.0.2

SQL / DC VM
IP Address: 192.168.0.2
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.1
DNS Server: 127.0.0.1

Web Front End:
IP Address: 192.168.0.3
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.0.1
DNS Server: 192.168.0.1

 

Domain Creation

I then followed this article to set up a dc, and then joined my Web box to this newly created domain.

http://www.windowsreference.com/windows-server-2008/step-by-step-guide-for-windows-server-2008-domain-controller-and-dns-server-setup/

Note that i disabled ipv6 on the network adapter, to facilitate less complex setting up of the domain.

 

Host Machine – Loopback adapter

A loopback adapter was set up on the host machine to allow the host to have an ip on the VM network, and also act as the gateway.

  • To add the loopback adapter in vista, go to start -> control panel -> add hardware. A dialog will appear.
  • Select “Install the hardware that I manually select from a list (Advanced)” and click next.
  • Select “Network Adapters” from the subsequent list and click next
  • Select “Microsoft” from the list of manufacturers, and the “Microsoft Loopback Adapter” from the subsequent list of network adapters. Click next
  • Click next on the “wizard is ready” dialog. This will install the loopback adapter.

Once installed, the loopback adapter is assigned an ip of 192.168.0.1 that cannot be changed – hence vms in my virtual network also need to use this ip range. I set the dns server as follows, so that we can resolve the machine names on the virtual network from the host (note that this is not required, but gave me an extra option for testing).

IP Address: 192.168.0.1
Subnet Mask: 255.255.255.0
Default Gateway: (left blank)
DNS Server: 192.168.0.2

To set this, navigate to Control Panel\Network Connections and select the newly added loopback adapter. Double click it, then click properties, then select Internet Protocol Version 4 (TCP/IPv4) and click the properties button.

When this is complete, the host machine is effectively on the same network as the vms, in addition to any other networks that it may belong to. To allow vms in this virtual network to now use the host machine as a gateway, we must configure Internet Connection Sharing (ICS).

 

Host Machine – Internet Connection Sharing (ICS)

To allow the virtual network to connect to the internet, ICS must be set up on host machine network adapter that provides the internet connection. To do this, select this network adapter (from Control Panel\Network Connections) and click properties. On the subsequent dialog box, click the “Sharing” tab, and ensure that the “Allow other network users to connect through this computers internet connection” is checked. Also, if there are multiple networks present, select the “home networking connection” to be whatever the name of your loopback adapter is (e.g Local Area Connection 2).

 image

Optional: configure port 80 to forward to webserver vm
In addition to allowing my vms to connect to the internet, i also external requests to the host machine on port 80, to be forward to my webserver vm. To do this, i clicked the “settings” button from the above dialog.

I then selected “Web Server (HTTP)” and clicked the add button

 ics2_2

I then set the ip address to be that of my vm webserver (e.g. 192.168.0.3).

 ics3_2

 

Configure Virtual Machines to use Loopback Adapter

Each VM was then configured to use the new loopback adapter from the virtual machine settings dialog (note that each vm needs to be rebooted for the loopback adapter to show, and for the vms to see each other they must all use the same adapter).

 vm_networkadapter_2

Note that the network adapters in the VMs were set with the settings described in the network overview.

 

DNS Setup for Testing / Host Headers

I had a test machine on my home network, namely 192.168.1.67. I wanted this to access http sites on my vm network (as an external test box). To facilitate this, i set the host  file on that box at C:\windows\system32\drivers\etc\hosts to point to the ip address of the host machine – e.g. 192.168.1.69. for the domain sp.rnowik.com. I did not make any other changes to this, but ideally it would lookup dns from my vm network dns server (although i think i would need to configure ics on the vm host box to forward dns requests). Anyway, with it set up as above, it allowed me to test my network externally.

As a dns server was also installed when the virtual domain was set up, I added a new zone and host to this to allow the vms and host to be able to resolve the host header (e.g. sp.rnowik.com) see the screenshot below.

 dns_2

Note that I will probably come back and revisit the dns setup as another learning exercise.

I also installed iis onto the virtual webserver and added a site to port 5000. I configured a host header for this site to accept sp.rnowik.com on port 80.

Following this, I was able to view the site through each vm, the host machine and the test machine (describe above), proving that the setup worked.

 

Related Links

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>