Hyper-V添加访问控制列表ACL,hyper-v上绑定IP+MAC

Add-VMNetworkAdapterAcl
Creates an ACL to apply to the traffic through a virtual machine network adapter.
注:只能在Hyper-V主机上添加ACL,无法在VMM服务器上全局添加

Example 1

This example adds an ACL to allow virtual machine Redmond to send to and receive from traffic on IP subnet 10.0.0.8/8.

PS C:> Add-VMNetworkAdapterAcl –VMName Redmond –RemoteIPAddress 10.0.0.0/8 –Direction Both –Action Allow

Example 2

This example adds an ACL to deny virtual machine Redmond to send either IPv4 or IPv6 traffic to anywhere and receive such traffic from anywhere.

PS C:> Add-VMNetworkAdapterAcl –VMName Redmond –RemoteIPAddress ANY –Direction Both –Action Deny

Example 3

This example gets virtual machine Redmond and adds an ACL to deny it to send any traffic to a device with MAC address 03-0f-01-0e-aa-b2 or to receive any traffic from that device.

PS C:> Get-VM Redmond | Add-VMNetworkAdapterAcl -RemoteMacAddress 03-0f-01-0e-aa-b2 -Direction Both -Action Deny

Example 4

This example gets virtual network adapters from virtual machine Redmond and adds an ACL to meter outgoing traffic sent to IP subnet 192.168.0.0/16.

PS C:> Get-VMNetworkAdapter -VMName Redmond | Add-VMNetworkAdapterAcl -RemoteIPAddress 192.168.0.0/16 -Direction Outbound -Action Meter

From:

Windows Server® 2012 R2 中用于 Hyper-V 虚拟交换机的新增功能之一是扩展端口访问控制列表 (ACL)。你可以在 Hyper-V 虚拟交换机上配置扩展 ACL,以允许和阻止传往及传自通过虚拟网络适配器连接到交换机的虚拟机 (VM) 的网络流量。创建规则时,可以使用 参数来确定 Hyper-V 虚拟交换机处理规则的顺序。 的值以整数表示;先处理整数较大的规则,再处理整数较小的规则。例如,如果你向 VM 网络适配器应用了两个规则,其中一个规则的权重为 1,另一个规则的权重为 10,则先应用权重为 10 的规则。
下面两个示例说明了如何使用 Windows PowerShell 命令创建规则。第一个示例规则将阻止传往名为“ApplicationServer”的 VM 的所有流量。第二个示例规则将应用到名为“ApplicationServer”的 VM 的网络适配器,该规则只允许该 VM 的入站 RDP 流量。

Add-VMNetworkAdapterExtendedAcl –VMName “ApplicationServer” –Action “Deny” –Direction “Inbound” –Weight 1
Add-VMNetworkAdapterExtendedAcl –VMName “ApplicationServer” –Action “Allow” –Direction “Inbound” –LocalPort 3389 –Protocol “TCP” –Weight 10

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值