januar 2009 - Posts

FREESCO routing in a virtual environment
25 jan 2009 17:53

If you have the need for routing between different networks in VMware ESX (Hyper-V should be the same use-case though I have not tested), you need some sort of routing application. FREESCO could be that application, and since it’s very small, fast and easy to use that’s what I ended up using on my ESX test-server.

I use it for “simulating” different sites specifically for AD replication, DFS-R and other site-aware applications.

This guide walks you through installing and booting your new FREESCO VM.
I have attached a clean FREESCO .flp file to this post you can use “out of the box” in your environment, but if you want to try Virtual Floppy Drive and get a taste of how you can use that tool, please allow yourself to read this post: virtual floppy disks and drives for an how-to create floppy images using Virtual Floppy Drive.

The following guides you through creating and configuring FREESCO as a VM.

  1. Upload your FREESCO .flp file to your ESX environment, using Datastore Browser, scp, WinSCP or whatever tool you use to add file to your ESX datastores.
  2. Create at VM with the following settings. I have only listed the non-standard settings you need to make.
    Guest OS: Other Linux (32-bit)
    Memory: 32MB
    NIC: Flexible (Add 2 NICs for a start, write down corresponding MAC address for later use)
    Disk: Do not create disk
  3. After you create the VM, change the configuration like the picture below. You need to remove the DVD drive, and the highlighted floppy path needs to correspond to where you uploaded your floppy file in step 1. Connect each of your NICs to the portgroups you want to route between.
  4. Power on your VM where you should see FREESCO login prompt. Log in with root//root and choose the default color mode.
  5. Select option “f) Server” and press enter.
    free-02
    A - Enter DNS server(s)
    B - Hostname
    C - Leave domain name
    D - At the “Network Card Settings” configure the NICs you have added, and set both options to 0 for PCI auto configuration.
    free-network
    E - At network settings configure eth0, and then change settings for the other NICs you added to the VM. To configure eth1 press 1 and the “Insert” key on your keyboard to auto configure the interface. Afterwards it’s easier to configure the settings. 
    free-ethconf
    F - Just accept the default settings for all options but make sure to answer “Yes” when you are prompted to “Trust local networks”. You can choose to enable/disable features you would like to use like HTTP admin, SSH and so on.
  6. You should end up with a configuration like the picture below: (unless you enabled some features along the way)
    free-04
  7. Press “x” and follow the onscreen instructions. It will ask you to change 3 passwords; for ppp, root and web. Just change to whatever suites you. Afterwards say no to create new root and admin users and restart the VM by pressing “save and quit”
  8. If you have chosen the default networks (192.168.0.x / 192.168.1.x) and have created separate vSwitches/Portgroups , you can now test to see if the routing works. If you are having difficulties finding out what NICs are associated to which portgroup, you can run ifconfig command from the terminal session on the FREESCO VM and it will show you what MAC addresses are linked to which NICs. If you wrote down the MAC addresses for the vNICs in step 2, it should be no problem to find out where a specific vNIC is connected.

There are loads of other features in FREESCO which are explained in details at www.freesco.org. There is also a great FREESCO forum, where I got all my questions answered in regards to LAN routing. Thanks to “Lightning” for helping me with all my questions!

This guide only uses FREESCO from a floppy disk, since I don’t need any of the stuff that requires installation to hard disk. It is possible to add LSI Logic SCSI drivers to the FREESCO install if you would like to install it to a .vmdk rather then run if from a floppy. There is a forum post on that topic at the FREESCO support forums also.

Happy routing!

virtual floppy disks and drives
19 jan 2009 22:46

Virtual Floppy Drive (VFD) is very neat program that creates virtual floppy drives, which works just as if they where physical. You can save these virtual floppies in .flp format and use directly in VMware and MS hypervisors, or other programs which support floppy images. They can also be written to physical floppy disks using fx. WinImage.

There is one thing missing in VFD, but you can always press this link while you do step 8 below if you are a bit nostalgic :)

For starters you need to download the following:

FREESCO 0.4.0 – Download
Virtual Floppy Drive 2.1 (VFD) - Download

I’ll describe how to use FREESCO in a virtual environment, that’s why this guide uses FREESCO as an example. You could use whatever floppy based program you wanted to make a virtual floppy for. To see the FREESCO guide click: FREESCO routing in an virtual environment

  1. Start by extracting Virtual Floppy Drive into c:\temp\vfd (or another folder, I use c:\temp\ in the guide), and FREESCO into c:\temp\freesco

  2. Run vfdwin.exe from where you extracted the files to in step 1.

  3. Go to the “Driver” tab and press “Start”. This will install and start the VFD driver.

    01-driver

  4. Go to the “Drive0” tab and press “Open/Create”.
    02-drive

  5. Press the “Browse” button and type in the full path to a new .flp file. fx. C:\temp\freesco.flp (or some other path you have write permission to) and press “Open”. You should then see something similar to the picture  below. Make sure that “File” is selected and that media type is “3.5 1.44MB”. Then press “Create”.
    03-floppy

  6. Press “Change” at the “Drive Letter” option, and configure the screen as below.
    04-letter

  7. You should now be able to access A: drive through your file manager of choice. Check to see if you can access the drive.

  8. Start a CMD prompt and browse to where you extracted FREESCO files in step1, and run make_fd.bat. Just press enter when you see the following screen:
    05-make_fd

  9. Go back info VFD Control Panel (vfdwin.exe it you closed it) and on the “Drive0” tab press “Close”. If it asks if you want to save changes to the file, answer “Yes” and chose to overwrite the file and press save.

You now have a floppy file which can be used directly in VMware environments. Save this file as your master, and make copies whenever you need a new FREESCO machine. If you boot directly from the file just created, you will get an installation forced down on the floppy, and you have to follow all the above steps again.

The above method can be used for all utilities that make use of floppy disks. http://www.bootdisk.com/bootdisk.htm is a good place to look if you are missing old boot disks for Win 98, NT4, 2000 and so on. Typically they come in .exe format and require you to have a floppy drive, but you can work around that with the above method.

set hardware acceleration using scripts
8 jan 2009 16:38

If you have tried installing VMware Tools, you know that at the end it prompts you for changing hardware acceleration levels (which you always want to change anyways...). This is tedious process doing manually but can be automated.

Attached is a VBscript that changes the level to "Full" (just rename to .vbs and run). It works on Server 2003/2008 i assume that it works on XP/Vista/Win7 too...

I am using this script when installing VMs using MDT (the reason why it's a VBscript and not PowerShell) to automatically change hardware acceleration after VMware tools finishes installing.

If you want to check if all your current VMs have full hardware acceleration enabled, take a look at this awesome VI toolkit script from Hugo Peeters.

Note in the comments section of that post there is a description on how to change these settings directly in the .inf files for the drivers. Not tried that but sounds cool :)

booting Windows 7 from a VHD file
1 jan 2009 21:43

Update: The post is updated accordingly with the Server 2008 R2 build 7000 commands, and information on how to create/add/attach VHDs using Disk Management.

Windows 7 and Server 2008 R2 supports booting directly from a VHD file, the same kind of files used for Virtual PC/Server and Hyper-V.
This gives you the option to install and handle the installation directly in one simple file, while being able to boot and run the OS just as if it were installed in a regular harddisk.
Also you should be able to attach these installation to the above products, and boot the installation. I'm just guessing here, i have not tried that yet but i'll have a go at it.

First you need to create a VHD file. This is done using diskpart, and then afterwards you can handle the boot process using bcdedit. The following shows the commands used in the 2008 R2 (build 7000), and the Windows 7 Beta 1 (build 7000).

If you have Windows 7 installed, boot into the OS and create the VHD file

diskpart
create vdisk file=c:\vhd\win7.vhd type=fixed maximum=16000

This will create a 16GB VHD file in C:\VHD (C:\VHD\ needs to exists prior to running the command)

VHD files can also be managed using a GUI directly from the Disk Management tool. “Computer Management” and right click “Disk Management”. You should see the following options:

diskmgmt-VHD-options

create-VHD

attach-VHD
After you have created the disk file, boot your machine with the Windows 7 DVD in the drive, and choose "Install Now". Press SHIFT+F10 to get a CMD prompt. You can also choose "Repair" and start the CMD from the tools menu. Run the following to select and attach the VHD file.

diskpart
select vdisk file=c:\vhd\win7.vhd
attach vdisk

NOTE: The command for "surfacing" (crazy name if you ask me...) a VHD files has changed in the 7000 build, and is now called "attach vdisk" instead of "surface vdisk".
If you are running the above commands when installing 2008 R2 Build 6801 the command is "surface vdisk". My guess is that this will also change in comming 2008 R2 builds to attach instead.
The new beta 1 release of Server 2008 R2 (Build 7000) now also uses the “attach” command instead of surface.

After you have attached (Or surfaced the disk...) just type exit 2 times, and you will be back with the installation. When you come to the part where you choose where to install, you should see a 16GB partition. The installation will tell you that you cannot boot off this volume, just ignore and select the drive and install.

Since Windows 7 supports VHD files, it also knows when it is being installed to a VHD file. Therefore you do not need to add boot entries manually, the installation process takes care of that itself. The bad thing about this is that it makes your VHD installation the default boot option, and the entry name is "Windows 7" - just as it is for a "normal" installation.
Fear not - this can be changed using bcdedit.

When you have booted either the HDD or VHD installation, start a CMD prompt and run bcdedit with the verbose (this will show you identifier as GUID, which i find easier)

bcdedit /v

copy the ID for your VHD installation and type: (change xxxxx... to your GUID)

bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} description "Windows 7 VHD"

The above changes the description for your VHD installation to "Windows 7 VHD" so you can distingues them.

bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast

This adds the VHD installation as the last choice in the boot list. If you have multiple entries, jyst type them in your prefered order seperated by spaces, and drop the /addlast option.

If you want to add an entry for a VHD installation manually, the easiest way is to just copy an entry in the boot store

bcdedit /copy {GUID} /d "my copy"

Afterwards you can change the 2 following options to point to your VHD file:

bcdedit /set {GUID} device vhd=[C:]\vhd\win7.vhd
bcdedit /set {GUID} osdevice vhd=[C:]\vhd\win7.vhd

Thats it! Im running 2x 2008 R2 and 2x Windows 7 installation on my laptop using the above, and it works like a charm.

You can also use the diskpart command for attaching your VHD files. This way you can copy files, change settings and so on to the installation in the VHD file. Just use the select + attach/surface command. Remember you cannot attach an running VHD file.