Using The Loopback Adapter and SharePoint

Here’s how to configure your network for SharePoint development:

Server

On the server (Server 2003), you’ll add the loopback adapter as new hardware.

  1. Go to Control Panel -> Add Hardware
  2. Click Next on the first page of the Add Hardware Wizard
  3. The system will search for new hardware. Select "Yes, I have already connected the hardware" from the options and click Next
  4. Scroll to the end of the hardware list and select "Add a new hardware device" and click Next
  5. On the next page select "Install the hardware that I manually select from a list" and click Next
  6. Select "Network adapters" from the list of hardware types and click Next
  7. Under the Manufacturer list select "Microsoft" and under Network Adapter select "Microsoft Loopback Adapter" and click Next
  8. Click Next to install the hardware

Once the loopback adapter is installed we want to configure it with a static IP address. For Domain Controllers you have to use a static IP and it’s a good thing so we know where machines are and can easily access them by name from our clients.

Under the Control Panel -> Network Connections you’ll see a new network adapter (usually called "Local Area Connection").

  1. Right click on it and select Properties.
  2. From the Properties dialog under the General tab select Internet Protocol (TCP/IP) and click Properties.
  3. Change the General settings to "Use the following IP address" from "Obtain an IP address dynamically"
  4. Enter a fixed number using 10.* or 192.*. I generally use 10.* for my virtual networks so they don’t collide with my desktop and automatic ones. 10.50.50.1 is a good choice. Make note of this number for later.
  5. Enter 255.255.255.0 for the subnet mask
  6. Leave the gateway blank (as this machine is the gateway)
  7. I use 127.0.0.1 for the Preferred DNS server listed on this dialog. This means the server doesn’t try to go out to the network to resolve any names which is good for development.
  8. Click OK to close the dialog.

Client

With the server setup we need to configure the client. On the client OS follow the same steps as the server configuration above.

  1. Go to Control Panel -> Add Hardware
  2. Click Next on the first page of the Add Hardware Wizard
  3. The system will search for new hardware. Select "Yes, I have already connected the hardware" from the options and click Next
  4. Scroll to the end of the hardware list and select "Add a new hardware device" and click Next
  5. On the next page select "Install the hardware that I manually select from a list" and click Next
  6. Select "Network adapters" from the list of hardware types and click Next
  7. Under the Manufacturer list select "Microsoft" and under Network Adapter select "Microsoft Loopback Adapter" and click Next
  8. Click Next to install the hardware

Once the adapter is installed reconfigure it like above but give it a client IP that’s in the same subnet as your server you setup above.

  1. Under the Control Panel -> Network Connections select the new Loopback Adapter.
  2. Right click on it and select Properties.
  3. From the Properties dialog under the General tab select Internet Protocol (TCP/IP) and click Properties.
  4. Change the General settings to "Use the following IP address" from "Obtain an IP address dynamically"
  5. Enter a fixed IP in the same subnet as your server. In our example, the server is at 10.50.50.1 so make the client 10.50.50.100 (use 100 as the starting IP for any client machine).
  6. Enter 255.255.255.0 for the subnet mask
  7. Enter 10.50.50.1 for the gateway.
  8. Leave the DNS entries blank.
  9. Click OK to close the dialog.

Finally on either client you’ll want to create a named alias to your server in your local hosts file. This makes for accessing the server by name rather than IP and lets you use host headers on your server (something you’ll want to do when you setup things like My Sites, it’s preferred to use host headers over server names as you can setup multiple sites on the same server).

To update your hosts file:

  1. Navigate to your Windows directory (usually C:\Windows)
  2. Go into the system32\drivers\etc folder
  3. Edit a file called HOSTS
  4. Add an entry at the end with 10.50.50.1 as the IP address (press TAB) then enter your server name (in my example, litwaredemo)
  5. Save the file

Virtual Machine

Finally, once the loopback adapter is installed on your host OS you can reconfigure your virtual machine to use it. This can be done while the machine is running. Go into the settings (on Virtual PC it’s the Settings button or Action -> Settings menu when the VM is highlighted) and select Networking. From there pick the Microsoft Loopback Adapter for the adapter.

To do a test, try to ping the server from the client. Open a command prompt and type:

ping 10.50.50.1

(substituting the IP address you used in step #4 in the second part of the server setup above).

You should get a response. If not, go back and check the server and client to make sure all your IPs and subnet masks are set correctly and that the server shows connectivity.

Once that’s setup, open up whatever browser you want from your desktop and browse to your server name (in this example,http://litewaredemo) and go nuts. Also if you need to perform some maintenance on the system, get into Central Admin, or whatever just use the Remote Desktop client from your host OS. It’s actually much faster than using the native client and you can allow it to access local resources (like a downloads directory) so again, you don’t have to clutter up your VM with downloaded files and applications you don’t need.

If you create multiple sites on your VM to try out different features, layouts, etc. just create a new website and give it a host header (dev1, MyMotherTheCar, AReallyLongServerNameThatWouldBeHardToTypeInEachTime, whatever). Add this entry to your local HOSTS file on your client and fire up your browser. Easy sleazy.

Advertisements