Help Center/ Server Migration Service/ FAQs/ Migration Network/ How Do I Configure a Source Server to Access Huawei Cloud Through a Proxy?
Updated on 2025-01-24 GMT+08:00

How Do I Configure a Source Server to Access Huawei Cloud Through a Proxy?

Scenarios

Each source server must continuously communicate with SMS over the Internet. If the source server cannot access the Internet, you can configure a proxy for it.

The IP address and port number in this section are used as examples only.

Preparations

  • Prepare a proxy server.

    The proxy server and the source server must be able to communicate with each other over the intranet.

  • Obtain the Squid installation package.

Step 1: Configure the Proxy Server

  • Installing and configuring Squid on Linux
    1. Run the following command on the proxy server to install Squid:
      yum -y install squid
    2. Run the following command to back up the Squid configuration file:
      cp -a /etc/squid/squid.conf /etc/squid/squid.conf.bak
    3. Use the text editor to modify the squid.conf configuration file and save the modification.
      vi /etc/squid/squid.conf
      1. Configure Squid as a proxy for the network segment where the source server is located. Replace 192.168.0.0/16 with the private IP address of the server that needs to access the proxy server. Generally, it is set to the private network segment of the source server. You can also set it to 0.0.0.0/0 to allow access from all servers.
        acl localnet src 192.168.0.0/16 

      2. Add the following configuration items:
        cache_mem 64 MB
        maximum_object_size 4 MB
        cache_dir ufs /var/spool/squid 100 16 256
        access_log /var/log/squid/access.log
      3. (Optional) Check that http_port is set to the Squid port in the configuration file. The default value is 3128. You can change it if necessary.
    4. Start Squid.
      systemctl start squid
    5. Check the Squid status.
      systemctl status squid
    6. (Optional) Configure Squid to automatically start upon system startup.
      systemctl enable squid
  • Installing and configuring Squid on Windows
    1. On the server you prepared, access https://squid.diladele.com. Locate Console APP, download the installation program, and install it.

    2. After the installation is complete, go to the Squid installation directory and modify the squid.conf file in the etc/squid folder.
      1. Configure Squid as a proxy for the network segment where the source server is located. Replace 192.168.0.0/16 with the private IP address of the server that needs to access the proxy server. Generally, it is set to the private network segment of the source server. You can also set it to 0.0.0.0/0 to allow access from all servers.

      2. (Optional) Check that http_port is set to the Squid port in the configuration file. The default value is 3128. You can change it if necessary.
    3. Right-click the Squid icon on the taskbar at the lower right corner and choose Exit from the shortcut menu.
    4. Double-click the Squid Server Tray icon on the desktop to start Squid. Right-click the Squid icon on the taskbar in the lower right corner and choose Start Squid Service from the shortcut menu.
    5. Run the following command in the CLI window to check whether Squid is running:
      netstat -ano | findstr 3128

Step 2. Install the Agent on the Source Server

  • Linux
    1. Run the following command on the source server to download the Agent:
      curl -x http://<proxy-server-private-IP-address>:<proxy-port> -O https://sms-resource-intl-ap-southeast-3.obs.ap-southeast-3.myhuaweicloud.com/SMS-Agent.tar.gz
    2. Decompress the installation package.
      tar -zxvf SMS-Agent.tar.gz
    3. Use the text editor to modify the auth.cfg file in the SMS-Agent/agent/config directory and save the modification.
      vim SMS-Agent/agent/config/auth.cfg

      • enable indicates whether to use a proxy. If it is set to true, a proxy is used.
      • proxy_addr indicates the private IP address of the proxy server, not the IP address of the target server.
      • proxy_port indicates the port specified for Squid.
    4. Go to the SMS-Agent installation directory and run the startup.sh script to start the Agent. When prompted, enter the AK/SK pair of your target Huawei Cloud account and the SMS domain name.

      When the following information is displayed, the Agent has been started up and will automatically start reporting source server information to SMS.

  • Windows
    1. Download and install the Agent on the source server.
      • If the source server runs Windows Server 2019, Windows Server 2016, Windows Server 2012, Windows 10, or Windows 8.1, run the following command in PowerShell on the source server to download the Agent:
        Invoke-WebRequest -Proxy http://<proxy-server-private-IP-address>:<proxy-port> -Uri
        https://sms-resource-intl-ap-southeast-3.obs.ap-southeast-3.myhuaweicloud.com/SMS-Agent-Py3.exe -OutFile C:\\SMS-Agent-Py3.exe -UseBasicParsing
      • If the source server runs Windows Server 2008 or Windows 7, download the Agent (Python 2) from the proxy server, upload the Agent package to the source server, and install the Agent. For details, see Installing the Agent on Windows.
    2. Start the Agent
      • If you use the Agent (Python 3), on the SMS-Agent GUI, enter the AK/SK pair of the target Huawei Cloud account and the SMS domain name, select Use proxy, enter the private IP address and port of the proxy server, and click Start. In this example, no username and password are required for using the proxy.

      • If you use the Agent (Python 2), go to the Agent installation directory, for example, C:\SMS-Agent-Py2\config, modify the auth.cfg file based on the following figure, and save the modification.

        • enable indicates whether to use a proxy. If it is set to true, a proxy is used.
        • proxy_addr indicates the private IP address of the proxy server, not the IP address of the target server.
        • proxy_port indicates the port specified for Squid.

        Double-click agent-start.exe in the installation directory (for example, C:\SMS-Agent-Py2) to open the SMS-Agent CLI. Enter the AK/SK pair of the target Huawei Cloud account and the SMS domain name to start the Agent.