How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

99,849 views

Published on

This document will walk you through setting us a virtual Windows Server 2008 R2 network using VirtualBox and pfSense.

Published in: Technology
12 Comments
31 Likes
Statistics
Notes
No Downloads
Views
Total views
99,849
On SlideShare
0
From Embeds
0
Number of Embeds
498
Actions
Shares
0
Downloads
3,340
Comments
12
Likes
31
Embeds 0
No embeds

No notes for slide

How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

  1. 1. How to Create a Windows Server 2008 Virtual Lab Using VirtualBox Rusty Painter November 10, 2011
  2. 2. Table of ContentsObjective ................................................................................................................................................................................. 2Prerequisites ........................................................................................................................................................................... 2VirtualBox Installation ............................................................................................................................................................. 2Preparing VirtualBox for OS Installation ................................................................................................................................. 3Operating System Installation ................................................................................................................................................. 8Talking to the Outside World ................................................................................................................................................ 11Extra Credit ........................................................................................................................................................................... 23Conclusion ............................................................................................................................................................................. 23Additional Reading ................................................................................................................................................................ 23 1
  3. 3. ObjectiveWhile studying for my MCITP certifications, I have found that merely reading study guides is not enough to pass theexams. I needed to find some way to “get my hands dirty”, and practice on live equipment. Since I do not have tons ofmoney to go out and purchase servers and workstations, the next best thing was to create a virtual domain.The objective of this paper is to show you how to set up a virtual Windows Server 2008 domain that is fully functional,and separate from your production environment. After several days of searching the internet, and reading severalarticles, I have been able to create a domain that meets these requirements. Below you will find a step-by-step guide toreplicate what I have done.PrerequisitesIn order to set up a virtual network, you will need a few things. The first is a host computer. VirtualBox will run on justabout any modern operating system. This tutorial was written with VirtualBox installed on a Windows 7 host OS. Here isa list of what you will need to follow this tutorial:  Host Computer – I recommend a 64-bit OS, with at least 4GB RAM  The latest version of VirtualBox (4.1.6 as of this tutorial) and the VirtualBox Extension Pack. Download both here: https://www.virtualbox.org/wiki/Downloads  Windows Server 2008 R2 ISO. 180-day trial can be downloaded from Microsoft here: http://technet.microsoft.com/en-us/evalcenter/dd459137.aspx  Windows 7 ISO. 90-day trial can be downloaded from Microsoft here: http://technet.microsoft.com/en- us/evalcenter/cc442495.aspx  An ISO of the latest version of pfSense (2.0 as of this tutorial). The ISO can be downloaded here: http://www.pfsense.org/mirror.php?section=downloads (Choose a mirror that is close to you. Scroll to the bottom of the file list, and choose the file that is named pfSense-2.0-RELEASE-i386.iso.gz). Even if you have a 64- bit host OS, choose the i386 version of pfSense.Once you have everything above, you are ready to begin installing VirtualBox. Note: The internet changes all the time. All links in this tutorial were good at the time of writing. If a link doesn’t work, try Google. They usually have the answers for everything.VirtualBox InstallationBefore you begin setting up your network, you must install VirtualBox. VirtualBox is the software that resides on yourhost computer, and allows you to install several other “virtual” operating systems inside the host. The installation ofVirtualBox is pretty straight forward: 1. Start the VirtualBox install by double-clicking VirtualBox-XXX-Win.exe (where XXX is the version number) 2. Click Next on the Welcome screen 3. On the Custom Setup screen, accept the defaults and click Next 4. The next screen allows you to place shortcuts on the desktop and Quick Launch bar. Click Next 5. Click Yes on the Network Interfaces warning (You will be disconnected from your network for a short time. So, if you are working on anything, now is the time to save it.) 6. On the Ready to Install screen, click Install 2
  4. 4. 7. During the installation, a few Windows Security boxes will pop up and ask for permission to install. If you do not want to press Install every time, check the box next to “Always trust software from Oracle Corporation” before pressing Install.Once VirtualBox is installed, it’s time to start building your virtual machines. The first machine that we are going toinstall is Windows Server 2008 R2.Preparing VirtualBox for OS InstallationBefore we can begin installing our OS in a virtual machine, we have to prepare VirtualBox. The following steps will walkyou through the preparation. These steps can be followed for pretty much any operating system install. 1. The first thing that you see when you open VirtualBox for the first time is the following screen. Once you install your virtual machines, they will be listed on the left hand side of the screen. The right side of the screen will so you the details of your machines, as well as a preview of the virtual machine. 2. To get started with your first virtual machine, click New. 3
  5. 5. 3. On the VM Name and OS Type, Name your server and choose your OS system and version. Once you are done, click Next.4. On the Memory screen, choose 512MB. Click Next. 4
  6. 6. 5. Next comes the Virtual Hard Disk screen. Make sure Start-up Disk is checked, and Create new hard disk is selected. Click Next.6. On the following screen, choose VDI and click Next. 5
  7. 7. 7. On this screen, you have a couple of different options. A dynamically allocated virtual disk will show up in the virtual machine as the full size. However, it will only take up the amount of space needed on the host system. A fixed size virtual disk will take up the full amount of space on the host system. While there are pros and cons for both virtual disk types, I recommend a dynamically allocated virtual disk for the purposes of this lab. Choose the one you want, and click Next.8. On the virtual disk file location and size screen, set the disk size to whatever you want. For the purposes of this lab, a 20GB drive should be large enough. Choose wisely here. It is very hard to change the size of the disk. Once set, click Next. 6
  8. 8. 9. Make sure everything is correct on the Summary screen. If everything looks good, click Create.10. Once the virtual hard disk is created, the virtual machine summary screen will appear. If everything looks correct, click Create. 7
  9. 9. 11. Once your virtual machine is created, you will be taken back to the main screen. Notice that the newly created machine is now listed on the left. Also, all of the details about the machine are listed on the right. If you have more than one virtual machine on the left, you can simply highlight any of them to see their details.Operating System InstallationNow that we have prepared VirtualBox, it’s time to install the operating system. The installation of operating systems ina virtual environment is pretty much exactly the same as it is on physical equipment. The only difference is that youmust define what hardware your virtual machine has. 1. To begin the installation of your operating system, make sure the correct virtual machine is highlighted, and then click Settings. 8
  10. 10. 2. Once the setting come up, click Display in the left pane. In the right pane, choose the Remote Display tab. Check Enable Server, and assign it a unique port (every virtual machine must have a different port number). This step is optional. If you do not have a need to RDP to the system, you can skip this step.3. Next, choose Storage on the left. This is where you will tell the virtual machine where to find your installation media. In the right pane, highlight your CD-ROM drive, and then click the picture of the CD. The menu that appears has a few different options. If you have a physical disk, choose the host drive that the disk is in. If you have an ISO file, select the option to Choose a virtual CDDVD disk file. Browse to the ISO, and select it. 9
  11. 11. 4. Once you’ve set your installation media, select Network on the left. For Windows servers and clients, you typically only need to use one network adapter. For all Windows servers and clients, make sure Adapter 1 is enabled. Next, change Attached to from NAT to Internal Network. You can name the internal network whatever you want, but every machine must have this same name (this does not have to match your domain name. This is only for VirtualBox to keep up with what machines are connected to various networks). Note: Connecting your servers and clients to the internal network is the key to isolating this domain. By doing this, you will not have internet access on any of the virtual machines. Don’t worry, we will take care of that in a few minutes.5. Once you are done with all of the settings, click OK to return to the main screen. It’s finally time to install your operating system. Make sure the correct virtual machine is highlighted, and then click Start. At this point, the virtual machine should boot from your installation media (physical or ISO). From this point, the install works just like a regular install on physical hardware. 10
  12. 12. Follow the steps outlined in the previous two sections (Preparing VirtualBox for OS Installation and Operating SystemInstallation) to install any additional servers or clients that you require.Talking to the Outside WorldIn the last section, I told you that your network would not be able to access the internet. I also told you that we wouldfix that. There are many different ways to solve this issue, but we will be focusing on pfSense. pfSense is a free, opensource customized distribution of FreeBSD tailored for use as a firewall and router. Why pfSense? There are severalreasons, but the two most important are: 1 – It’s free, and 2 – It works.Since many of you have probably never installed pfSense, I will walk you through the complete install and configuration.Before we begin, let’s define what IP addresses we will be using in this example (your addressing scheme may bedifferent): Virtual Machine IP Address Windows 2008 Server R2 (SERVER01) 10.0.0.11/24 Windows 7 Client (WIN7CLIENT01) 10.0.0.12/24 LAN: 10.0.0.254/24 pfSense WAN: DHCPNow, it’s time to install pfSense. Preparing VirtualBox for pfSense is a little different than preparing for Windows. Wewill not be using as much memory or hard drive space, and we will install it with two network adapters (one for the LANside, and one for the WAN side). Note: pfSense is a very powerful product, and this installation will only be scratching the surface of what it is capable of. For further reading, I will post links to all documentation at the end of this paper. 1. The first thing we need to do is click New in VirtualBox main screen. 11
  13. 13. 2. On the VM Name and OS Type scree, name your VM. Change the Operating System to BSD, and the Version to FreeBSD. Click Next.3. Set the memory to 128MB. Click Next.4. Make sure Start-up Disk is checked, and select Create new hard disk. Click Next. 12
  14. 14. 5. Choose VDI. Click Next.6. Select your hard disk type (Dynamically allocated is recommended). Click Next.7. Change the size of the disk to 2GB. Click Next. 13
  15. 15. 8. On the next 2 summary screens, make sure everything is correct. If it is, click Create.9. On the main VirtualBox screen, highlight the pfSense VM, and click settings. 14
  16. 16. 10. On the display menu, choose the Remote Display tab. Put a check in the Enable Server box, and give pfSense a unique port number.11. In the Storage section, select the empty CD-ROM. Next, click the CD picture (circled) and navigate to your pfSense ISO. 15
  17. 17. 12. On the Network screen, select the Adapter 1 tab. On this tab, make sure the adapter is enabled. Next, attach the adapter to Bridged Adapter and select the adapter on your host that you want to use (This will not affect your host machine’s ability to connect to the internet). This will be your WAN adapter, and allow you to get to the internet.13. Next, choose the Adapter 2 tab and enable the adapter. Attach this adapter to the Internal Network. Make sure the network name is the same as what you set for your other VMs. This will be your LAN adapter. Click OK to go back to the VirtualBox main screen.14. Make sure pfSense is highlighted, and click Start. At this point, the VM should boot from the ISO file. 16
  18. 18. 15. On the first pfSense screen, press 1 to boot.16. When you see this screen, press I (eye) to install. Make sure you’re paying attention, you only have about 10 seconds before it auto boots to the live CD.17. Use your arrow keys to highlight <Accept these Settings>. Press Enter. 17
  19. 19. 18. For the purposes of this lab setup, you can choose Quick/Easy Install.19. Wait a couple of minutes for pfSense to install. Once it installs, the following screen will appear. Choose the first option, Symmetric multiprocessing kernel.20. After the kernel is installed, the system will reboot. During this time, you will need to remove the disk from the drive. You do this by selecting the Devices Menu>CDDVD Devices>Remove Disk From Virtual Drive. You may have to force the removal. 18
  20. 20. 21. When pfSense boots for the first time, you will be asked a series of question for the basic configuration. The first question asks if you want to set up VLANs. Answer “n” to this question.22. The next screen asks for your WAN interface name. If you followed this tutorial, the answer is em0 (Adapter 1 in the VM). Type that in, and press Enter. 19
  21. 21. 23. The next screen prompts your for your LAN interface. Again, if you followed this paper, the anser is em1 (Adapter 2 in the VM). Type that in, and press Enter. The next screen asks about an optional interface. Just leave this blank, and press Enter.24. The next screen shows a summary of your interfaces. If they look correct (WAN>em0, LAN>em1), type Y to proceed. 20
  22. 22. 25. After some initial configuration, you will come to the main menu. Notice your WAN and LAN IP addresses. The WAN address was assigned via DHCP from your “real” network. The LAN IP address is the default for pfSense. We will be changing the LAN IP address to match your virtual network’s IP scheme.26. From the main menu, Enter option 2 to set you interface IP address. On the next screen, choose option 2 to set the LAN IP address.27. For the purposes of this lab, the following information was used: LAN IPv4 Address 10.0.0.254 Subnet Bit Count 24 Enable DHCP N Revert to HTTP N 21
  23. 23. 28. Once you enter everything, you will get a message saying that the LAN address has been set. Press Enter to return to the main menu.For the purposes of our lab, that is all the configuration that pfSense needs. The only thing left to do is to set the IPaddresses in your server and client machines. Below are screenshots of my server and client IP configurations. With thisconfiguration, you should be able to reach the internet through both machines. SERVER01 WIN7CLIENT01The only thing left to do in order to make this a true corporate environment is creating a domain. Creating an ActiveDirectory domain is outside the scope of this paper. However, I will include links at the end of this paper to assist you. 22
  24. 24. Extra CreditpfSense must be running in order for your servers and clients to connect to the outside world. However, you will veryrarely (if ever) need to actually do anything with it. If you do need to do anything, there is a very nice web interface thatcan be accessed. So, right now, you have a virtual machine taking up space on your taskbar.There is a program called VBoxHeadlessTray that will allow you to start a VM as a System Tray icon. Installation is assimple as downloading and running the executable. Once installed, simply choose VBoxHeadlessTray from yourPrograms menu and select pfSense. Once started, pfSense will reside in your System Tray. If you need to interact withpfSense for any reason, simply right-click on the tray icon and choose Remote Desktop.VBoxHeadlessTray can be downloaded here: http://www.toptensoftware.com/VBoxHeadlessTray/ConclusionHopefully, this paper was able to assist you in setting up your own virtual network. With this setup, you will be able toget hands on experience with Windows Server 2008 R2, pfSense, Active Directory, and whatever else you decide toinstall.This virtual network can also be used in corporate networks to test security patches, Group Policy, and much morebefore they are deployed to employees.Additional ReadingVirtualBox – The VirtualBox website is filled with great information. You will find very well written documentation thatcovers every aspect of VirtualBox. They also have a very active user forum that can assist you with any issues that youhave. http://www.virtualbox.orgpfSense – Like VirtualBox, pfSense also has a very good website. You will find all of the documentation, as well as a veryactive community there. http://www.pfsense.orgTechNet – As far as Microsoft documentation goes, it’s hard to beat TechNet. If you have the time to wade through themounds of documents, you can literally find anything Microsoft related in TechNet. http://technet.microsoft.com 23

×