9

I rented one dedicated server (Win Server 2012) with one adapter/static IP address. I want to install Hyper-V and guest OS (Win also), that can expose some of its services to the internet. For example, guest OS will have IIS and one web site that should be available from outsite on some specific port. IIS from host OS is on port 80, and I would like to access IIS on guest OS on for example, port 8080.
How do I configure hyper-v and its external/internal virtual switch?
It is important not to change host OS IP and loose RDP, because that's only way for connecting to it (there's another way but I have to pay for it). Hosting provider is Hetzner.

0

1 Answer 1

8

According to this guide, the major steps boil down to:

  1. Configure Internal Switch
    • With Virtual Ethernet Adapter
  2. Install the Routing and RAS role: Custom Configuration
    • NAT
    • WAN: Physical Network
    • LAN: Virtual Network
    • "I will set up name and address services later"
  3. Enable NAT on physical network interface
  4. Set up DHCP

Then, somehow configure port forwarding. This should be accomplished by doing this:

netsh interface portproxy add v4tov4 listenport=8080 connectaddress=192.168.0.100 connectport=8080 protocol=tcp

Further information on this command is available here.

5
  • 1
    Win 10 guide: thomasmaurer.ch/2016/05/… docker: docker network create -d nat MyNatNetwork
    – mtman
    Jan 6, 2017 at 15:41
  • 1
    Also good to know that forwarded ports are not accessible from the host, only from the outside: github.com/Microsoft/Virtualization-Documentation/issues/…
    – mtman
    Jan 6, 2017 at 19:27
  • 1
    @mtman Interesting. I wonder why they’re not simply using the same method as on Linux: a proxy program.
    – Daniel B
    Jan 6, 2017 at 20:49
  • 1
    Not sure how it's done, but you can access a mapped port from a Docker container (Hyper-V) from localhost.
    – mtman
    Jan 15, 2017 at 13:45
  • @mtman I run Docker containers in Linux in Hyper-V in Vagrant in Windows 10. The services do get an ip number which is accessible from the host but it seems that Hyper-V can't do port forwarding so you can't use Hyper-V to map between ports e.g. 80:8080. It is mentioned in the Vagrant docs as a limitation of Hyper-V. Virtualbox can do it but only if you are admin. I think also that VMWare can do port forwarding. If you need it and there are often other ways to achieve the end mapping that you want, in my case I can use the ip number which is assigned by the system to the guest. May 5, 2018 at 2:37

Not the answer you're looking for? Browse other questions tagged .