How to assign a static IP to Windows 10 Pro HyperV Guest

Published on Author JFLeave a comment

Microsoft Widows 10 Pro (currently 2004 20H1 May 2020 Update 19041) has the ability to run HyperVs.

By default, HyperVs will use the internal “Default Switch” for network connectivity and provide DHCP for the VM. It is possible, instead, to create and external switch that will then pull from your network to get DHCP.

Be warned: if you’re doing this at home it means there’s a new machine running on the network – you need to ensure that it is locked down. Also, if you do this at the office, you may be running afoul of your network security rules. Be careful.

The process of installing a new External Switch

Process is simple. Note that this could disconnect you from the network as it is now going to bind to your physical network adapter. Again, if you’re in a professional environment this might not be something you want to ask forgiveness for later.

Open Hyper-V Manager > right click > Virtual Switch Manger

Under “What type of virtual switch do you want to create?”, click External (should be default), then Create Virtual Switch.

Change the name of the switch

In the dropdown, select your physical network adapter and hit Apply or Ok.

Virtual Switch Manager for Windows Hyper-V
Windows HyperV Switch

Once the process completes, shut down your VM, then assign the new adapter and restart it.

Setting a static IP address in the VM in Centos 7

In my case (at home), I wanted to set a static IP so I could map a local hostname to it for development.

Since DHCP is now being pulled from my router, I went it and set the DHCP range from 192.168.1.2 to 192.168.1.254 to 192.168.1.2 to 192.168.1.199. So, 192.168.1.200 would be the first static IP to use.

CentOS 7 has nmtui, a simple GUI (installed by default) for editing connections (much easier IMHO that going through files). I had already disabled IPV6, but do that while you’re there if you have not. Then modify eth0 (typical card in CentOS) to static IP. Restart network.

Try pinging your new VM from your Windows machine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.