Showing posts with label VMWare. Show all posts
Showing posts with label VMWare. Show all posts

Tuesday, June 21, 2016

A/D Test Lab, Rinse And Repeat

This part covers the non-unique portions of the lab setup - that is, those steps that can be done as many times as needed to achieve the desired state (i.e. Rinse And Repeat!)

The last step in this process is to stand up a server to eventually run SQL Server, and a domain user, because I DON'T want to be installing software as Administrator!

First, I'm going to make a new user, like so, while logged in to the domain controller:

New-ADUser -Name "Ironman" -GivenName Tony -Surname Stark -SamAccountName ironman -UserPrincipalName ironman@contoso.com -AccountPassword (ConvertTo-SecureString -AsPlainText "Password1!" -Force)
Enable-ADAccount ironman
Add-ADGroupMember "Enterprise Admins" ironman
Add-ADGroupMember "Domain Admins" ironman


Next, I'm going to adjust the member server, after having logged in as the Administrator account I created during Windows setup. Here's the script block:

$netadapter = Get-NetAdapter -Name Ethernet1

$netadapter | Set-NetIPInterface -DHCP Disabled

$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.0.1.110 -PrefixLength 24 -Type Unicast -DefaultGateway 10.0.1.100

Set-DnsClientServerAddress -InterfaceAlias Ethernet1 -ServerAddresses 10.0.1.100


The first half is essentially the same as what I listed in the Stand Up The Domain post, so let's walk through it.

First, I'm going to get validation that the adapter that I think exists, actually does. In my copy of VMWare, the adapters are returned by Get-NetAdapter as a zero-based naming scheme, so the first, and default, adapter is Ethernet0. I've added an adapter, so it's going to be Ethernet1. If for some reason, there was a problem, or I didn't hit "Save", or something else went wrong, then I won't have the adapter to configure, and the variable $netadapter is going to wind up $null.

Next, we disable the default DHCP. This line is going to prevent the adapter from calling back out to the VMNet2 network post-configuration and getting a potentially confusing IP address. It's not really bad that it gets one, if this machine is a client (Windows 10, for example), but since this is going to be a server, a dynamic address won't do.

An interesting side note is that the adapter to NAT with the host on VMNet0 DOES use DHCP, and I want it to NOT have a fixed address.

The next line is, really, the important one, as it sets the static IP address and settings.

Lastly, we find the DNS server being defined for this internal-only network being pointed at the Primary Domain Controller.

In the second half, then, what we have is

Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Rename-Computer "MemberServer"

add-computer -Credential contoso\ironman -DomainName contoso.com

Restart-Computer


This block will first completely disable the Windows Firewall (again, see my previous notes, and DON'T do this in Production).

Then, because we're working on a member server, and we're already logged in using the Administrator account, I can go ahead and rename the computer as a part of this script.

Next, I'm going to join the domain by calling the join command. It will prompt me for the password to use for the attempt, and after that succeeds, the script reboots the computer. Unless you are 100% certain that this is going to work when you run it, my advice is don't run the Restart-Computer until you're sure, as it'll reboot so fast, you won't get a chance to write down any error messages prior to the machine clearing the screen in preparation to reboot.

And, finally, here's the complete script for a member server:

$netadapter = Get-NetAdapter -Name Ethernet1

$netadapter | Set-NetIPInterface -DHCP Disabled

$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.0.1.110 -PrefixLength 24 -Type Unicast -DefaultGateway 10.0.1.100

Set-DnsClientServerAddress -InterfaceAlias Ethernet1 -ServerAddresses 10.0.1.100



Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

Rename-Computer "MemberServer"

add-computer -Credential contoso\ironman -DomainName contoso.com

Restart-Computer


Tuesday, June 14, 2016

A/D Test Lab, Stand Up The Domain

Standing up the domain is a bit different from the "Rinse And Repeat" portion of this exercise. In some ways, standing up a new domain in a new forest is simpler, because this is the part I only have to do once, and these scripts don't change, even if I blow away the domain and bring it back, because I always have to have a domain controller!

To do so, I needed to create an Active Directory Forest, a domain within that forest, and change the settings on the server I installed that is going to act as my Primary Domain Controller (PDC).

Also, this is for a contained test lab, that is shut down at night, so I chose not to run Windows Firewall in between the machines. That IS something I want to add to these scripts, and it's planned for a later revision. Onward!

IP TABLE

10.0.1.100 PDC
10.0.1.110 Server #1
10.0.1.120 Server #2
10.0.1.130 Server #3
So, the first thing I need to do is set the IP address on the secondary controller - that is, the one attached to VMNet2 - so that the machines can have inter-domain conversations.

You'll also notice that, because I have to run these commands as Administrator, it's a good time to go ahead and rename the computer. I'll expand more on what the $netadapter lines do in the Rinse And Repeat post.


$netadapter = Get-NetAdapter -Name Ethernet1

$netadapter | Set-NetIPInterface -DHCP Disabled

$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 10.0.1.100 -PrefixLength 24 -Type Unicast -DefaultGateway 10.0.1.100

Set-DnsClientServerAddress -InterfaceAlias Ethernet1 -ServerAddresses 10.0.1.100


Rename-Computer "pdc"

Restart-Computer


Now, I want to install a new domain in my new forest. You'll notice that for purposes of this public-facing script, I'm sharing the ConvertTo-SecureString call, and in a production script, I would leave this out, for the wizard to prompt me for the proper value.

Install-windowsfeature -name AD-Domain-Services -IncludeManagementTools

Import-Module ADDSDeployment

Install-ADDSForest -domainname "contoso.com" -DomainMode 6 -DomainNetbiosName "CONTOSO" -ForestMode 6 -InstallDNS -Force -SafeModeAdministratorPassword (ConvertTo-SecureString -AsPlainText "password" -Force)


And that's it! I now have a domain, talking on a secondary LAN, that my member servers can reach!

Tuesday, June 7, 2016

A/D Test Lab, Build The Machines


In order to build the test lab, let's define what we're trying to do.

Here's a quick picture, but essentially I need to build a domain controller, a SQL Server (shocking, right?), and a client machine.



In order to do that, I'm using VMWare Workstation, and although I BELIEVE this will work under Hyper-V, I haven't tested it.  It's worth talking about here what my network setup is, which VMWare makes super simple!



It's a pretty straightforward system setup - during machine creation, I have one NIC in the machine, and then, after install, I install another NIC with a different MAC, pointed at  a private network, VMNet2, selected as machines only.

Here's how I set that up in VMWare. Open Workstation, and then navigate to Edit >> Virtual Network Editor.


Then, I created a new network with the following settings.




I'm using evaluation software for all this, which I got from US Technet evaluations, which you can find here:
https://www.microsoft.com/en-us/evalcenter/

It's worth noting that all the actual work of standing up the domain is separate from standing up the machines.

VMWare allows me to shortcut the process if it's an O/S that it knows about, and if not, then it still installs pretty quickly, albeit with a few more clicks of the mouse.

All the machines were loaded with a simple load, consisting of only the default administrator account, and no additional software.

Tuesday, May 31, 2016

A/D Test Lab, Introduction

The challenge:
I need to create a test lab using Active Directory, so I can run SQL Server in various testing configurations. Also, having my own domain under total control makes me giggle with uncontrollable personal glee, so there's that.

Anyway, back to the point.

I need to create a test lab, which has the following requirements:

1. Fully self-contained
All domain traffic should stay within the domain. This is important, as quite a bit of the work I want to do on this is going to involve being offline or on slow connections, and if my servers are hanging and timing out waiting for the slow internet connection I'm on at the time, I'm never going to get anything done.

2. Fully configured
This can't be a single-box setup, or I won't be able to configure things like SQL clustering. This has to be an actual domain, with a primary domain controller, member servers, etc.

3. Easily destroyed
One of the requirements for doing this is that I have to be able to blow away and bring back the entire thing within minutes. I don't have the patience to wait for hours for machines to build - ultimately, I want the entire thing, from pushing the "File >> New VM" button to starting the install of SQL to be as close as possible to 5 minutes as I can get.

4. Free
This entire setup HAS to use evaluation copies or release candidates. It has to work with what I can get for free, so I can be sure that not only can I do it for free, but anyone who follows along at home can do so, too.

I'm presenting below a series of articles about how I did exactly that. I'll cover these four steps

  • Building the machines
  • Stand up the domain
  • Add a domain user
  • Add the member server




Tuesday, March 10, 2015

VMWare, Virtual Machines, and Viruses, Oh My!

So I'm building a new set of lab machines again. They're going to be using Windows Server 2008 R2 and SQL Server 2012 as guests inside of VMWare's VM Workstation 9.

I don't need virus protection for my VMWare based virtual / lab machines, because:

  1. The lab machines are virtual, and
  2. The lab machines, after activation, have no internet access, and
  3. If my host PC has a virus that transmits to my lab machines, I have bigger problems that an infected lab machine
So, I went in to my anti-virus program, and added read/write/execute exclusions for the following files types:
  • *.iso 
    • (Granted, ISOs are not really a part of the lab, per se, but I get better throughput when loading into the VMs if the source images aren't being scanned. For pete's sake, they're read only anyway.)
  • *.vmdk
  • *.nvram
  • *.vmsd
  • *.vmx
  • *.vmxf
  • *.vmem
  • *.vmss
What I did NOT exclude were the files that I know are also file type extensions used elsewhere, such as:
  • *.lck
  • *.log

Tuesday, July 30, 2013

Time-travelling DNS

I’m going to have to rebuild the DNS of my test lab domain.

At some point, it WILL happen.

When it does, what would I like to tell my future self?

IP addresses are irrelevant, because within the test network, those change all the time. (That would be the point of the home lab, wouldn’t it? To be able to build and rebuild as much as I want from within Workstation 9 and the VM’s?)

I think that I would like to remind myself that, when setting up a home lab for the first time, VMnet8 (NAT) is going to be your very bestest friend.

 

Open the VMware "Virtual Network Editor" to see which IP subnet’s configured and to also disable the “local DHCP service to distribute IP address to VMs”.

 _2013-07-25_21-45-33

Then, inside each VM? Go with IP address ranges
192.168.xx.3...50 (fixed, for the DC’s) and
192.168.xx.51...100 (for the clients & lab boxes).


The gateway address to use for configuring the Ethernet adapters in the VMs is 192.168.xx.2. You can find this by clicking on the “NAT Settings…” button in the Virtual Network Editor window.

NAT Settings_2013-07-25_21-52-21

 

Then, once all that’s done:
1. set each VM's DNS IPv4 server settings to point to the virtual DC

 DCDNS220101


2. on the DNS servers / DC’s, setup DNS forwarding to send DNS requests for other domains (that is, for the Internet) to the same IP as listed as “DNS Server” on the Host PC.

 

Last step, as always, is to prove it works. A quick test is this blog. If that succeeds, then check for updates using Windows Update.

Tuesday, July 23, 2013

Build a VMWare Workstation 9 Home / Test Lab

So I’m building a test lab at home.

This post is going to grow to become a directory of the issues, I think, that I post about that over time.

For now, here’s the plan:

Dual Windows Domain Controllers
Separately from the two DC’s, SQL Server 2012
Windows 8 Client PC

…and all on Workstation 9.

I’m building them in order to test SQL 2012 in a domain, of course, because I want to just jump in log in with Windows Authentication to SSAS, and I can’t do that without a domain.

I mean, I think I can – I’ve seen some articles about cobbling things together to do so, but honestly, I don’t really want to. Really.

I want to get as close to “best practices” as I can with this setup, since that’s what I’m expecting the exam(s) to cover.