Excellent software and practical tutorials
Written in front of the words: There are too many on the InternetCloudFlareConfigurationPreferred IP,freeCDN accelerationI have read a lot of articles, but many of them are full of errors, they are not clear, and I am confused. After some research, I wrote this article to help you understand how to configure the preferred IP address. Free CDNSpeed up your website.
Cloudflare itself doesn't directly offer a "preferred IP" configuration option. Instead, it automatically selects the best access point for users through its global CDN nodes. Users primarily use its service by configuring their domain's DNS records and pointing their domain name servers to Cloudflare's name servers. If you need to optimize for a specific user group or region, you may need to contact Cloudflare technical support or configure advanced settings, rather than simply using a "preferred IP" switch.
Why use CloudFlare's preferred IP configuration CDN acceleration?
In CloudFlare, after enabling Orange Cloud, free CDN acceleration is provided for the domain name by default. So why do we still need to use preferred IP to configure CDN acceleration?
This question has to start with CloudFlare's support for domestic network lines. As we all know, CloudFlare is the Cyber Living Buddha. Of course, this name was given by the Chinese. Why is it called the Cyber Living Buddha? The main reason is that the free services provided by CloudFlare are really many. After the domain name is hosted on CloudFlare, the DNS is resolved in seconds.Free CDN accelerationServices, free security services and more.
However, when it comes to free CDN acceleration, this service is a bit unsatisfactory in China. Although the free service is a bit picky, the website really opens slowly during the evening peak period.
When enemies come, we will fight them; when water comes, we will block it with earth. When problems arise, we will solve them. Fortunately, CloudFlare provides commercial CDN services. After opening the commercial CDN acceleration service, the speed is very fast. However, the freeloaders in China are used to freeloading, so how could they pay for it?
Here we will teach you how to use CloudFlare's preferred IP to configure CDN acceleration for free.
I won’t go into detail about how to register and log in to CloudFlare. It’s very simple. You can register with your email or account.
Website address:https://www.cloudflare.com/
How to get CloudFlare's preferred IP
Before you can get a preferred IP, you need to host your domain on CloudFlare.
Hosting your domain in CloudFlare
For example, using anamesilo.comTake the domain name registered on as an example:
Step 1: Add a hosted domain
Add the domain name to CloudFlare and click on theAdd a domain, enter the domain name that needs to be hosted, and select Manually enter DNS records.
Step 2: Choose a subscription plan
After adding the domain, select the subscription plan, choose the Free plan, select the bank card verification required for the first time during the subscription process, and register onlineVirtual Credit Card, the verification is successful.
Step 3: Update the name servers
After selecting a plan, do not add DNS records yet, continue with activation.
This step is critical. Once you have your domain hosting setup, you will need to change the name servers at your domain registrar to the name servers assigned to you by CloudFlare.
After modifying the NameServers, you just need to wait quietly for about a few minutes for the domain name hosting in CloudFlare to take effect. After it takes effect, you can configure your domain name DNS on CloudFlare. CloudFlare's DNS takes effect immediately, without having to wait for a long time, which is very efficient.
Get CloudFlare preferred IP
There are two ways to obtain the preferred IP. One is to use open source tools on the Internet, which is very simple.
Test Cloudflare CDN latency and speed to get the fastest IP! Also supports websites with other CDNs and multiple IPs.
Many foreign websites are using Cloudflare CDN, but the IPs assigned to mainland Chinese visitors are not friendly (high latency, high packet loss, and slow speed).
Although Cloudflare has made all its IP segments public, it would be exhausting to find the one that suits you among so many IPs, so this software was created.
XIU2/CloudflareSpeedTest Project address:https://github.com/XIU2/CloudflareSpeedTest
Windows | x86 | 32-bit | cfst_windows_386.zip | Minimum requirements Windows 10 + Server 2016 |
Windows | x86_64 | 64-bit | cfst_windows_amd64.zip | Minimum requirements Windows 10 + Server 2016 |
Windows | x86 | 32-bit | cfst_windows_386_old.zip | For Windows 7/8 + Server 2008/2012 |
Windows | x86_64 | 64-bit | cfst_windows_amd64_old.zip | For Windows 7/8 + Server 2008/2012 |
Windows | ARM v8 | 64-bit | cfst_windows_arm64.zip | Provided for ARM architecture, don’t download the wrong one! |
Currently, download links for Windows are provided. For Linux and macOS, you can download them directly from the project homepage.
The usage is very simple. After downloading and unzipping, run the cfst.exe file directly. Note: Be sure to turn off the ladder before use.
The selected IP addresses are the top 10 IP addresses with the fastest access speed on your current line.
Another method is to directly find websites that use Cloudflare's commercial CDN acceleration and then obtain the IP addresses of these domain names.
For example: VISA.COM
The preferred IP addresses for visa.com are 162.159.153.2 and 162.159.152.2. The access speed of these two IP addresses in China is almost less than 200ms.
Here are some websites that use Cloudflare's commercial CDN for reference:
FBI.GOV (104.16.148.244 104.16.149.244)
Dynadot.COM (104.16.153.132 104.16.152.132)
JAPAN.COM (104.26.4.60 104.26.5.60 172.67.70.92 )
BRAZIL.COM (104.26.4.157 104.26.5.157)
The sorted preferred IP list:
162.159.153.2 162.159.152.2 104.16.148.244 104.16.149.244 104.16.153.132 104.16.152.132 104.26.4.60 104.26.5.60 172.67.70.92 104.26.4.157 104.26.5.157
The issue of preferred IPs has been resolved. Now use these preferred IPs to speed up your website.
Use preferred IP to configure free CDN acceleration
How to use a domain name hosted on Cloudflare for CDN acceleration. After the preliminary preparations are completed, it is time to configure CDN acceleration. There are two methods of CDN acceleration in Cloudflare. Of course, enabling Orange Cloud's one-click CDN acceleration is too simple, so it will not be counted.
Here are two ways to accelerate CDN:
One is that the website is on an external independent server and uses a domain name hosted by Cloudflare for CDN acceleration.
Another option is to host the website on Cloudflare's Workers and use CDN for acceleration.
Let’s talk about the first one first.Use domain name for CDN acceleration.
Configure resolution of related domain names
Next we need to configure several domain names for CDN acceleration.
Preferred IP domain name
Resolve the A record of the preferred IP we sorted out above to the preferred IP domain name.
For ease of configuration, here is a free preferred IP domain name:cf.lvip.us
If the domain name can be pinged, it can be used. It is recommended to use your own domain name to configure the preferred IP domain name.
Fallback source domain name
What is a fallback domain name?
When a user requests the configured hostname, the request will eventually be forwarded to the fallback server. The fallback server is your original server, the server where your website data is stored.
The fallback source domain name is only used for resolution and has no impact on web access. The root domain name can also be used as the fallback source domain name. The reason for using the second-level domain name is that the root domain name can also be used for other sites.
Prepare a second-level domain name under the same domain name as the fallback source domain name, which needs to be resolved to the source server first.
For example:
- ht.8dpc.com (resolved to the original data server using A record)
Note: The fallback source domain name must be a second-level domain name under this domain name, and it will only take effect after it has been resolved to the source server using an A record.
SaaS back-to-origin domain name
- cdn.8dpc.com (Use CNAME to resolve to the preferred IP domain name)
The resolution type is CNAME and the resolution target is to the preferred IP domain name. Note that in this step, the proxy status needs to be turned off and the orange cloud should not be enabled.
After the domain names are resolved, let's configure CDN acceleration!
Custom host name and domain name
This is a very critical domain name, and it is also the domain name used for CDN acceleration. This domain name must be distinguished from the fallback source domain name. You need to use two different domain names, otherwise an error will occur.
For example:
Use btvid.com as the domain name for the custom hostname.
First, you need to use CNAME to resolve the domain name of the custom host name to the domain name of the SaaS back-origin.
Note: Do not enable proxy status during parsing, the orange cloud remains gray.
Setting the fallback source
In the Cloudflare menu on the left, clickSSL/TLSThe followingCustom hostname
New users need to activate the Cloudflare for SaaS custom hostname feature and use credit card verification. Note that there is no charge for credit card verification.
Add a custom hostname
After filling in the fallback source, you need to add a custom host name. This custom host name is the primary domain name you use for CDN acceleration.
For example, use btvid.com as the custom host name.
This custom host name is the primary domain name you use for CDN acceleration.
Add a custom host name on the fallback source domain name page. After adding, you need to verify the domain name certificate and host name.
On the domain name DNS resolution page, add txt records separately. Be careful not to make mistakes in the name and verification value of the txt records.
DCV delegation for custom hostnames
Use DCV delegation to enable automatic certificate issuance and renewal for unproxied or wildcard hostnames. For each hostname, the domain owner needs to place a CNAME record using authoritative DNS, directing ACME DCV challenges to the hostname-specific Cloudflare validation target.
This step is used to enable automatic certificate renewal. Just configure a CNAME record in the DNS record of the btvid.com domain name.
Then wait until the host name's certificate status and host name status are both valid, and then check whether the custom host name is valid.
Visit the main domain btvid.com Congratulations, CDN acceleration has taken effect! You can normally access the website bound to the domain name on the origin server.
If Error 1000 occurs, it basically means that the back-to-origin domain name is used as the primary domain name. The back-to-origin domain name and the primary domain name must be two separate domain names.
Cloudflare's experience in configuring free CDN with preferred IP
Finally, let's make a configuration summary. The fallback source domain name and the SaaS fallback source domain name are two different concepts. Be careful not to confuse them.
Four domain names are used during the configuration process:
- Preferred IP domain name
- Fallback source domain name
- SaaS back-to-origin domain name
- Custom host header domain name
The custom host header domain name and the fallback source domain name cannot be the same; two different root domain names are required.
The fallback source domain name points to the source server of the website. The custom host header domain name needs to be bound to the website on the source server, otherwise the domain name site will not be found.
If the website displays too many redirects, change the SSL/TLS encryption mode to "Full" and try accessing it again.