Whitelist Cloud Assistant server IPs in OpenVPN

Updated at:

After you configure OpenVPN on a Windows instance, Cloud Assistant will not work correctly. To resolve this, add the Cloud Assistant server IP address to a whitelist in your OpenVPN configuration.

OpenVPN parameters

To route traffic for only specific IP addresses through the OpenVPN tunnel, use the following parameters in the OpenVPN client configuration file:

  • route-nopull

    When added to the client.ovpn configuration file, this parameter prevents the OpenVPN client from pulling routes from the server. As a result, no traffic is routed through the OpenVPN tunnel by default.

  • vpn_gateway

    After adding the route-nopull parameter to the client.ovpn configuration file, use the vpn_gateway parameter to specify which network traffic to route through the OpenVPN tunnel.

  • net_gateway

    When included in the client.ovpn configuration file, this parameter routes all network traffic through the OpenVPN tunnel by default. Use the net_gateway parameter to let traffic for specific IP addresses bypass the OpenVPN tunnel.

Procedure

  1. Connect to the instance.

    For more information, see Log on to a Windows instance by using Workbench.

  2. Obtain the IP address of the Cloud Assistant server.

    To get the IP address, resolve the Cloud Assistant service endpoint. The endpoint is in the format <region-id>.axt.aliyun.com.

    Note

    Replace <region-id> with the region ID of your instance. For more information about Alibaba Cloud regions, see Regions and availability zones.

    For example, to get the Cloud Assistant server IP address in the China (Zhangjiakou) region, run the following command.

    ping cn-zhangjiakou.axt.aliyun.com
    C:\Users\Administrator>ping cn-zhangjiakou.axt.aliyun.com
    Pinging cn-zhangjiakou.axt.aliyun.com [100.xxx.xxx.xxx] with 32 bytes of data:
    Reply from 100.xxx.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.xxx.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.xxx.xxx.xxx: bytes=32 time<1ms TTL=102
    Reply from 100.xxx.xxx.xxx: bytes=32 time<1ms TTL=102
    Ping statistics for 100.xxx.xxx.xxx:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
    Approximate round trip times in milli-seconds:
        Minimum = 0ms, Maximum = 0ms, Average = 0ms

    The 100.XX.XX.XX value in the command output is the IP address of the Cloud Assistant server.

  3. Modify the OpenVPN client configuration file client.ovpn.

    For example, modify the configuration file at C:\Program Files\OpenVPN\config\client.ovpn. The actual path depends on your OpenVPN installation directory.

    (Recommended) Method 1: Use the route-nopull and vpn_gateway parameters to add the IP address ranges that pass through the OpenVPN tunnel. Ensure that these ranges do not include the Cloud Assistant server IP address. The following code provides an example.

    route-nopull
    route 192.168.0.0 255.255.0.0 vpn_gateway
    route 172.16.0.0 255.255.0.0 vpn_gateway

    Method 2: Use the net_gateway parameter to let the Cloud Assistant server IP address bypass the OpenVPN tunnel.

    route 100.101.XX.XX 255.255.0.0 net_gateway
    Note

    Replace 100.101.XX.XX with the Cloud Assistant server IP address you obtained.

  4. Restart the OpenVPN client and reconnect to the VPN.

    After you reconnect to the VPN, Cloud Assistant works correctly.