Setting up Hyper-V with NAT

This post was originally posted by me at http://forums.serverbeach.com/showthread.php?t=6411.

I’ve edited out the ServerBeach specific stuff and will post pictures…. soonish.

The following link has some great pictures not included here. http://sqlblog.com/blogs/john_paul_c…h-hyper-v.aspx

I’ll add some nice little pictures here once I get some screenshots together.

CONFIGURE HYPERV

1. Configure an “Internal” HyperV network
2. Set each Virtual Machine to use the Internal network and assign them and your HyperV host on the correct subnet (in this example 10.0.0.1 for the host and 10.0.0.10 for the VM).

ENABLE ROUTING AND REMOTE ACCESS ON THE HOST MACHINE

1. Click -> Start -> Administrative Tools -> Routing and Remote Access
2. Right Click on Server#### (local) -> Configure & Enable Routing & Remote Access
3. Click -> Next on Welcome Window
4. Select Custom Configuration Click -> Next
5. Select NAT Click -> Next
6. Select your public interface
7. Select your Internal HyperV interface
8. Select “I will set up name and address services later” Click -> Next
9. Click -> Finish

CONFIGURE ROUTING AND REMOTE ACCESS ON THE HOST MACHINE

1. Routing and Remote Access should be running on the server now
2. Expand out the Server
3. Expand out IP Routing
4. Select NAT/Basic Firewall
5. Right-click your public interface. Select properties
7. Network Address Translation Properties Window will open
8. Select Radio Button for “Public Interface Connected to the Internet”
9. Select the check box for both “Enable NAT on this interface”
10. Click on the Address Pool Tab
11. Click the Add button and add your secondary IP addresses. The “Start Address” and “End Address” will be the same in most cases.

*NOTE* You do not want the secondary IP address configured in the TCP/IP Properties of the Host machine.

12. Click the Reservations button and enter your static IP mappings. That is, specify that you want traffic on your secondary IP mapped to your VM’s internal IP.
13. In services.msc, make sure that RRAS is set to start automatically and Windows ICS is disabled.

NOTES #1

When configuring and experimenting with the RRAS firewall, create a batch file to stop the service in case you forget to allow RDC or otherwise render the system inaccessible.

Code:

net stop “remoteaccess”

Then add the batch file to the scheduler and have it run some time after you apply your changes.

NOTE #2

RRAS is really finicky about the interfaces installed on the server. If an interface is changed in any significant way, it’ll have to be disabled and reconfigured.

Hyper-V is also similarly finicky about its virtual networks. I can’t count the number of times I had to remove and recreate networks. Thankfully, this was rather painless with only one VM to propagate changes to.

If you should encounter any difficulties with adding your additional VMs to the server, try resetting HyperV networking, individual VM network binding (in the VM’s settings), confirming physical host interfaces, and then reconfiguring RRAS in this order.

NOTE #3

Those who have had HyperV configuration problems solved it by disabling TCP/Offload Engine. Symptoms include, RRAS just not working, or working sporadically. If in doubt, disable TCP/Offload Engine

http://social.technet.microsoft.com/…8-d22aca6154ee
http://support.microsoft.com/default…b;EN-US;904946

So if this applies to you, run on the host and on any 2008 VMs:

$ netsh int ip set global taskoffload=disabled

and add the following registry key to any 2003 VMs:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters\DisableTaskOffload

This is a DWORD entry that should have a value of 1.

Windows XP Mode

If compatability mode is not enough for you, check this out:
http://www.microsoft.com/windows/virtual-pc/download.aspx

You can install a Windows XP VM in Virtual PC on your Windows 7 workstation. The cool part is the integration. Install a Windows XP application, and it’s automatically integrated into your Start Menu in Windows 7.

I am so geeking out right now.

Quick and Dirty Port Check (ch.pl v 0.1)

The core of the following script is based off work first started by my coworker Trent. The gist of the little script is to perform a quick scan of a hostname or IP by simply attempting to open a socket. I use this when I want to run a quick “is it online” scan of a server and determine if ports of interest are available to me. I added the bit that would let me open them directly from the script without having to type in an alternate command.

This is very much a poorly written hack-job script, and I very much expect that some of you will be able to identify some serious n00b mistakes (probably in that I still haven’t figured out how to properly localize variables), but hey, I don’t think this is half bad for my first PERL script. Yes, PERL. I’ve already been lectured about learning Python instead, but while that’s definitely on the to-do list, this script needed finishing, and I was already halfway through. It’s a tool that’s customized for me, so please hack away, and let me know what you do, as I may like it too!

So, I present, for your consideration and for your critique (please do), ‘ch.pl’ v 0.1.

I generally alias ch=/usr/local/bin/ch.pl for this script in Linux and MacOS, as this lets me leave the file extension the same for when I use it in Windows. To use this in Windows, you’ll need to install PERL first. I use ActivePerl. However please note, I’m still working on making this script Windows friendly.

To install in Linux/MacOS:

  • download ch.pl using FTP or wget to /usr/local/bin/
  • chmod +x /usr/local/bin/ch.pl
  • modify your ~/.bash_aliases file (ubuntu), or your ~/.bashrc (RedHat) to include the following:
    • ‘alias ch=/usr/local/bin/ch.pl’

Usage: ch [hostname or IP] [optional: port(s) to check, separated by commas]

Preview: Handy Sysinternals Utilities

This article was first published as “Locked Files in Windows” on 22 Jul 2009.

Note to self: Sysinternals is Microsoft’s saving grace:

Process Explorer: A more advanced taskmgr, if you will. It’s most awesome feature is it’s ability to search for processes holding a certain handle, allowing you to resolve locked file issues:

Home page: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Or just run it from http://live.sysinternals.com/procexp.exe

Process Monitor: Basically, Regmon + Filemon:

Home page: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

Or just run it from http://live.sysinternals.com/Procmon.exe

Check Your OS’s Installation Date

Linux:

ls -alh /boot/grub #the majority of files in this folder don’t change from the time of install except for menu.lst

ls -alh /restore #BSD

Windows:

Systeminfo #from the command line

- or –

CMD /K WMIC OS GET InstallDate

You’ll see the Operating System installation date (in WMI format). The first eight characters in that output gives you the installation date.

*Windows bit stolen from http://windowsxp.mvps.org/getosdate.htm

Next Page »