IIS IP地址限制子网掩码

问题描述 投票:0回答:1

我有以下ipv4和ipv6地址范围,我需要将其放入web.config以限制对它们的访问。

103.21.244.0/22
2400:cb00::/32
2a06:98c0::/29

这是正确的方法吗?我不确定的是如何处理子网掩码。我用https://www.tunnelsup.com/subnet-calculator/来计算合适的面具。由于在我的生产现场出现故障之前无法对此进行测试,因此我需要提前知道我是否做了正确的事情。

<system.webServer>
    <security>
      <ipSecurity allowUnlisted="false" denyAction="NotFound" xdt:Transform="Insert">
        <clear/>
        <add ipAddress="103.21.244.0" subnetMask="255.255.252.0" allowed="true"/>
        <add ipAddress="2400:cb00::" subnetMask="FFFF:FFFF::" allowed="true"/>
        <add ipAddress="2a06:98c0::" subnetMask="FFFF:FFF8::" allowed="true"/>
      </ipSecurity>
    </security>
  </system.webServer>
.net iis
1个回答
1
投票

最简单的方法是在/xx中输入subnetMask位。像这样:

<system.webServer>
    <security>
        <ipSecurity allowUnlisted="false">
            <add ipAddress="10.46.0.0" subnetMask="16" allowed="true" />
            <add ipAddress="2001:44b8:3168:9b::" subnetMask="56" allowed="true" />
        </ipSecurity>
    </security>
</system.webServer>

我通过在IIS管理器中输入IPv6地址,然后查看C:\Windows\System32\inetsrv\Config\applicationHost.config中的配置来选择此项。

© www.soinside.com 2019 - 2024. All rights reserved.