Help Center> Virtual Private Cloud> Best Practices> Configuring Policy-based Routes for an ECS with Multiple NICs> Configuring Policy-based Routes for a Windows ECS with Multiple NICs
Updated on 2024-05-06 GMT+08:00

Configuring Policy-based Routes for a Windows ECS with Multiple NICs

Scenarios

This section describes how to configure policy-based routes for a dual-NIC ECS running Windows Server 2012 (64-bit).

For details about the background knowledge and networking of dual-NIC ECSs, see Overview.

Procedure (Windows ECS Using IPv4)

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

    For details, see Collecting ECS Network Information.

  2. Log in to an ECS.
  1. Check whether the source ECS can use its primary NIC to communicate with the destination ECS:

    ping -S IP address of the primary NIC 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 NIC to communicate with the destination ECS.

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

  2. Configure a policy-based route for the extension NIC.

    route add -p 0.0.0.0 mask 0.0.0.0 Subnet gateway of the extension NIC metric Route priority

    Configure the parameters as follows:
    • 0.0.0.0/0: Default route. Do not change it.
    • Subnet gateway of the extension NIC: Enter the IP address collected in 1.
    • Route priority: Set its value to 261. The priority of the extension NIC must be lower than that of the primary NIC. 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 NIC already has policy-based routes and you do not need to configure again.
    • If the ECS has multiple extension NICs, configure policy-based routes for all extension NICs one by one.
  3. Check whether the policy-based route is successfully added.

    route print

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

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

    ping -S IP address of the primary NIC on the source ECS IP address of the destination ECS

    ping -S IP address of the extension NIC 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 NICs of the source ECS can communicate with the destination ECS.