Add-VMNetworkAdapterAcl(添加访问控制列表)
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:http://technet.microsoft.com/zh-cn/library/hh848505.aspx
Add-VMNetworkAdapterExtendedAcl
Windows Server® 2012 R2 中用于 Hyper-V 虚拟交换机的新增功能之一是扩展端口访问控制列表 (ACL)。你可以在 Hyper-V 虚拟交换机上配置扩展 ACL,以允许和阻止传往及传自通过虚拟网络适配器连接到交换机的虚拟机 (VM) 的网络流量。
创建规则时,可以使用 –Weight 参数来确定 Hyper-V 虚拟交换机处理规则的顺序。–Weight 的值以整数表示;先处理整数较大的规则,再处理整数较小的规则。例如,如果你向 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
From:http://technet.microsoft.com/zh-cn/library/dn375962.aspx#bkmk_detailed
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?