Skip to content

Commit 921a577

Browse files
Merge pull request #124406 from mateburu/patch-1
Update configure-mirror-hyper-v.md
2 parents 96a8f5f + f486ca6 commit 921a577

File tree

1 file changed

+51
-9
lines changed

1 file changed

+51
-9
lines changed

articles/defender-for-iot/organizations/traffic-mirroring/configure-mirror-hyper-v.md

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,23 @@ Before you start:
3030

3131
- Ensure that the data port SPAN configuration isn't configured with an IP address.
3232

33-
## Configure a traffic mirroring port with Hyper-V
33+
## Create new Hyper-V virtual switch to relay the mirrored traffic into the VM
34+
35+
### Create a new virtual switch with PowerShell
36+
37+
```PowerShell
38+
New-VMSwitch -Name vSwitch_Span -NetAdapterName Ethernet -AllowManagementOS:$true
39+
```
40+
Where:
41+
42+
| Parameter | Description |
43+
|--|--|
44+
|**vSwitch_Span** |Newly added SPAN virtual switch name |
45+
|**Ethernet** |Physical adapter name |
46+
47+
Learn how to [Create and configure a virtual switch with Hyper-V](/windows-server/virtualization/hyper-v/get-started/create-a-virtual-switch-for-hyper-v-virtual-machines?tabs=powershell#create-a-virtual-switch)
48+
49+
### Create a new virtual switch with Hyper-V Manager
3450

3551
1. Open the Virtual Switch Manager.
3652

@@ -48,13 +64,13 @@ Before you start:
4864

4965
## Attach a SPAN Virtual Interface to the virtual switch
5066

51-
Use Windows PowerShell or Hyper-V Manager to attach a SPAN virtual interface to the virtual switch you'd [created earlier](#configure-a-traffic-mirroring-port-with-hyper-v).
67+
Use Windows PowerShell or Hyper-V Manager to attach a SPAN virtual interface to the virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm).
5268

5369
If you use PowerShell, define the name of the newly added adapter hardware as `Monitor`. If you use Hyper-V Manager, the name of the newly added adapter hardware is set to `Network Adapter`.
5470

5571
### Attach a SPAN virtual interface to the virtual switch with PowerShell
5672

57-
1. Select the newly added SPAN virtual switch you'd configured [earlier](#configure-a-traffic-mirroring-port-with-hyper-v), and run the following command to add a new network adapter:
73+
1. Select the newly added SPAN virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm), and run the following command to add a new network adapter:
5874

5975
```powershell
6076
ADD-VMNetworkAdapter -VMName VK-C1000V-LongRunning-650 -Name Monitor -SwitchName vSwitch_Span
@@ -84,17 +100,25 @@ If you use PowerShell, define the name of the newly added adapter hardware as `M
84100
85101
:::image type="content" source="../media/tutorial-install-components/vswitch-span.png" alt-text="Screenshot of selecting the following options on the virtual switch screen.":::
86102
87-
1. In the **Hardware** list, under the **Network Adapter** drop-down list, select **Hardware Acceleration** and clear the **Virtual Machine Queue** option for the monitoring network interface.
88-
89103
1. In the **Hardware** list, under the **Network Adapter** drop-down list, select **Advanced Features**. Under the **Port Mirroring** section, select **Destination** as the mirroring mode for the new virtual interface.
90104
91105
:::image type="content" source="../media/tutorial-install-components/destination.png" alt-text="Screenshot of the selections needed to configure mirroring mode.":::
92106
93107
1. Select **OK**.
94108
95-
## Turn on Microsoft NDIS capture extensions
109+
## Turn on Microsoft NDIS capture extensions with PowerShell
110+
111+
Turn on support for [Microsoft NDIS Capture Extensions](/windows-hardware/drivers/network/capturing-extensions) for the virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm).
112+
113+
**To enable Microsoft NDIS capture extensions for your new virtual switch**:
114+
115+
```PowerShell
116+
Enable-VMSwitchExtension -VMSwitchName vSwitch_Span -Name "Microsoft NDIS Capture"
117+
```
118+
119+
## Turn on Microsoft NDIS capture extensions with Hyper-V Manager
96120

97-
Turn on support for [Microsoft NDIS Capture Extensions](/windows-hardware/drivers/network/capturing-extensions) for the virtual switch you'd [created earlier](#configure-a-traffic-mirroring-port-with-hyper-v).
121+
Turn on support for [Microsoft NDIS Capture Extensions](/windows-hardware/drivers/network/capturing-extensions) for the virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm).
98122

99123
**To enable Microsoft NDIS capture extensions for your new virtual switch**:
100124

@@ -110,7 +134,7 @@ Turn on support for [Microsoft NDIS Capture Extensions](/windows-hardware/driver
110134

111135
## Configure the switch's mirroring mode
112136

113-
Configure the mirroring mode on the virtual switch you'd [created earlier](#configure-a-traffic-mirroring-port-with-hyper-v) so that the external port is defined as the mirroring source. This includes configuring the Hyper-V virtual switch (vSwitch_Span) to forward any traffic that comes to the external source port to a virtual network adapter configured as the destination.
137+
Configure the mirroring mode on the virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm) so that the external port is defined as the mirroring source. This includes configuring the Hyper-V virtual switch (vSwitch_Span) to forward any traffic that comes to the external source port to a virtual network adapter configured as the destination.
114138

115139
To set the virtual switch's external port as the source mirror mode, run:
116140

@@ -124,7 +148,7 @@ Where:
124148

125149
| Parameter | Description |
126150
|--|--|
127-
|**vSwitch_Span** | Name of the virtual switch you'd [created earlier](#configure-a-traffic-mirroring-port-with-hyper-v) |
151+
|**vSwitch_Span** | Name of the virtual switch you [created earlier](#create-new-hyper-v-virtual-switch-to-relay-the-mirrored-traffic-into-the-vm) |
128152
|**MonitorMode=2** | Source |
129153
|**MonitorMode=1** | Destination |
130154
|**MonitorMode=0** | None |
@@ -139,6 +163,24 @@ Get-VMSwitchExtensionPortFeature -FeatureName "Ethernet Switch Port Security Set
139163
|--|--|
140164
|**vSwitch_Span** | Newly added SPAN virtual switch name |
141165

166+
## Configure VLAN settings for the Monitor adapter (if needed)
167+
168+
If the Hyper-V server is located in a different VLAN than the VLAN from which the mirrored traffic originates, set the Monitor adapter to accept traffic from the mirrored VLANs.
169+
170+
Use this PowerShell command to enable the Monitor adapter to accept the monitored traffic from different VLANs:
171+
```PowerShell
172+
Set-VMNetworkAdapterVlan -VMName VK-C1000V-LongRunning-650 -VMNetworkAdapterName Monitor -Trunk -AllowedVlanIdList 1010-1020 -NativeVlanId 10
173+
```
174+
Where:
175+
176+
| Parameter | Description |
177+
|--|--|
178+
|**VK-C1000V-LongRunning-650** | CPPM VA name |
179+
|**1010-1020** |VLAN range from which IoT traffic is mirrored |
180+
|**10** |Native VLAN ID of the environment |
181+
182+
Learn more about the [Set-VMNetworkAdapterVlan](/powershell/module/hyper-v/set-vmnetworkadaptervlan) PowerShell cmdlet.
183+
142184
[!INCLUDE [validate-traffic-mirroring](../includes/validate-traffic-mirroring.md)]
143185

144186
## Next steps

0 commit comments

Comments
 (0)