Help Center/ Elastic Cloud Server/ Troubleshooting/ General Issues/ Why Accessing a Website Outside the Chinese Mainland Is Slow on an ECS?
Updated on 2024-05-11 GMT+08:00

Why Accessing a Website Outside the Chinese Mainland Is Slow on an ECS?

Symptom

Websites outside the Chinese mainland, including those in Hong Kong (China), Macao (China), Taiwan (China), and other countries and regions, may be slow to access.

Generally, an international line is used for accessing websites outside the Chinese mainland. However, the international line may inevitably pass through network nodes distributed around the world, resulting in high latency.

Solutions

  • Purchase an ECS in a region (such as CN-Hong Kong) outside the Chinese mainland.

    Considering the physical distance and network infrastructure, you can purchase an ECS in a region outside the Chinese mainland if you need to access websites outside the Chinese mainland.

    For example, select the CN-Hong Kong region during the ECS purchase.

Modifying the DNS Configuration

Change the DNS server addresses to public DNS server addresses, for example, 101.226.4.6 and 1.1.1.1.

The following figure demonstrates how you can modify the DNS configuration on Windows Server 2012.

Figure 1 Modifying the DNS configuration

The following are detailed operations:

  1. Log in to the Windows ECS as user Administrator.
  2. Enable the local area connection.
    1. In the lower right corner of the taskbar, right-click the network connection icon.
    2. Click Open Network and Sharing Center.
      Figure 2 Open Network and Sharing Center
    3. In the navigation pane on the left, click Change adapter settings.
  3. Configure the DNS server for the ECS.
    1. Double-click network connections.
    2. Click Properties in the lower left corner.
      Figure 3 Local area connection
    3. Select Internet Protocol Version 4 (TCP/IPv4) and click Properties.
      Figure 4 Selecting a protocol type
    4. Select Use the following DNS server addresses and set the IP addresses of the DNS servers as prompted.
      Figure 5 Setting the DNS server addresses

Modifying the hosts File

Select a server that allows you to access the website at the fastest speed and add its IP address and the domain name of the website to the hosts file.

Use either of the following methods to obtain the IP address of the server that allows you to access the website at the fastest speed:

Method 1: Pinging the Domain Name

The following figure demonstrates how you can ping the domain name on Windows Server 2012 to obtain the IP address of the server with the fastest access speed. (www.example.com is used as the example domain name.)

Figure 6 Modifying the hosts file

The following are detailed operations:

  1. Ping www.example.com and wait for the result.
    Figure 7 Command output
  2. Ping the domain name repeatedly and record a stable IP address with the smallest TTL value.

    During the ping operation, run the ipconfig /flushdns command to refresh the DNS resolution cache. Otherwise, the same IP address will be pinged continuously.

    In this example, IP address 93.184.216.34 has the smallest TTL value.

  3. Modify the hosts file.

    Open the C:\Windows\System32\drivers\etc\hosts file and add the mapping between the IP address and the domain name in the end of the file.

    For example, if the obtained IP address is 93.184.216.34, enter 93.184.216.34 www.example.com in the end of the hosts file, save and exit the file.

    • Exercise caution when you modify the hosts file.

      You are advised to back up the hosts file using either of the following methods: Copy and paste the hosts file, or copy and paste the content of the hosts file.

    • Only the IP address you have configured in the hosts file will be returned when the domain name is used to access the website.
    • If access is still slow and you want to replace the IP address, delete the existing mapping from the hosts file and repeat the proceeding operations to obtain a new IP address.
  4. Access the website again.

    Modifying the hosts file can only speed up the website access. If the problem persists, purchase an ECS in a region outside the Chinese Mainland, for example, CN-Hong Kong.

Method 2: Using a Ping Tool and PingInfoView

You can also try to speed up website access by modifying the hosts file. To do so, perform the following operations:

  1. Log in to your ECS as user Administrator.
  2. Use a browser to access the ping tool.
  3. Enter the domain name of the website and record the IP addresses with the lowest response time. (www.example.com is used as an example.)
  4. Download PingInfoView, decompress it, and run PingInfoView.exe.
  5. Open PingInfoView, copy the IP addresses obtained in step 3 to the text box, and click OK.

  6. Copy one IP address in the search result.

  7. Open the C:\Windows\System32\drivers\etc\hosts file and add the mapping between the IP address and the domain name in the end of the file.
    • Exercise caution when you modify the hosts file.

      You are advised to back up the hosts file using either of the following methods: Copy and paste the hosts file, or copy and paste the content of the hosts file.

    • Only the IP address you have configured in the hosts file will be returned when the domain name is used to access the website.
    • If access is still slow and you want to replace the IP address, delete the existing mapping from the hosts file and repeat the proceeding operations to obtain a new IP address.

    For example, if the obtained IP address is 99.84.178.238, enter 99.84.178.238 www.example.com in the end of the hosts file, save and exit the file.

  8. Access the website again.

    If the fault persists, use an ECS purchased in a region outside the Chinese Mainland to access the target website.

Checking Whether the Request Is Responded

Try to access the target website. If the website can be accessed but the loading is still slow, packet loss may occur. In such a case, run the ping -t Website address command to check the packet loss. For details, see How Do I Troubleshoot a Ping Failure or Packet Loss Using a Link Test?

For example, run ping -t www.example.com.

In Windows, you can also download the curl client, decompress it, open the bin folder, copy the path, and configure the environment variables.

If a response status code is displayed, the request has been sent and received. Slow website access may be caused by loss of packets sent to the destination server.

Contact customer service to check for packet loss.