Adding DHCP Option 119 (Domain Search List) to Windows Server 2008 R2

If you’ve seen my recent blog post on making Android work in Hyper-V you will have seen my problems around DNS resolution when in the office. That turned out to be down to the DHCP options being handed back by our Server 2008 R2 box. Or rather, it was what wasn’t being handed back to the client that was the problem.

Linux (and Apple OSX, as it turns out) both want a response to option 119, which defines the domain suffix search order. Windows does not request this option and the windows DHCP server does not offer the option at all.

There are a few locations on the web that talk around this but none properly document the process of adding the custom option to your DHCP server and more importantly, exactly how to encode the response (thanks go to Matt for describing that one in enough detail!).

What option 119 looks like

Option 119 hands back a byte array that encodes the domain suffix. The trouble is, it’s not a simple matter of turning text into ascii hex values. There is a structure to it.

Our domain is I found a handy web site that sped up the process of getting the hex of that.

b l a c k m a r b l e . c o . u k
0x62 0x6c 0x61 0x63 0x6b 0x6d 0x61 0x72 0x62 0x6c 0x65 0x2e 0x63 0x6f 0x2e 0x75 0x6b

The client expects the full domain to be split (get rid of the separating periods), with each section prefixed by it’s length (e.g. 11 blackmarble 2 co 2 uk) and then the whole string is null terminated.

  b l a c k m a r b l e   c o   u k  
0x0b 0x62 0x6c 0x61 0x63 0x6b 0x6d 0x61 0x72 0x62 0x6c 0x65 0x02 0x63 0x6f 0x02 0x75 0x6b 0x00

Adding the option to Server 2008 R2

To add the DHCP option to Windows Server 2008 R2 you need to add a new option to the IPV4 section. Select ‘Set Predefined Options’ from the context menu on the IPV4 heading beneath the name of the server in the DHCP console.

dhcp option menu

In the dialog that appears, click the Add button.

dhcp options add

Enter the name for new option. It needs to be of type Byte and make sure you check the array option; the Code is 119 and you can add a description if you want to.

dhcp add new option

Once you’ve defined the option you can add it either to the main Server Options section, a scope or an individual address reservation.

119 server options

Each of the hex values you worked out (see my examples) needs to be added in turn to create the full byte array.

Hopefully this pulls all the necessary information into one handy reference and it saves somebody else the confusion I experienced.

A Virtual Ice Cream Sandwich: Android 4 x86 in a Hyper-V VM

More and more of our projects include a stipulation from the client that any web sites must work on the tablet devices of senior management. Up until recently that was exclusively iPads, but we are now seeing more Android devices out there. I wanted to find a straightforward way for us to test on such devices, preferably without needing to build up a collection of expensive physical kit.

I read with interest Ben Armstrong’s post about running Android 2.2 (Froyo) in a VM using a build from the Android x86 project. I started my journey by replicating his steps, so I won’t document any of that here, other than to note that the generic x86 build you need is now a deprecated one, so I had to hunt a little to find what I needed.

Creating the VM was a doddle. However, once I’d got things up and running I hit a snag: The sites I needed to test were hosted on SharePoint and required authentication. The web browser on the Android 2.2 build steadfastly refused to present a logon dialog for any sites. I could rework my test sites with anonymous access or forms-authentication but that didn’t fill me with enthusiasm. I wondered, then, if a later Android version might be my salvation.

That in itself led to a long time spent digging around the corners of the internet: The Android x86 project has a number of Ice Cream Sandwich builds but all are targetted at various types of hardware device and whilst all had support for wifi, none had support for ethernet. Since I can’t present a wifi device within the Hyper-V VM I had to look elsewhere.

The build I finally used was one I found at – an Android 4 build with experimental ethernet support.

I ran through a number of installations as I edged my way through the different options each time I found that a choice I’d made prevented me from making some essential tweak. To save you all the effort, I’ve documented the steps here. Since I was a complete Android novice I’ve taken the approach of showing screenshots of every step for other novices like myself.

Step 1: Getting things installed

The Virtual Machine we need to create doesn’t have to be powerful. However, we are running an OS that is not Hyper-V aware, so we can’t just go with the defaults.

I created a machine with 512Mb of RAM and a single processor. I started with a 16Gb virtual disk as the hard drive but after a few passes I increased that to 32 to give me some headroom should I want to install apps later. The important step, however, is that you need to add a Legacy Network Adapter and remove the standard virtual adapter that Hyper-V will add.

hyper-v settings

Once you’ve got your VM built, insert the ISO for the Android 4 build into the DVD drive and boot the machine.

Select the option to install Android to the hard disk of the machine.


On the next screen choose Create/Modify partitions


In the partition editor, left and right cursor keys will move between the menu items; enter will select. Choose New to create a new partition.


You want to create a new primary partition


The utility defaults to the full size of the disk. Simply hit enter to confirm that.


Now we have our partition we need to mark it as bootable.


And finally we need to write the changes out to disk.


Now we have our partition we can exit the utility to continue the installation.


The installer will now show our new partition and allow us to select it as the target for the installation.


We then need to choose what format to use for the installation. I used ext3. I did try NTFS once, thinking that I could easily transfer files onto the system, but when I attached the VHD windows failed to recognise the file system, so I went back to Ext3, figuring I’d simply transfer stuff over the network.


Unsurprisingly, the installer asks for confirmation of the format.


Then it shows progress as it formats.


Next you need to install the Grub bootloader. Honestly, I’ve not tried without this, but I modify the bootloader options later so unless you want to plough your own furrow, install Grub.


The default option at the next step is to install the system directory as read only. I discovered very quickly that some of the things I might need to fiddle with are in that system directory so I’ve chosen to make it writable.


Now the installation occurs.


Once the installation is complete you should choose to create a fake SD card. I learned the hard way that if you don’t, saving stuff in your Android web browser won’t work.


Sadly the largest size we can create is 2Gb, which conveniently is the default.


Once again we get a progress bar whilst the SD card image is created.


Now we’re all done and we get the option to reboot. Note that you can’t eject the installation media yet – it’s locked, so you’ll have to reboot.


When the VM reboots you’ll be back at the first screen, allowing to choose to install or run the live CD. Turn the VM off so you can eject the media.

At this point the installation is done. You have a shiny new Android VM running Ice Cream Sandwich.

Step 2: The Android wizard

This isn’t difficult at all, other then you need to remember that when you click on the VM to capture the mouse, it’s really emulating your finger. That means that you need to click and drag in drop down menus. I also discovered that the right mouse button seems to act as the hardware back button. Clicking the mouse is equivalent to tapping with your finger.

I set the language to UK English as my first step.


Then the wizard will burble for a little while.


I chose to automatically set the time. Think grey outlines of check boxes are hard to see when they are on a black background!


The next step allows you to use your Google account to keep settings an stuff. I’m building a VM that will be generic and used by lots of people so I skip this one.


I am happy to use location services though – we want to use this thing for testing, after all.


Again, because this is a build for lots of users I’ve put the company in as the owner name. Note that even though we chose United Kingdom as the location, the keyboard setting is for a US keyboard.


Next we get an obligatory screen where we agree to stuff…


…and we’re done.


The system helps you through how to use it. The import bits are the icons at the bottom. The upward pointing outline of an arrow in the middle brings you back to the home screen.


A handy tip

This thing feels a lot like Linux to me. Conveniently, pressing alt+f1 will switch to a console screen. Alt+left arrow and alt+right arrow will switch between consoles and the graphical UI.

Inside the console you can use familiar tools like ping and nslookup. It’s not a full-fat linux box, mind you. The two commands I find myself using most in the console are reboot and halt. Odd that there’s no way to cleanly shutdown – no shutdown command or even an old school init 0!

A couple of minor hiccups

Having got my VM up and running and gone through the startup wizard in Android there were a few things not quite right. First of all the screen resolution was too low at only 800×600. Step forward my very rusty Linux experience and my much less rusty internet research expertise!

More worryingly, when I boot the machine it doesn’t always pick up the correct DNS settings.  Research showed that to be much more interesting. Strangely, things worked at home but not in the office. Research showed that it was to do with the DHCP responses being different on the two networks: The office network was not responding to the request for DHCP option 119 – domain suffix search order. Fixing that solved the problem (but that’s another can of worms and I’ll write up a separate post about that one!).

Step 3: Setting the screen resolution

This one turned out to be quite easy, although it involves using Vi, which is a text editor whose arcane commands I have very limited knowledge of.

The first thing we need to do is find information about what display modes are available. To do this we boot the VM and use the options available to modify the boot parameters. Be aware that when you boot the VM the Grub screen only shows for a few seconds before the first option is booted automatically. When you see the screen below, hit the ‘a’ key to easily append options to the boot command.


When you hit ‘a’ you will be presented with the boot command to edit. Options on the command line are separated by spaces. Add a new one: vga=screen31

Hit the enter key and the OS will boot. You will see a black screen with a number of options on it. Hit enter again at this screen in order to view the display modes available to us.


From the list of available modes, choose the one you want to use. The system is waiting for you to type in the three character hex code for the mode you wish to use. For 1024×768 at 32 bit, for example, enter 318


Assuming all works correctly  you will see Android running in your chosen resolution. Sadly, it’s not permanent yet. I’ve also become paranoid enough that before I edit the bootloader options permanently I like to try what I’m going to do first.

Reboot the system and hit ‘a’ to append boot options. This time we want to specify the display option we want to use. Just to bend your head a little, the boot option needs the decimal equivalent of the hex value that the display modes screen showed us. For Our 1024x768x32, the hex was 318. The decimal is 792, so we append vga=792 to the boot options.


When Android boots, you should see it in 1024×768 once more:


Now we need to make the change permanent. To do that we need to edit the configuration file that the Grub bootloader uses.

To do that we need to reboot the system in debug mode.

Boot the system and use the cursor keys to select the second option on the boot menu.


The system will boot to a command shell:


Once you’re in the command prompt, typing clear will clear the screen and get rid of the boot messages. Then you need to enter the following commands:

cd /

mount –o remount,rw /mnt

cd /mnt/grub

vi menu.lst

What does that lot do? The part of the filesystem that stores the bootloader is attached as read-only. The mount command effectively detaches and reattaches that part of the filesystem so we can modify it. The files we want are in the grub folder within mnt. Finally, we open the text editor Vi to change the file.

Vi is a bit arcane, although extremely powerful. For help with the commands look at online tutorials, like the one hosted by Washington University.

Once we’re in the config file we are going to add the vga=792 option to the end of the default boot command. I’ll tell you what Vi commands I use to get the job done – note that they are not necessarily the best ones, they just work for me. I know about half a dozen Vi commands and they allow me to get by. If I want to do something clever I have to look it up!


In Vi, the cursor keys allow you to move around the file. Pressing escape tells Vi to listen for commands. Move down to the start of the first line of the first boot section (the first occurrence of ‘kernel’). Press Esc then ‘o’. That should give you a new line after kernel.


Now use the cursor keys to navigate to the end of that first ‘kernel…’ line and you should be able to type ‘ vga=792’


Now we want to get rid of that extra line. Move the cursor to the start of it and hit Esc then dd (escape then hit ‘d’ twice).

Finally we save the file. Esc+:wq is the command to write out the file and quit.


You should now find yourself back at the command prompt. Type reboot –f to reboot the system.

You should now find that by default your Android VM boots into your chosen resolution.

A quick side note

If you don’t have control over your own DHCP server you can use the following command to poke the dns into life:

setprop net.dns1 x.x.x.x where x.x.x.x is the IP address of your DNS. You can also add a second with net.dns2.

You can also give the VM more memory with no issues – mine now runs with 1024Mb. I’ve also added a second CPU core as an experiment which works but I’m not sure it’s any quicker.

Tweaking my Lenovo x220 Tablet and running Windows 8

A short while ago I replaced my trusted by heavy Acer laptop with a Lenovo x220 tablet. After a couple of months running windows 8 I’m ready to put my thoughts into words.

If you’ve landed on this post looking for notes on Windows 8 drivers for the x220, skip to the end. UPDATE 12/06/2012 – added some points to the Windows 8 section.

A painful purchase

Nothing could have prepared me for the deeply unpleasant experience of actually purchasing my new tablet. The Lenovo UK site is shockingly bad at providing the information and options you need. Examples include (some of which bit me!):

  • Confusing information about specification and options. I still don’t actually know whether I have USB 3 or not – the product page suggests yes; the lack of identified hardware suggests not.
  • Appalling lack of detail on options and accessories. I ordered the docking base – there was only one choice. Nowhere did it say that I could have one with an optical drive. If I want to get a DVD now, it’s another £130!
  • Confusing information on critical choices. I still don’t understand the screen choices. I think I messed up on this – all the notes said five-point multitouch but Windows reckons I have only two-point. I got the standard screen because nothing I read said I needed anything but that. This is the one that might well bite me, so be careful!

However, on the plus side I was lucky enough to get a honking great discount off the final price thanks to lucky timing. The discount more than covered the cost of the extras I added post-purchase.

A solid platform

What I did manage to do was some research before my purchase. Lenovo will only ship the x220 with up to 8Gb of RAM. If that had been the maximum I could stuff into the system, I would have walked away. In fact, it will work quite happily with 16Gb, installed in the form of two 8Gb SODIMMS. Mine are Corsair, from my local supplier, and it works just great. Coupled with the dual core with hyper-threading Core-i7 option I chose from Lenovo, this thing is quick and great for VMs.

Less useful was the discovery that the x220 can only take 7mm drives. I had a 750Gb hybrid drive in the Acer that I wanted to use, so I order the x220 with the basic 320Gb drive. When I tried to fit the hybrid drive I found that I couldn’t.

It turns out that 7mm drives are actually quite hard to find in reasonable capacities, and I quickly learned that the 320 was definitely not fast enough and not really big enough. Step forward my second addition to basic spec – a 512Gb Crucial M4 solid state drive. That actually took some digging as well – the Crucial UK site denied the existence of any 7mm SSDs in their range. I got mine from Amazon in the end. What did we ever do before internet search engines?

The end result is a shockingly quick, light and flexible laptop that gives me over six hours of battery life and can comfortably run the battery of virtual machines I use for demo, customer work and testing.

Would I recommend the x220?

In a word, definitely. Would I recommend the Lenovo web site to purchase it from? Probably not. If you can reach out to a product specialist for advice I would strongly suggest you do so. Not only that, but I type this the week after the x230 was announced, with Ivy Bridge and other new-tech goodies. Am I disappointed to have bought ‘too soon’? A little bit, but you can wait forever in this business – something shinier is always around the corner, and I needed something pretty urgently when I bought the x220.

Overall, it’s good kit. It’s light, with a small, light power charger. It’s quick enough for development and running VMs – something I do a lot of. The convertible design means its ready for Windows 8 but doesn’t sacrifice that wonderful Lenovo keyboard for when I need to write documentation. The screen is bright and crisp, and whilst I would love more pixels (it’s only 1366×768) I’ve not been frustrated by lack of screen real estate.

Running Windows 8 on the x220

My first install of Windows 8 was before Lenovo released their suite of beta drivers. More on those in a while. I started with a clean disk and installed Windows 8 Consumer Preview. Not unexpectedly, the bulk of the devices were located and installed by the OS – display, networking etc. However, the WWAN, bluetooth, tablet buttons and a few others were not found.

I had to work through the drivers from Lenovo, installing pretty much everything including software. It’s irritating that there is no way to change the state of the wireless radios other than software. There’s a ‘flight-mode’ button on the x220 but everything else is controlled by the Lenovo apps. That means installing pretty much all the battery of crapware Lenovo ship in order to merely use the stuff the laptop ships with.

However, once it was all installed I was very happy. The arsenal of Lenovo stuff meant that startup was slow, but once up it was quick. Hyper-V installed with no problems and the Windows 8 UI was lovely to use with the touch screen.

With hindsight, I should have left it like that. Except Lenovo released their beta drivers, and I decided to install them.

True to form, disaster struck when I was on the other side of the world, in California. The fault manifested as a corrupted hard drive. The OS was beyond repair, so I had to salvage what data I could onto a pod that thankfully I always carry. With the help of others around me I managed to get a USB stick with Windows 8 CP on to rebuild. That night I spent a while in my hotel room fiddling with drivers again.

It ran, but it was flaky after that, so this week I decided to methodically rebuild and be sparing with the software.

x220 driver step-by-step

I now have a solid, quick, tidy install of Windows 8 on my laptop. I only installed two pieces of Lenovo software in addition to the beta hardware drivers (and you could argue that one of those is a driver as well).

UPDATE: I had some stability problems shortly after installing the Release Preview. Upgrading the firmware to the latest version fixed them.

  • Install the OS clean. Don’t mess around with upgrades – take off and nuke the site from orbit; it’s the only way to be sure!
  • Get all the Windows Updates done first. You should find that takes care of the Conexant Audio driver and the Lenovo monitor driver.
  • Download the drivers from the Lenovo Windows 8 beta drivers page that list the x220.
  • Start with the Intel Rapid Storage driver and the chipset drivers, then install the rest. The Tablet Button drivers are important if you want to be able to rotate the screen.
  • Download the latest version of Lenovo ThinkVantage Access Connections from the x220 support page. That’s the only way I’ve found to manage the wireless connections (especially my Ericsson WWAN card, for which there seems no other way to establish a 3G mobile data connection).

What doesn’t work after this lot? Just the bluetooth, which refuses to install the drivers because it’s not enabled, but without the software won’t enable. Ah well. I can live with that for now.

UPDATE: Upgrading the firmware reset the bluetooth status. Installing the Lenovo Hotkey Utility after everything else has now given me full control of all wireless radios. Whilst I was at it, I tracked down the last unknown device as being the power management interface. I installed the Power Management Driver (Note: not the Lenovo Power software, just the driver) and all is fine. With all the radios off I’m getting at least 6 hours if not more.

Notice that I avoided the Lenovo Power Management (software), tablet menu, active protection and many other software utilities. My experience has been that they add very little whilst significantly slowing boot time.