前缀

Prefix 指定哪一 NextHop 的目标 IP 地址使用指定路由。

前缀长度以位为单位指定。 前 n 位之后的前缀地址的所有位(其中 n 为前缀长度)必须为零。

注意:对于 IPv6 协议,前缀长度为 64,但有一个例外。 如果前缀地址的前 16 位为零,则前缀长度可以在 0128 之间变化。

必须按以下顺序添加 Route 下的设置:标识符指标NextHopAddress,然后是前缀。 将无人参与文件保存在 Windows SIM 中后,在 XML 文件中验证输出是否按正确的顺序显示,如下面的 XML 示例中所示。

前缀

指定路由的前缀。 前缀是一个字符串,其最大长度为 49 个字符。

可以通过以下方式之一输入前缀:

  • 作为整数。

    前缀的值是 IP 地址中必须匹配的位数。 例如,如果 NextHop IP 地址为 12.34.0.0,前缀为 16(通常写为:12.34.0.0/16),则发送到 12.34.*.\* 地址的任何流量都通过该路由,(服从于强主机模型和路由指标)。 12.34.0.0 是要进行比较的地址部分,而 16 是必须匹配的位数。

  • 作为字符串。

    将前缀设置为字符串时,不需要设置 NextHopAddress 值。

该字符串类型不支持空元素。 请勿为该设置创建空值。

有效配置阶段

specialize

windowsPE

父层次结构

Microsoft-Windows-TCPIP | 接口 | 接口 | 路由 | 路由 | 前缀

应用于

有关此组件支持的 Windows 版本和体系结构的列表,请参阅 Microsoft-Windows-TCPIP

XML 示例

以下 XML 输出演示如何将网络路由 TCP/IP 前缀配置为整数。

<Prefix>16</Prefix>

以下 XML 输出演示如何将 IP v4 网络前缀配置为字符串。

<Prefix>192.168/16</Prefix>

以下 XML 输出演示如何配置 TCP/IP 接口,包括整数格式的路由前缀。

<Interfaces>
   <Interface wcm:action="add">
      <Ipv4Settings>
         <DhcpEnabled>true</DhcpEnabled> 
         <Metric>20</Metric> 
         <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 
      </Ipv4Settings>
      <Ipv6Settings>
         <DhcpEnabled>false</DhcpEnabled> 
         <Metric>30</Metric> 
         <RouterDiscoveryEnabled>true</RouterDiscoveryEnabled> 
      </Ipv6Settings>
      <Identifier>123</Identifier>
      <UnicastIpAddresses>
        <IpAddress wcm:action="add" wcm:keyValue="1">192.168.0.1/24</IpAddress>
        <IpAddress wcm:action="add" wcm:keyValue="2">ffff:1::3/48</IpAddress>
      </UnicastIpAddresses>      <Routes>
         <Route wcm:action="add">
            <Identifier>1</Identifier> 
            <Metric>10</Metric> 
            <NextHopAddress>12.34.0.0</NextHopAddress> 
            <Prefix>16</Prefix> 
         </Route>
         <Route wcm:action="add">
            <Identifier>10</Identifier> 
            <Metric>29</Metric> 
            <NextHopAddress>12.34.56.0</NextHopAddress> 
            <Prefix>24</Prefix> 
         </Route>
      </Routes>
   </Interface>
   <Interface wcm:action="add">
      <Ipv4Settings>
         <DhcpEnabled>true</DhcpEnabled> 
         <Metric>20</Metric> 
         <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 
      </Ipv4Settings>
      <Ipv6Settings>
         <DhcpEnabled>false</DhcpEnabled> 
         <Metric>10</Metric> 
         <RouterDiscoveryEnabled>true</RouterDiscoveryEnabled> 
      </Ipv6Settings>
      <Identifier>456</Identifier>
       <UnicastIpAddresses>
         <IpAddress wcm:action="add" wcm:keyValue="1">123.45.67.8</IpAddress> 
         </UnicastIpAddresses>
      <Routes>
         <Route wcm:action="add">
            <Identifier>1</Identifier> 
            <Metric>10</Metric> 
            <NextHopAddress>12.34.0.0</NextHopAddress> 
            <Prefix>16</Prefix> 
         </Route>
      </Routes>
   </Interface>
</Interfaces>

以下 XML 输出演示如何配置 TCP/IP 接口,包括字符串格式的路由前缀。

<Interfaces>
   <Interface wcm:action="add">
      <Ipv4Settings>
         <DhcpEnabled>true</DhcpEnabled> 
         <Metric>20</Metric> 
         <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 
      </Ipv4Settings>
      <Ipv6Settings>
         <DhcpEnabled>false</DhcpEnabled> 
         <Metric>30</Metric> 
         <RouterDiscoveryEnabled>true</RouterDiscoveryEnabled> 
      </Ipv6Settings>
      <Identifier>123</Identifier>
      <UnicastIpAddresses>
        <IpAddress wcm:action="add" wcm:keyValue="1">192.168.0.1/24</IpAddress>
        <IpAddress wcm:action="add" wcm:keyValue="2">ffff:1::3/48</IpAddress>
      </UnicastIpAddresses>      <Routes>
         <Route wcm:action="add">
            <Identifier>1</Identifier> 
            <Metric>10</Metric> 
            <Prefix>12.34/16</Prefix> 
         </Route>
         <Route wcm:action="add">
            <Identifier>10</Identifier> 
            <Metric>29</Metric> 
            <Prefix>12.34.56/24</Prefix> 
         </Route>
      </Routes>
   </Interface>
   <Interface wcm:action="add">
      <Ipv4Settings>
         <DhcpEnabled>true</DhcpEnabled> 
         <Metric>20</Metric> 
         <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> 
      </Ipv4Settings>
      <Ipv6Settings>
         <DhcpEnabled>false</DhcpEnabled> 
         <Metric>10</Metric> 
         <RouterDiscoveryEnabled>true</RouterDiscoveryEnabled> 
      </Ipv6Settings>
      <Identifier>456</Identifier> 
      <UnicastIpAddresses>
         <IpAddress wcm:action="add" wcm:keyValue="1">123.45.67.8</IpAddress> 
         </UnicastIpAddresses>
      <Routes>
         <Route wcm:action="add">
            <Identifier>1</Identifier> 
            <Metric>10</Metric> 
            <Prefix>12.34/16</Prefix> 
         </Route>
      </Routes>
   </Interface>
</Interfaces>

Route