Link to home
Start Free TrialLog in
Avatar of E C
E CFlag for United States of America

asked on

Hyper-V VM in VLAN cannot ping pfSense VM

I am setting up a test environment using Hyper-V VMs, as follows:


- W10-01 is a Windows 10 VM on the default VLAN (1). It has one network adapter, connected to a Hyper-V Virtual Switch named 'Lab01'. IP Address 192.168.22.10


(Lab01 is a Private Switch)


- W10-02 is a Windows 10 VM on VLAN 20. It also has just one network adapter. It's connected to the same Virtual Switch but the VLAN ID is set to '20'. IP Address is 10.1.1.18


The objective is to use a pfSense VM as the gateway for both VLANs, and also to allow traffic between the 2 VLANs - 192.168.22.0/24 and 10.1.1.0/24


The pfSense VM has 2 network adapters: 

- NIC 1 is connected to the same Virtual Switch as the 2 VMs above. This is the pfSense LAN interface. IP Address 192.168.22.1

- NIC 2 is connected to an External Virtual Switch. It's for the WAN interface on pfSense. IP Address is a public IP.


W10-01 can get to the internet just fine.

However W10-02 (the workstation that is on VLAN 20) cannot get to the internet.

From W10-02 I can't even ping the IP address of the pfSense 


More info:

In pfSense I created VLAN 20 and assigned it to NIC 1. So NIC 1 has 2 IP addresses - 192.168.22.1 and 10.1.1.1

As a test, I created a firewall rule that allows all traffic from VLAN 20 to anywhere, over any port. There are no explicit deny rules (yet) for VLAN 20. No NAT. No static routes.


The computer on VLAN 20 having IP address 10.1.1.18 cannot ping the pfSense at 10.1.1.1.  IP settings are manual. 10.1.1.1 is the gateway. Subnet mask is correct. Tried deleting and recreating the VLAN on pfSense. VLAN interface is enabled. What am I missing?

SOLUTION
Avatar of kevinhsieh
kevinhsieh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I didn't know know if a VM can tag traffic. Never tried.
Avatar of E C

ASKER

Set-VMNetworkAdapterVlan -VMName pfVM -VMNetworkAdapterName "InternalNic" -Trunk -AllowedVlanIdList "1,20" -NativeVlanId 1

Open in new window


Now this network adapter can carry traffic on VLAN 1 and VLAN 20
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of E C

ASKER

kevin - yeah you're right. It's definitely not on VLAN 20. I just couldn't figure out how to get it to work. At one point I did add a third NIC and put that NIC on VLAN 20. But pfSense is kinda new to me and it appeared that you had to add a VLAN and then assign it to an interface (that makes sense). But even after I gave the interface the static IP 10.1.1.1  I could not get it to work. I was probably missing something. I ended up deleting the third interface from the VM.

Philip, looks like we both had the same idea. The only catch was this: When you add multiple network adapters to a VM (using Hyper-V Manager), Hyper-V is happy to give them all the exact same name  :-/

So I did a bit of PowerShell to get the MAC address of each NIC; then used PowerShell to rename them.
I've not experienced that.

In-guest the vNICs would be "Ethernet", "Ethernet 2", "Ethernet 3", ETC. They should not have the same MAC address.
Avatar of E C

ASKER

They have different MAC addresses. That's how I was able to distinguish one from the other. They all get the same default name 'Network Adapter'

User generated image
Our scripts don't pay attention to that. We delimit based on MAC Address in-guest and at the host level.