Dynamic Duo

A virtual server with a dynamic DNS service might just be the easiest way for a home user to implement an Internet website.

A dynamic DNS service lets the user run a web server from a home computer without a static IP address. Dynamic DNS providers such as DynDNS.com [1], easyDNS [2], or ZoneEdit.com [3] won't even charge you for a static DNS name. If your Internet provider assigns new IP addresses to your router through DHCP, a special program – or even the router itself – will pass the new IP address on to the dynamic DNS service provider, thus updating the DNS record for uninterrupted name resolution services.

Many users are wary of installing a private server because they're afraid of vulnerabilities. An attacker who manages to compromise your web server can access your private machine and possibly even endanger important data. However, if you install a web server as a virtual machine (Figure 1), the damage is limited. If an uninvited visitor runs amok on your server, you can easily restore the system to its previous state. VMware server, for instance, lets you take a snapshot of the current system state and restore it at any time. A virtual web server also offers greater convenience and mobility. If you burn your data onto a DVD or a memory stick, you can put your server in your pocket and load it into another virtual machine on other hardware.

Figure 1: A browser attempts to access the virtual server. The dynamic DNS service translates the DNS name into the router's public IP address. The router then passes the request on to the virtual server.

Step by Step

A quick overview will serve to outline the steps for deploying a VMware virtual web server system. Start by installing a virtual server. In this article, I use the free VMware server, which does not need any major network configuration. On the server, install the operating system you will be using for the virtual server as a virtual machine. In our lab, I opted for servers on Ubuntu 7.10 and openSUSE 10.3. Of course, you can choose any other flavor of Linux – many roads lead to Rome.

On the virtualized Linux system, set up the services you want to offer on the Internet. In this article, I focus on deploying an Apache web server, but the process is similar for other Internet services. If your network uses a private address space behind a firewall/router device, the server will only be accessible from the private network at first. As you will learn in this article, you can make the web server accessible from the Internet by assigning it a static IP address on the local network and then configuring the router to forward incoming port 80 traffic to the virtual server's address. If your ISP assigns an Internet address to the router through DHCP, the address will change occasionally. The Ddclient tool will notify the dynamic DNS service provider when the address changes.

The Host

The free VMware server download of version 1.0.4 is available directly from the vendor's website [4]; however, this means installing manually. Ubuntu users can adopt a far easier approach. Launch Synaptic and add another external package source (deb http://archive.canonical.com/ubuntu gutsy partner); then, click to install the vmware-server package.

The serial number you will need is also at the download address [4]. Be warned: Before you are given a serial number, you'll need to answer a whole bunch of questions. After completing the installation, access the server's GUI by pressing Alt+F2 on openSUSE 10.3 and Ubuntu 7.10 and then typing vmware. This takes you to the interface shown in Figure 2.

The next step is to install an ISO image that you download from the web. As an alternative, you can use the host system's disc drive as an installation source if you have the system on a CD or a DVD. Start by selecting File | New | Virtual Machine to set up a new, "empty" virtual machine. Then, select Next and Typical, opt for Linux as the system to install, and select an appropriate version in the drop-down menu.

In the next dialog, type a name for the virtual machine – I chose UbuntuServer and OpenSUSE10_3. Do not change the Location. Now move on to the network settings. If you select Use bridged networking, the server will be set up as a client on the local network. For test purposes, it is perfectly all right to set Disk Size to 5.0 GByte. Check the option Split disk into 2GB files if you want to copy the virtual machine onto external media. Older file systems, such as Ext2 and FAT32, have problems with large files. The server will clean up the required space on the host system if you click Finish. The virtual machine is like a computer with an empty hard disk – time to invite guests.

Hospitality

To assign some of the host system's resources to the virtual machine, click Edit virtual machine settings. Below CDROM 1, click on Use ISO image to use an ISO image as your installation resource. Click Browse to open a file manager and search your disk for the ISO file (Figure 3). If you prefer to use the standard installation medium, keep the default. Click Memory to extend the virtual machine's RAM – you will have to decide how many megabytes of RAM the virtual machine is allowed to steal.

Figure 3: A CD-ROM or DVD is not necessary for the installation – an ISO image of the distribution will be fine.

If the host system has multiple processors, you can specify how many of them the virtual server is allowed to use in the Processors menu. When you are done, click OK to complete the configuration and then reboot the virtual machine by clicking Power on this virtual machine. If you need to change the BIOS, quickly press the Esc key – otherwise the installation will be pretty much the same as on any physical machine. In the case of an Ubuntu server, you should choose Install to Disk as your boot option.

A number of HOWTOs on the Internet describe the installation of one distribution or another. Because VMware tricks the distribution into thinking that it is installing the guest machine with standard hardware, driver problems are very unlikely. It is a good idea to click Snapshot after completing the installation to save a copy of the current system. Later on, if necessary, you will be able to restore exactly this state, and you might also want to take another snapshot when your server is up and running and the configuration is complete.

Reality Check

Although a virtual web server offers many advantages, it definitely isn't a solution for every situation. One disadvantage is performance. Systems running on virtual machines are slightly slower than systems running on the hardware. If you're expecting a high volume of visitors because you run a game server or an enormous content management system, you should make sure your server has sufficient resources or else do without virtualization.

Hardware support is also an issue with virtual machines: Your Webcam or MP3 player might not work as anticipated under VMware. The host system that houses the virtual server also needs a wired connection to your home router – virtual machines will not be able to use a WLAN connection on the host. Finally, virtual machines are not suitable for 3D applications; of course, this is not typically an issue for a server. If the virtual server is not an option for you, don't worry: The Apache web server works just fine with dynamic DNS service on the physical machine.

The free vSphere Hypervisor 5.0 lets companies enter into professional virtualization without the overhead of a commercial solution. If you decide you need additional enhancements later, you can always upgrade to enhanced VMware solutions.