How the Hell do I get networking to work on a Ubuntu VM on Hyper-V in Windows 2008?
This is a question I have personally grappled with a few times. Although I was able to successfully install a Ubuntu 8.10 server on Hyper-V with networking over a year ago I forgot how it was done and pulled my hair out trying to figure it out again the other day. So I thought I’d jot down a few notes to help me remember. If this helps anyone else, that will be great too.
These instructions are for Ubuntu 9.10 server on Windows 2008 Hyper-V. As mentioned above this works for Ubuntu 8.10 server as well; and presumably other versions although I haven’t verified.
This contains some fairly detailed instructions so someone new to this setup should have enough info to get completely running. However, since I know some of you out there are in a hurry here’s the Cliff Notes version:
- Don’t use the default network adapter – DELETE it!
- Add a legacy network adapter.
- Install Ubuntu.
Download the Ubuntu 9.10 server ISO – get this started now so it will be done by the time your’re ready for it.
- Launch the Windows Hyper-V Manager (Start, All Programs, Administrative Tools, Hyper-V Manager).
- Select New, Virtual Machine. Give it a name. Click Next.
- Specify memory (RAM). In this example I’m using 1024 MB.
- On the “Configure Networking” screen just click Next – we will delete this later anyway.
- Create a new virtual hard disk using the name, location and size of your choosing.
- On the “Installation Options” screen make sure to choose “Install and operating system later.”
- Click Next, verify your settings, then click Finish.
Step Two: Customize VM Settings
- From the VM Window click File, Settings.
- Remove the current Network Adapter.
- Click Add Hardware and select Legacy Network Adapter, then Add.
- On the Legacy Network Adapter select the correct adapter from the Network drop-down list
- Click OK to save settings.
- Click Media, DVD Drive, Insert Disk and browse to your Ubuntu ISO.
- Start (Power On) the VM & it will begin the Ubuntu Server installation.
- Select your Language, then “Install Ubuntu Server.”
- Select your desired Country and keyboard layout.
- Enter your desired hostname, then continue.
- Select your timezone.
- Partition your disk using the default, “Guided – use entire disk and set up LVM.”
- Select your disk to partition – if you followed these instructions you will only have one.
- Select YES to write the changes to disks and configure LVM.
- Follow the prompts to setup users and passwords, creating at lease one user.
- Select whether or not to encrypt your home directory.
- If you have a DHCP server on your network your adapter should retrieve and IP address and associated info from that server. If not, you will be prompted for IP address settings.
- Choose how to manage upgrades on your system.
- Choose which software to install (note, depending on which option(s) you select additional questions will be asked during install which aren’t covered in this tutorial):
- Cloud computing cluster
- Cloud computing node
- DNS server
- LAMP server
- Mail server
- OpenSSH server – You may want to install this to connect via SSH later.
- PostgreSQL database
- Print server
- Samba file server
- Tomcat Java server
- Virtual Machine host
- Manual package selection
- At the “Finishing Installation” screen select Continue.
Step Four: Logon to Your Ubuntu Server
Now that your server is installed logon through the Virtual Machine Connection window to verify network settings and connectivity. Type ifconfig to view your network settings. You should have an interface, eth0, with either a DHCP-assigned address or the one you manually entered during installation.
You could verify correct network operation by pinging a know good host on your local network and/or a host on the Internet. In my case I pinged my default gateway and powercram.com. Both responded with replies.
Finally, now that my Ubuntu Server is setup and networking is configured properly I will probably never (hopefully) use the Virtual Machine Connection window again, rather I will use my favorite remote connection client, PuTTY.
Since I neglected to install Open-SSH Server during the Ubuntu installation I had to install it before I could use PuTTY using:
sudo apt-get install openssh-server