Updated on 2024-11-08 GMT+08:00

Configuring 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 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 ECS using IPv4

    ECS

    Primary Network Interface

    Extended Network Interface

    Source

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

    Destination

    IP address: 10.0.2.12

    N/A

  2. Log in to the source ECS.

    For details, see Logging In to an ECS.

  1. Check whether 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.

    Before configuring policy-based routes, ensure that 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 persistent 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.