IPv6 in IPv4 World

Illustration

In order to get into modern era I decided to teach my computer to talk IPv6. Windows 7 already comes with IPv6. I mean, how hard can it be?

Well, since my Internet provider does not give a **** about IPv6 first step is to get a tunnel. And there are quite a few IPv6 tunnel providers. In my case I decided to go with SixXS since they have support for both Windows 7 and (via black magic) my DD-WRT router. For Windows 7 you do need to have their AICCU client installed (and probably OpenVPN). Slight nuisance but bearable.

Once my account was ready (it took them less than a day) I created an Dynamic NAT-traversing IPv4 Endpoint using AYIYA (now repeat this really fast). All eager I awaited for confirmation. Instead of it I got “SixXS has discussed your request regarding a tunnel but have decided not to approve this request”. Nothing in mail pointed to what I did wrong. My guess was that they noticed I am trying to use Ashburn, VA (where I currently live) with my Croatian address (where I usually live). I elaborated my situation and waited for response. And waited. And waited. No response (10 days and counting).

Thus I decided to see what other brokers are out there and I found one that would work for me - Hurricane Electric. They give you up to five /64 tunnels and upon that you can additionally request /48 prefix. Their tunnel endpoints are not that numerous but I think that they offer satisfactory range.

But that is not the best thing. After reading guides for setting up SixXS I was pleasantly surprised that my configuration consisted of 4 lines:

netsh interface teredo set state disabled
netsh interface ipv6 add v6v4tunnel IP6Tunnel 192.168.1.2  10.20.30.40
netsh interface ipv6 add address    IP6Tunnel 2001:db8::1:0:0:2
netsh interface ipv6 add route ::/0 IP6Tunnel 2001:db8::1:0:0:1

And you do not need to remember those 4 lines since they will be generated automatically for you and available on Tunnel Details page. Just take care to fill first IP correctly (192.168.1.2 in this example) No additional software, no new drivers - Simplicity at it’s best.

So far I think I am convert. While SixSX has a little bit better support for dynamic IPs, things are not too bleak for Hurricane. And keep in mind that Hurricane does tunneling over protocol 41 so there is need for your network to support this (almost each one does).

In short, I would say that Hurricane Electric is much better choice if you have normal provider who does not block any traffic. In any case, I am IPv6 (and so can you). :)

ReFS

Illustration

For long time now NTFS is the system of choice for Windows. Well, that is about to change.

For upcoming Windows 8 beta we shall get Resilient File System (ReFS for friends). Features are making my head spin:

  • Compatible with NTFS application layer.
  • Data is verified and auto-corrected.
  • Live data recovery (bye, bye offline mode).
  • Transactional model.

From design point of view it looks more like unholy combination of relational database and version control than a file system (that sounds familiar). As I read I decided that it will be my new system to install Windows 8 on. And then I noticed two deal breakers: It will be available only on Windows Server 8 and you will not be able to boot of it.

At first this file system is intended for Windows Server 8 volumes only. You will boot good old NTFS and then store all your data on ReFS. And forget per-file encryption since EFS is not supported. Well, at least there is BitLocker.

My developer life is more aligned with Windows client OS than server so I will skip it for now. I just hope that ReFS will not stay limited to server but that it will find it’s way into consumer’s life also. And, Microsoft, don’t forget booting…

[2015-03-12: With Windows 8.1 you get ReFS on client Windows too.] [2017-09-05: ReFS is no longer supported on Windows 10 Pro.]

Again

Illustration

More observant among you might notice that there is already new version of VHD Attach. Those who use it on Windows 7 and Windows Server 2008 R2 have no reason to worry: only difference between versions 3.00 and 3.01 is that VHD Attach now supports Windows Thin PC.

If you happen to use Windows Thin PC than just remember to install .NET Framework 4.0 before VHD Attach and you should be just fine.

VHD Attach 3.00

Few last tweaks are completed and it is time for new version of VHD Attach.

Biggest change to this version is addition of dynamic virtual disks creation. In addition to this, application now recognizes stolen extensions and offers fix. Upgrades should also be a little bit easier since there is in-application check for new versions.

There is lot of small cosmetic adjustments. Like switching focus to Explorer upon attaching Bit Locker drive or drag&drop support in main window. And lets not forget that those who love analyzing virtual disks just got few more details about VHD.

Check it yourself.

Renaming a File

Renaming a file is quite simple job in C#. You can just call File.Move(oldPath, newPath) and it works. That is until it doesn’t. Problem with this function is that it cannot rename file that differs only in case. E.g. test cannot be renamed to Test. And believe it or not, people sometime want to change case of their file.

Solution that first comes to mind is renaming file to something temporary and then back. E.g. test will be renamed to test-temp and then back to Test. While this solution works it makes exception handling annoying. Just what are you supposed to do if there is exception after you already created test-temp?

Fortunatelly Windows API is not so restrictive. Things can be as simple as calling MoveFile function. Or in our case MoveFileEx with parameters that ensure that we can move between volumes (MOVEFILE_COPY_ALLOWED) and that function returns only after work is done (MOVEFILE_WRITE_THROUGH). Quite straightforward code indeed:

public static void MovePath(string currentPath, string newPath) {
    if (currentPath.StartsWith(@"\\?\", StringComparison.Ordinal) == false) { currentPath = @"\\?\" + currentPath; }
    if (newPath.StartsWith(@"\\?\", StringComparison.Ordinal) == false) { newPath = @"\\?\" + newPath; }
    if (NativeMethods.MoveFileExW(currentPath, newPath, NativeMethods.MOVEFILE_COPY_ALLOWED | NativeMethods.MOVEFILE_WRITE_THROUGH) ==  false) {
        var ex = new Win32Exception();
        throw new IOException(ex.Message, ex);
    }
}

internal static class NativeMethods {
    public const uint MOVEFILE_COPY_ALLOWED = 0x02;
    public const uint MOVEFILE_WRITE_THROUGH = 0x08;


    [DllImportAttribute("kernel32.dll", EntryPoint = "MoveFileExW", SetLastError=true)]
    [return: MarshalAsAttribute(UnmanagedType.Bool)]
    public static extern bool MoveFileExW([InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpExistingFileName, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpNewFileName, uint dwFlags);
}