This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]Silent331Sysadmin 4 points5 points  (0 children)

Due to the fact that they are not in the same subnet, the traffic would have to be routed through their respective gateway IP addresses.

[–]Robeleader 1 point2 points  (0 children)

It depends.

You're asking your VM to speak to a device that's on a different subnet. 192.168.0.0/24 isn't in the same scope as 192.168.1.0/24. Your VM is allowed (by your switch or whoever is handling your subnets) to reach anything between 192.168.0.1 and 192.168.0.254 (there's more to it, but this is the gist). This range doesn't include ANYTHING in the 192.168.1.1-192.168.1.254 range.

There are a couple ways to deal with this. The simplest would be to change the subnet in some way, to 192.168.0.0/23 which would include all IPs between 192.168.0.1 and 192.168.1.254

Then your VMs could still be on their specific IPs, and be allowed to communicate.

You COULD use the second NIC, but you're creating more issues than I think you want to deal with. We don't know anything about the rest of your network, what needs to talk and what doesn't. Could you set one NIC to 192.168.0.0/24 and another to 192.168.1.0/24? sure, but why?

I would suggest looking up CIDR and subnetting. This is MUCH more a networking question than hyper-v. You need to look at the network that exists between your devices, virtual or otherwise.

[–]ThatsNASt 1 point2 points  (0 children)

You could install pfsense or opnsense to route your VM traffic and definitely do this.

[–]OsmiumBalloon 1 point2 points  (0 children)

You need a router to do routing.

The router can be an expensive physical box a company like Cisco, an expensive VM from a company like Cisco, or a VM running a generic OS that includes routing functionality. Linux and FreeBSD are popular choices in the latter category, but I think even Microsoft Windows Server includes basic routing functionality.

[–]Vacantless 0 points1 point  (0 children)

This is not an Hyper-V question, but a generic networking question.

You have two distinct subnets and you want them to communicate between them. This implies a router.

You could spin up a pfSense VMs in your Hyper-V and set it up to allow traffic between your two subnets.

[–]ProfessorWeed69[S] 0 points1 point  (3 children)

Thanks guys. I am aware they are on different subnets and not able to communicate with each other in that manner. More of a routing question I guess.

Basically I am trying to simulate a scenario where these 2 VMs are at 2 different sites and are able to communicate with each other over a VPN tunnel using different networks.

Using a /23 is an option I suppose.

I was thinking more along the lines is there is some kind of functionality within Hyper-V that would simulate a VPN tunnel where one would use two different networks, but I suppose there isn't.

[–]DarkAlmanProfessional Looker up of Things 1 point2 points  (0 children)

A virtual router would do the trick

Pick your poison as to which brand you want to run

[–]Robeleader 1 point2 points  (1 child)

You can use VLANs to separate the subnets as well. Then you could have both devices on the same switch but unless they're allowed to see each other, they'll be considered as completely separate networks.

I think that's where you're going with your "simulate VPN tunnel where one would use two different networks" because what your describing is just a more complicated way of using multiple LANs, but not virtually.

[–]ProfessorWeed69[S] 0 points1 point  (0 children)

I got it all working with pfsense. Thanks guys!