Note: This post was written on my old blog and is preserved for posterity. This was written from my time at Nasdaq, since WSL has horrendous disk performance.

Enabling Hyper-V

From Turn Windows features on and off enable the Hyper-V & NFS features. NFS is used for mounting a directory from the VM later to Windows itself, to allow for editing Linux files from Windows.

Creating an Internal network switch

Ripping instructions from ArchWiki:

# Create the internal switch with a name of VM-Internal-Switch
PS C:\\WINDOWS\\system32> New-VMSwitch -Name \"VM-Internal-Switch\" -SwitchType Internal

# Verify that the internal switch was created
PS C:\\WINDOWS\\system32> Get-VMSwitch

# Get the ifIndex of the newly created internal switch, usually named 'vEthernet (name)'
PS C:\\WINDOWS\\system32> Get-NetAdapter

# Set the IP address of the internal switch, noting the ifIndex retrieved from the previous command.
# In this example, the network address of the internal switch is, and the ifIndex is 50.
PS C:\\WINDOWS\\system32> New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceIndex 50

# The VMs using the internal switch must use static IP addresses, such as
# Support for DHCP in internal switches is not included in current Windows versions (as of Version 1703, OS Build 15063).

Now, by inspecting get-netadapter you should see a new Internal switch named VM-Internal-Switch, or whatever else you chose to name it.

Setting up Internal NAT

More ripping:

# Create the NAT with IP address of the internal switch
PS C:\\WINDOWS\\system32> New-NetNat -Name \"VM-NAT-Network\" -InternalIPInterfaceAddressPrefix

# Verify that the NAT was created
PS C:\\WINDOWS\\system32> Get-NetNat

Creating your VM

I’m not going to detail this step much, basically get an ArchLinux ISO and attach the VM to the newly created Internal switch.

Installing Arch


Within Live Install, the return of ifconfig will be something like:

Image lost to the nether

You’ll need to statically assign an IP address to eth0 by running:

ip addr add broadcast + dev eth0

Once a static IP has been assigned, you’ll notice that internet connectivity still doesn’t work. You need to also add a default route:

ip route add via dev eth0

Lastly, you’ll also need to add a nameserver to query any domain names against:

echo \"nameserver\" >> /etc/resolv.conf

If all went well, you now have network connectivity:

Image lost to the nether

Partitioning your Disk

Partition your new disk, ensure that you have at least:

  • a swap partition
  • a data partition

Create and size these appropriately using fdisk /dev/sda. Afterwards, your configuration should look something like:

Image lost to the nether

Assuming that your swap is /dev/sda1 and your main disk is /dev/sda2, format your disk as so:

mkfs.ext4 /dev/sda2
mkswap /dev/sda1
swapon /dev/sda1
mount /dev/sda2 /mnt

Initialize the base system

During this step, we’ll bootstrap the Arch install and chroot into the install:

pacstrap /mnt base
genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt

Configuring the hostname

Configure the VM’s hostname:

echo \"hostname.domain.tld > /etc/hostname

Configuring the timezone

Configure the VM’s timezone:

ln -sf /usr/share/zoneinfo/Australia/Sydney /etc/localtime

Configuring locales

Enable en_US as a locale:

sed -i 's/#en_US/en_US/g' /etc/locale.gen
echo LANG=en_us.UTF-8 > /etc/locale.conf

Create init cpio & set root passwd

mkinitcpio -p linux

Install GRUB and configure boot options

pacman -Syu grub
grub-install --target=i386-pc --recheck --debug /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Reboot your VM and, if everything went well, you should boot into Arch linux! If not, Google is your friend!

Configuring Arch

Setting up netctl

First, figure out what the interface the Hyper-V NIC is attached to. In most cases, it should be eth0.

Paste the follow config inside:

Description='Hyper-V Static NAT'
=(' via' ' via')

And enable it:

netctl enable eth0

Caveat emptor: For some reason I haven’t been able to figure out yet, on boot the link doesn’t come up, nor does the default route appear. You need to enable the link manually on boot, or through /etc/rc.local or something. Enabling the link and adding the route:

ip s l dev eth0 up
ip r a default via