Updated on 2024-01-15 GMT+08:00

Configuring a Proxy Host

Before adding a proxy to a created host cluster, you need to perform the following operations on the proxy:

Configuring a Linux Proxy

Required Resources

You have configured the following resources in a Virtual Private Cloud (VPC):

Resource Type

Supported Resource Specifications

Quantity

Description

EIP

Bandwidth ≥ 5 Mbit/s

2

1. When creating a proxy, you need to add an ECS bound to an elastic IP address as the proxy.

2. When creating an SNAT gateway, you need to bind an EIP to it.

Procedure

  1. Enable the SSH forwarding function of the proxy.

    • If the proxy mode is used, run the following command to check whether AllowTcpForwarding has been enabled for SSH on the proxy:
      grep AllowTcpForwarding "/etc/ssh/sshd_config"
    • If the value is no, set it to yes and run the following command to restart the sshd service:
      service sshd restart

  2. Configure SNAT for the proxy.

    1. Click in the upper left corner and choose Networking > to access the console.
    2. On the Network Console, click Buy Public NAT Gateway.
    3. Enter related information and click Next.

    4. After the NAT gateway is created, return to the NAT gateway list and click the target NAT gateway.
    5. On the NAT gateway details page, click the SNAT Rules tab, click Add SNAT Rule, configure required parameters, and click OK.

    6. Check whether the SNAT rule is added.

  3. Check routing policies.

    1. Go to the console. In the upper left corner of the page, click and choose Networking > to access the network console.
    2. Choose Virtual Private Cloud > Route Tables and click the target route table.

      Check the route information.

      Table 1 Description of route information

      Route Information

      Description

      Destination

      Destination CIDR block. The default value is 0.0.0.0/0. Select the IP address for the access environment based on project requirements.

      IP Addresses

      Click to view detailed information about the IP addresses.

      Next Hop Type

      Set it to NAT gateway.

      Next Hop

      Set it to the public NAT gateway that you have added the SNAT rule to.

      Type

      System: A system route is automatically added by the system and cannot be modified or deleted.

      Custom: A user-defined route is added by a user to direct traffic to a desired destination, and can be modified and deleted. The destination of a custom route cannot overlap with that of a system route.

      Description

      Description of the route.

      Operation

      You can modify and delete routes.

Configuring a Windows Proxy

Required Resources

  • A Windows host is available.
  • The network connection between the proxy and hosts is normal.

Procedure

  1. Log in to the proxy, open PowerShell, and run the netsh command. Replace the parameters based on the parameter descriptions.

    netsh interface portproxy add v4tov4 listenaddress=${proxy_ip}  listenport=${proxy_port}  connectaddress=${host_ip}  connectport=${host_port}
    Table 2 Parameters

    Parameter

    Description

    ${proxy_ip}

    Private IP address of the proxy.

    ${proxy_port}

    Listening port of the proxy, for example, 54.

    ${host_ip}

    Private IP address of the host.

    ${host_port}

    Port of the host. Generally, the port is 5986.

  2. To configure the security group and firewall, enable the proxy listening port, that is, ${proxy_port} in the preceding command.