Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a server running Hyper-V R2 Core installation and a couple of VMs. The server only has 1 NIC. One VM is dedicated to handling companies bug tracking website. I have created a virtual private network for it and now I want to forward a port from host to this private network. Basically Physical NIC (port 80) -> VM on private virtual network (port 80 or 8080).

I know this is possible in VirtualBox, but this is the first time I'm dealing with Microsoft Hyper-V. So can this be done? I would really appreciate any resources you could throw at me.

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

The Hyper-V virtual network switch is just a simple layer-2 switch. It has no facility for port forwarding or any other policy that doesn't involve MAC addresses or VLAN IDs.

There are a multitude of network bridging, NAT, and other filtering solutions which run on top of Windows. You can probably find one that will forward your traffic from one network to another. Hyper-V itself provides no such functionality.

If you identify one of these, set up Hyper-V such that there is a virtual NIC in the management OS for each of the networks that you'll be forwarding traffic between. Then bind the software of your choice to those vNICs.

share|improve this answer
    
I see. Fair enough, I will have to find 3rd party software so that host would do all the routing. Thanks. –  Audrius Mar 23 '11 at 10:38
add comment

You have 3 choices in Hyper-V for the virtual network:

  • External -> it's like a public IP. Seen by the world, host and guests (as long as the guests have public access too)
  • Internal -> only seen by the host and guests. Good for a backend network or for back end servers like SQL Server that shouldn't have public access, or if the host or one of the guests acts as a router to route the traffic to the outside world for you.
  • Private -> only seen by the guests. Similar to Internal except that not even the host seems the network traffic.

So in your case, it sounds like you want to create a new Internal virtual network and add/change the network adapter for the guest to use that instead.

share|improve this answer
    
I have changed VM to use Internal virtual network instead of the private one, but how can I forward all request coming on the host machine port 80 to the VM? –  Audrius Mar 22 '11 at 18:29
1  
If you want, use an External virtual network and use your existing router for the routing. Basically the guests will become peers of your host and will have direct access to the network. You don't need to do port forwarding that way. You'll need to give it its own IP address. You can use your router's NAT capability or give it a public IP. Or, if you want to route through the host then you'll need to use something like Windows RRAS, or create a Linux install and use iptables if you're familiar with Linux (see Jake's recent post for good options). –  Scott Forsyth - MVP Mar 23 '11 at 3:28
    
Yes, I was hoping that Hyper-V core has something like iptables built-in. I'm not that familiar with windows networking and such. Thanks! –  Audrius Mar 23 '11 at 10:37
    
Hyper-V itself doesn't provide anything for you. You're on your own, but you can create a windows box and use RRAS ... or just make your VM available directly on the network, whichever works best for your situation. –  Scott Forsyth - MVP Mar 23 '11 at 16:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.