Skip to content

Instantly share code, notes, and snippets.

@5E7EN
Created April 1, 2021 06:55
Show Gist options
  • Save 5E7EN/442a48fb20c51f358d0da0a9eb962868 to your computer and use it in GitHub Desktop.
Save 5E7EN/442a48fb20c51f358d0da0a9eb962868 to your computer and use it in GitHub Desktop.
How to connect to a remote Hyper-V host over the internet - without domain/LAN

Connect to Remote Hyper-V Host (over the internet - without domain/LAN)

  1. Setup Ubuntu Server for OpenVPN (AWS) -
    • Install via https://github.com/Nyr/openvpn-install. Be sure to run bash script as root.
    • Download OpenVPN Connect Client on computer1 and connect to VPN using generated .ovpn configuration file
    • To create another .ovpn client config (for second computer), run bash script once again but this time select option #1 (Add a new client)
    • Download OpenVPN Connect Client on computer2 and connect to VPN using generated .ovpn configuration file
    • Edit /etc/openvpn/server/server.conf and append client-to-client to end of file
    • Restart OpenVPN service (sudo service openvpn restart)
    • Allow inbound traffic over UDP port 1194 in the server firewall (AWS: https://i.imgur.com/yEIwGhO.png)
  2. Add Windows Defender Firewall exclusions to host AND client machine -
    • Open Windows Defender Firewall
    • Select "Allow and app or feature through Windows Defender Firewall" on the left sidebar
    • Locate "File and Printer Sharing" and check both boxes
    • Save and exit
  3. Ensure host and client can communicate -
    • Open cmd.exe on the host and run ipconfig /all
    • Locate entry where description looks similar to TAP-Windows Adapter V9 for OpenVPN Connect
    • Take note of the shown IPv4 Address
    • Open cmd.exe on the client and run ping followed by the host IPv4 address
    • If you see Request timed out. return to step #2 and ensure you've followed along carefully; otherwise, you may proceed with step #4.
  4. Configure Hyper-V host and client machines using instructions at https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/manage/remotely-manage-hyper-v-hosts#connect-to-a-windows-server-2016-or-windows-10-remote-host-outside-your-domain-or-with-no-domain (follow very carefully).
    • FQDN: fully qualified domain name AKA device name (found in Settings -> System -> About)
  5. Ensure host and client Windows account username and password is identical (otherwise you may encounter an error something like: You do not have the required permission to complete this task.).
  6. Map Hyper-V host IPv4 address to hostname -
    • Run Notepad/Notepad++ as administrator
    • Open HOSTS file (C:\Windows\System32\drivers\etc\hosts)
    • On a new line, enter the host IPv4 address followed by the host device name (example: https://i.imgur.com/mteeqQR.png)
  7. Connect via Hyper-V Manager -
    • Open Hyper-V Manager on the client
    • Select "Connect to Server..." on the right sidebar
    • Check "Another computer" and enter the host IPv4 address
    • Click OK to connect!

Written and tested by: 5E7EN (Simon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment