Hyper-v: Connect Host and Guest

Posted by John Liu on Saturday, October 14, 2023

To have network connectivity between Hyper-v host and guest, do the following steps:

  1. In Hyper-v Manager, click on Virtual Switch Manager, and create a new (if not already) Internal virtual switch. Enable VLAN ID.
  2. In the VM guest setting, configure a Network Adapter to use this Internal virtual switch.
  3. In host computer, in Control Panel, configure IPV4 address for the Internal netowrk created above step 1. No default gateway setting required.
  4. In VM guest setting, on the Network Adapter setup in above step 2, configure IPV4 address in the same range as in step 3 and using IP address in step 3 as the default gateway.

Now you have network connection between host computer and the guest VM. And no need to edit host file.

(Update:) The simple way now is to default Network Adapter to be in the same IP range as the vEthernet (Default Switch) on the hosting, and set the hosting IP address as the default gateway. You won’t have to create the above second virtual switch.

To enable HyperV connect to Internet, create an External Virtual switch on the HyperV host and bind to the physical NIC (or your WiFi NIC). Add a netowrk adapter to the VM to use this External Virtual switch.