前置詞

Prefix 指定 NextHop 的目的地 IP 位址使用指定的路由。

前置長度是以位指定。 前 n 個位之後的所有前置詞位址位 (,其中 n 是前置長度) 必須是零。

注意 針對 IPv6 通訊協定,前置長度為 64,但有一個例外。 如果前置詞位址的前 16 位為零,前置長度可能會介於 0128之間。

[路由] 底下的設定必須依下列順序新增:IdentifierMetricNextHopAddressPrefix。 在 Windows SIM 中儲存您的自動安裝檔案之後,請在 XML 檔案中確認輸出是以正確的順序顯示,如下列 XML 範例所示。

Prefix

指定路由的前置詞。 前置詞 是長度上限為 49 個字元的字串。

您可以透過下列其中一種方式輸入前置詞:

  • 整數。

    Prefix 的值是 IP 位址中必須符合的位數。 例如,如果 NextHop IP 位址是 12.34.0.0, 而 Prefix 是 16 (通常會寫入: 12.34.0.0/16) ,則任何傳送到 12.34.*.\* 位址的流量都會通過該路由 (受限於強主機模型和路由計量) 。 12.34.0.0 是要比較之位址的一部分,而 16 是必須相符的位數。

  • 做為字串。

    當 Prefix 設定為字串時,您不需要設定 NextHopAddress 值。

這種字串不支援空的元素。 請勿為這種字串建立空值。

有效的設定階段

特殊化

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>

路由