Updated on 2025-07-25 GMT+08:00

Manually Configuring IPv4 and IPv6 Policy-based Routes for a Windows ECS with Multiple Network Interfaces

Scenarios

This section describes how to configure policy-based routes for a Windows Server 2012 64-bit ECS with two network interfaces.

For details about the background knowledge and networking of an ECS with two network interfaces, see Overview.

Configuring IPv4 Policy-based Routes for a Windows ECS

  1. Collect the ECS network interface information required for configuring policy-based routes.

    For details, see Collecting ECS Network Information.

    In this example, the network information of the ECS is shown in Table 1.

    Table 1 Windows ECSs using IPv4 addresses

    Type

    Primary Network Interface

    Extended Network Interface

    Source

    • IPv4 address: 10.0.0.59
    • Subnet IPv4 gateway: 10.0.0.1
    • IPv4 address: 10.0.1.104
    • Subnet IPv4 gateway: 10.0.1.1

    Destination

    IPv4 address: 10.0.2.12

    N/A

  2. Log in to the source ECS.

    For details, see How Do I Log In to My ECS?

  1. Check whether the source ECS can use its primary network interface to communicate with the destination ECS:

    Before configuring policy-based routes, ensure that the source ECS can use its primary network interface to communicate with the destination ECS.

    ping -S <IP-address-of-the-primary-network-interface-on-the-source-ECS> <IP-address-of-the-destination-ECS>

    In this example, run the following command:

    ping -S 10.0.0.59 10.0.2.12

    If information similar to the following is displayed, the source ECS can use its primary network interface to communicate with the destination ECS.

  2. Configure a policy-based route for the extended network interface.

    route add -p 0.0.0.0 mask 0.0.0.0 <subnet-gateway-of-the-extended-network-interface> metric <route-priority>

    Configure the parameters as follows:
    • 0.0.0.0/0: Default route. Do not change it.
    • Subnet gateway of the extended network interface: Enter the IP address collected in 1.
    • Route priority: Set its value to 261. The priority of the extended network interface must be lower than that of the primary network interface. A larger value indicates a lower priority.

    In this example, run the following command:

    route add -p 0.0.0.0 mask 0.0.0.0 10.0.1.1 metric 261

    • The primary network interface already has policy-based routes and you do not need to configure again.
    • If the ECS has multiple extended network interfaces, configure policy-based routes for all extended network interfaces one by one.
  3. Check whether the policy-based route is added.

    route print

    If information similar to the following is displayed, the policy-based route has been added. The route is a permanent route and will not be lost after the ECS is restarted.

  4. Check whether the source and destination ECSs can communicate with each other.

    ping -S <IP-address-of-the-primary-network-interface-on-the-source-ECS> <IP-address-of-the-destination-ECS>

    ping -S <IP-address-of-the-extended-network-interface-on-the-source-ECS> <IP-address-of-the-destination-ECS>

    In this example, run the following commands:

    ping -S 10.0.0.59 10.0.2.12

    ping -S 10.0.1.104 10.0.2.12

    If information similar to the following is displayed, both the network interfaces of the source ECS can communicate with the destination ECS.

Configuring IPv6 Policy-based Routes for a Windows ECS

  1. Collect the ECS network interface information required for configuring policy-based routes.

    For details, see Collecting ECS Network Information.

    In this example, the network information of the ECS is shown in Table 2.

    Table 2 Windows ECSs using IPv6 addresses

    Type

    Primary Network Interface

    Extended Network Interface

    Source

    IPv6 address: 2407:c080:802:aba:6788:fb94:d71f:8deb

    IPv6 address: 2407:c080:802:be6:71c8:42e0:d44e:eeb4

    Destination

    IPv6 address: 2407:c080:802:be7:c2e6:d99c:b685:c6c8

    N/A

  2. Log in to the source ECS.

    For details, see How Do I Log In to My ECS?

  1. Run the following command to check whether the ECS has IPv6 enabled and has IPv6 addresses:

    ipconfig

    If information similar to the following is displayed, each network interface has an IPv6 address starting with 2407, which indicates that the ECS has IPv6 addresses.

    Perform this step for both the source and destination ECSs to ensure that the ECSs have IPv6 addresses. Otherwise, the ECSs cannot communicate with each other using IPv6 addresses.

    ECSs in this example run Windows Server 2012 (64-bit). No additional configuration is required for such ECSs because they can automatically obtain IPv6 addresses. If your ECS cannot automatically obtain IPv6 addresses, see the "Windows Server 2012" and "Windows Server 2008" parts in Dynamically Assigning IPv6 Addresses.

  2. Check whether the source and destination ECSs can communicate with each other.

    ping -6 -S <IP-address-of-the-primary-network-interface-on-the-source-ECS> <IP-address-of-the-destination-ECS>

    ping -6 -S <IP-address-of-the-extended-network-interface-on-the-source-ECS> <IP-address-of-the-destination-ECS>

    In this example, run the following commands:

    ping -6 -S 2407:c080:802:aba:8999:5e61:e19:cf7e 2407:c080:802:be7:c2e6:d99c:b685:c6c8

    ping -6 -S 2407:c080:802:be6:ec23:ec4:c886:cc1 2407:c080:802:be7:c2e6:d99c:b685:c6c8

    If information similar to the following is displayed, both the network interfaces of the source ECS can communicate with the destination ECS.

    ECSs in this example run Windows Server 2012 (64-bit). You do not need to configure policy-based routes for these ECSs because both the network interfaces of such an ECS can communicate with others using IPv6.