how to create a windows server 2008 virtual lab using virtualbox

24
How to Create a Windows Server 2008 Virtual Lab Using VirtualBox Rusty Painter November 10, 2011

Upload: rusty-painter

Post on 13-May-2015

76.664 views

Category:

Technology


3 download

DESCRIPTION

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

TRANSCRIPT

Page 1: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

How to Create a Windows Server 2008 Virtual Lab Using

VirtualBox

Rusty Painter

November 10, 2011

Page 2: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

1

Table of Contents Objective ................................................................................................................................................................................. 2

Prerequisites ........................................................................................................................................................................... 2

VirtualBox Installation ............................................................................................................................................................. 2

Preparing VirtualBox for OS Installation ................................................................................................................................. 3

Operating System Installation ................................................................................................................................................. 8

Talking to the Outside World ................................................................................................................................................ 11

Extra Credit ........................................................................................................................................................................... 23

Conclusion ............................................................................................................................................................................. 23

Additional Reading ................................................................................................................................................................ 23

Page 3: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

2

Objective While studying for my MCITP certifications, I have found that merely reading study guides is not enough to pass the

exams. I needed to find some way to “get my hands dirty”, and practice on live equipment. Since I do not have tons of

money 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 several

articles, I have been able to create a domain that meets these requirements. Below you will find a step-by-step guide to

replicate what I have done.

Prerequisites In order to set up a virtual network, you will need a few things. The first is a host computer. VirtualBox will run on just

about any modern operating system. This tutorial was written with VirtualBox installed on a Windows 7 host OS. Here is

a 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 Installation Before you begin setting up your network, you must install VirtualBox. VirtualBox is the software that resides on your

host computer, and allows you to install several other “virtual” operating systems inside the host. The installation of

VirtualBox 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

Page 4: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

3

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 to

install is Windows Server 2008 R2.

Preparing VirtualBox for OS Installation Before we can begin installing our OS in a virtual machine, we have to prepare VirtualBox. The following steps will walk

you 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.

Page 5: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

4

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.

Page 6: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

5

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.

Page 7: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

6

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.

Page 8: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

7

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.

Page 9: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

8

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 Installation Now that we have prepared VirtualBox, it’s time to install the operating system. The installation of operating systems in

a virtual environment is pretty much exactly the same as it is on physical equipment. The only difference is that you

must 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.

Page 10: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

9

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 CD\DVD disk file. Browse to the ISO, and select it.

Page 11: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

10

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.

Page 12: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

11

Follow the steps outlined in the previous two sections (Preparing VirtualBox for OS Installation and Operating System

Installation) to install any additional servers or clients that you require.

Talking to the Outside World In the last section, I told you that your network would not be able to access the internet. I also told you that we would

fix that. There are many different ways to solve this issue, but we will be focusing on pfSense. pfSense is a free, open

source customized distribution of FreeBSD tailored for use as a firewall and router. Why pfSense? There are several

reasons, 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 be

different):

Virtual Machine IP Address

Windows 2008 Server R2 (SERVER01) 10.0.0.11/24

Windows 7 Client (WIN7CLIENT01) 10.0.0.12/24

pfSense LAN: 10.0.0.254/24 WAN: DHCP

Now, it’s time to install pfSense. Preparing VirtualBox for pfSense is a little different than preparing for Windows. We

will not be using as much memory or hard drive space, and we will install it with two network adapters (one for the LAN

side, 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.

Page 13: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

12

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.

Page 14: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

13

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.

Page 15: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

14

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.

Page 16: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

15

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.

Page 17: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

16

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.

Page 18: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

17

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.

Page 19: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

18

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>CD\DVD Devices>Remove Disk From Virtual Drive. You may

have to force the removal.

Page 20: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

19

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.

Page 21: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

20

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.

Page 22: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

21

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

Page 23: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

22

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 IP

addresses in your server and client machines. Below are screenshots of my server and client IP configurations. With this

configuration, you should be able to reach the internet through both machines.

The only thing left to do in order to make this a true corporate environment is creating a domain. Creating an Active

Directory domain is outside the scope of this paper. However, I will include links at the end of this paper to assist you.

SERVER01 WIN7CLIENT01

Page 24: How to Create a Windows Server 2008 Virtual Lab Using VirtualBox

23

Extra Credit pfSense must be running in order for your servers and clients to connect to the outside world. However, you will very

rarely (if ever) need to actually do anything with it. If you do need to do anything, there is a very nice web interface that

can 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 as

simple as downloading and running the executable. Once installed, simply choose VBoxHeadlessTray from your

Programs menu and select pfSense. Once started, pfSense will reside in your System Tray. If you need to interact with

pfSense for any reason, simply right-click on the tray icon and choose Remote Desktop.

VBoxHeadlessTray can be downloaded here: http://www.toptensoftware.com/VBoxHeadlessTray/

Conclusion Hopefully, this paper was able to assist you in setting up your own virtual network. With this setup, you will be able to

get hands on experience with Windows Server 2008 R2, pfSense, Active Directory, and whatever else you decide to

install.

This virtual network can also be used in corporate networks to test security patches, Group Policy, and much more

before they are deployed to employees.

Additional Reading VirtualBox – The VirtualBox website is filled with great information. You will find very well written documentation that

covers every aspect of VirtualBox. They also have a very active user forum that can assist you with any issues that you

have. http://www.virtualbox.org

pfSense – Like VirtualBox, pfSense also has a very good website. You will find all of the documentation, as well as a very

active community there. http://www.pfsense.org

TechNet – As far as Microsoft documentation goes, it’s hard to beat TechNet. If you have the time to wade through the

mounds of documents, you can literally find anything Microsoft related in TechNet. http://technet.microsoft.com