Anti-DDoS Proxy forwards packets destined for a port on the Anti-DDoS Proxy IP address to the corresponding port on the origin server. To keep your service stable, validate locally that the forwarding configuration has taken effect before you connect your service to Anti-DDoS Proxy.
Prerequisites
You have added a website or port configuration in the Anti-DDoS Proxy console. See Add a website configuration and Configure port forwarding rules.
The back-to-origin IP addresses of Anti-DDoS Proxy are allowed to access the origin server. See Allow back-to-origin IP addresses to access the origin server.
Choose a validation method
The method depends on the configuration you added:
Services accessed by a domain name: if the server address in the client is a domain name instead of an IP address, add a website configuration when you connect the service. Then validate the configuration by modifying the local hosts file or by using the CNAME address.
Layer 4 services accessed by an IP address: gaming and other Layer 4 services often do not require a domain name and interact directly by IP address. For these, add a port forwarding rule when you connect the service. Then validate the configuration by using the Anti-DDoS Proxy IP address.
Switching your service before the forwarding configuration takes effect might interrupt it.
Modify the local hosts file
Use this method to validate a website configuration that uses a domain name.
Modify the local hosts file so that requests from your computer to the protected site pass through Anti-DDoS Proxy. These steps use Windows as an example.
Locate the hosts file, stored by default in the
C:\Windows\System32\drivers\etc\folder.Open the hosts file in a text editor.
Add the following content to the last line:
Anti-DDoS Proxy IP address Website domain name. For example, if the Anti-DDoS Proxy IP address is180.173.XX.XXand the domain name isdemo.aliyundoc.com, add:180.173.XX.XX demo.aliyundoc.com.Save the hosts file.
On your computer, run the
pingcommand for the protected domain name. The resolved address should be the Anti-DDoS Proxy IP address you bound in the hosts file. If the origin server address is still returned, refresh the local DNS cache: on Windows, run theipconfig /flushdnscommand in Command Prompt.After local resolution switches to the Anti-DDoS Proxy IP address, access the service by using the original domain name. If it is accessible, the forwarding configuration has taken effect.
Use the Anti-DDoS Proxy CNAME address to access the server
Use this method when your client supports specifying the server domain name.
Replace the original domain name with the CNAME address assigned by Anti-DDoS Proxy, then test whether the service is accessible.
After you add a website configuration, Anti-DDoS Proxy assigns a CNAME address to the domain name for service integration. You can view it in the website configuration list.
Use the Anti-DDoS Proxy IP address to access the server
Use this method to validate a port forwarding configuration. This example assumes:
Anti-DDoS Proxy IP address:
99.99.XX.XXForwarding port:
1234Origin server IP address:
11.11.XX.XXOrigin server service port:
1234After you add the port configuration, run the
telnetcommand on your local computer to access port1234on the Anti-DDoS Proxy IP address99.99.XX.XX. If the connection succeeds, the port forwarding configuration has taken effect.
If your client supports specifying the server IP address, you can also enter the Anti-DDoS Proxy IP address to test.