Help Center> Anti-DDoS Service> Best Practices> Obtaining the Source IP Address of a Client

Obtaining the Source IP Address of a Client

Scenarios

The real source IP address of a client is hidden from the origin server after the traffic is forwarded by the high-defense IP address. This topic describes how to obtain the real source IP address through the TOA module provided by Huawei AAD.

Mechanism

Generally, AAD changes the source IP address and destination IP address of the traffic passing through (respectively from the client's source IP address into the back-to-origin IP address and from the high-defense IP address into the origin server IP address). The source IP address visible to the user on the origin server is the back-to-origin IP address.

Figure 1 Mechanism
  • The high-defense IP address is provided by HUAWEI CLOUD to replace the IP address of the origin server to ensure its stability and reliability.
  • From the perspective of an origin server, all traffic originates from the back-to-origin IP address.
  • The origin server IP address is the public IP address used to provide services.

Prerequisites

The TOA module provided by Huawei AAD supports the following Linux OSs:

  • OSs with kernel version 2.6 (such as CentOS 6.5)
  • OSs with kernel version 3.10 (such as CentOS 7)
  • For details, see TOA open-source code provided by Huawei AAD.
  • If the origin server runs another OS (such as Ubuntu and SUSE), you can customize TOA according to Configuring the TOA Plug-in in the Elastic Load Balance User Guide.

    If the TOA version of the OS cannot be determined, submit a service ticket.

Procedure

The TOA module used by AAD has been optimized based on the open-source TOA. It can be directly compiled and installed on a Linux CentOS server. (Customizations are required for other Linux OSs.)

  1. Obtain the TOA module.

    Huawei AAD has offered the TOA open-source code.

  2. Compile the TOA module.

     >> make   #Enter the target directory containing gcc, depending on the server version.
    >> rmmod toa   #Uninstall TOA of the earlier version.
    >> insmod toa.ko   #Mount the compiled TOA.
    >> lsmod | grep toa   #Check whether the operation is successful.

    When the kernel module is mounted, you can obtain the real source IP address easily without modifying the existing server processes or interrupting existing services.

  • After TOA is installed in a Linux OS, the OS does not automatically load TOA during the restart by default. If you need to reload TOA during the OS restart, see the subsequent descriptions of the TOA open-source code.
  • If you cannot obtain the real source IP address, contact Huawei technical support.

Verification

Verify that you can obtain the real source IP address by using a common function or the above mentioned code.