最后更新于:2026年07月

Cloudflare 优选 IP 与 WARP
Cloudflare 优选 IP 与 WARP 实战

Cloudflare 在全球有超过 300 个数据中心,但默认情况下你连上的未必是最快的那个。通过优选 IP 技术,你可以从数百万个 Cloudflare IP 中挑选出延迟最低、速度最快的节点。配合 Cloudflare WARP——一个免费的 WireGuard VPN 服务,你还能获得全球 100+ 国家/地区的出口 IP。

本文将带你掌握 Cloudflare 优选 IP 的全部技巧,从基础工具使用到自建 API 优选服务,再到 WARP 的部署与组合应用,打造一套完整的 Cloudflare 加速体系。


🧭 Cloudflare 网络基础

Cloudflare CDN 架构

PLAINTEXT
┌──────────────────────────────────────────────────────────┐
│              Cloudflare 全球网络架构                     │
│                                                          │
│  用户请求 → Cloudflare 边缘节点(Anycast)               │
│                 │                                        │
│                 ├── 全球 300+ 数据中心                   │
│                 ├── 通过 BGP Anycast 路由到最近节点      │
│                 ├── 但「最近」≠「最快」                  │
│                 └── 某些节点可能拥塞或绕路               │
│                                                          │
│  源站服务器                                               │
│       ↑                                                  │
│       └── 回源请求                                       │
│                                                          │
│  问题:默认 Anycast 路由未必最优                         │
│  解决:手动优选 IP,绕过 BGP 路由,直连最快节点          │
└──────────────────────────────────────────────────────────┘

为什么需要优选 IP?

PLAINTEXT
默认情况:
  用户 → 运营商 → BGP 路由 → Cloudflare 节点 A(延迟 200ms)

优选后:
  用户 → 运营商 → 直连优选 IP → Cloudflare 节点 B(延迟 30ms)

原因:
1. BGP 路由可能绕路(如:国内→美国→日本,而不是直接→日本)
2. 某些 Cloudflare 节点拥塞
3. 运营商与某些 Cloudflare 节点有更好的互联
4. 通过优选可以找到「冷门但快速」的 IP 段

WARP 是什么?

PLAINTEXT
┌──────────────────────────────────────────────────────────┐
│                  Cloudflare WARP                          │
│                                                          │
│  本质:基于 WireGuard 协议的免费 VPN                     │
│                                                          │
│  特点:                                                   │
│  - 完全免费(WARP 基础版)                                │
│  - 全球 300+ 节点                                        │
│  - WireGuard 协议,速度快                                 │
│  - 集成 1.1.1.1 DNS                                      │
│  - 自动选择最近节点                                      │
│                                                          │
│  用途:                                                   │
│  1. 保护隐私(加密流量)                                  │
│  2. 解锁地域内容(WARP+ 付费版可选国家)                  │
│  3. 作为代理出口(隐藏真实 IP)                          │
│  4. IPv4/IPv6 双栈支持                                   │
│  5. DNS 加密(1.1.1.1)                                  │
└──────────────────────────────────────────────────────────┘

🛠️ 第一部分:Cloudflare 优选 IP

工具一:CloudflareST(推荐)

CloudflareST 是目前最流行的 Cloudflare IP 优选工具,支持延时测试和带宽测速。

BASH
# 下载 CloudflareST
# GitHub: https://github.com/XIU2/CloudflareSpeedTest

# Linux
wget https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_linux_amd64.tar.gz
tar -xzvf CloudflareST_linux_amd64.tar.gz
chmod +x CloudflareST

# macOS
wget https://github.com/XIU2/CloudflareSpeedTest/releases/download/v2.2.5/CloudflareST_darwin_amd64.zip
unzip CloudflareST_darwin_amd64.zip
chmod +x CloudflareST

# Windows
# 下载 CloudflareST_windows_amd64.zip 并解压

基础用法:

BASH
# 默认测试(延时 + 下载测速)
./CloudflareST

# 输出示例:
# IP              已发送  已接收  丢包率  平均发送时间  下载速度 (MB/s)
# 104.16.123.1    4       4       0.00    142.15         8.32
# 172.64.155.1    4       4       0.00    156.32         7.85
# ...

高级用法:

BASH
# 只测试延时,不测速(快速)
./CloudflareST -dn 0

# 测试指定数量的 IP(默认 200 个)
./CloudflareST -n 500

# 测速线程数(默认 200)
./CloudflareST -t 100

# 测速时长(秒,每个 IP 测试 10 秒)
./CloudflareST -dt 10

# 输出到文件
./CloudflareST -o result.csv

# 指定下载测速 URL
./CloudflareST -url https://speed.cloudflare.com/__down?bytes=100000000

# 过滤指定延迟范围(ms)
./CloudflareST -tl 200 -tll 50
# 只保留延迟在 50-200ms 之间的 IP

# 过滤指定速度范围(MB/s)
./CloudflareST -sl 5
# 只保留下载速度大于 5MB/s 的 IP

# 输出结果数量
./CloudflareST -p 10
# 显示前 10 个最优结果

完整参数示例:

BASH
./CloudflareST \
  -n 500 \
  -t 200 \
  -dn 10 \
  -dt 5 \
  -tl 200 \
  -tll 30 \
  -sl 5 \
  -p 20 \
  -o result.csv \
  -url https://speed.cloudflare.com/__down?bytes=200000000

# 参数说明:
# -n 500      :延时测试 500 个 IP
# -t 200      :200 个并发线程
# -dn 10      :下载测速 10 个 IP
# -dt 5       :每个 IP 测速 5 秒
# -tl 200     :延迟上限 200ms
# -tll 30     :延迟下限 30ms
# -sl 5       :速度下限 5MB/s
# -p 20       :输出前 20 个结果
# -o result.csv:结果保存到文件

工具二:cf-ddns(动态优选)

将优选 IP 自动更新到 DNS 记录:

BASH
# 下载 cf-ddns
git clone https://github.com/timothymcassey/cloudflare-ddns.git
cd cloudflare-ddns

# 配置
cp config.json.example config.json

# 编辑配置
cat > config.json << 'EOF'
{
  "cloudflare": {
    "email": "your-email@example.com",
    "api_key": "your-api-key",
    "zone_id": "your-zone-id"
  },
  "records": [
    {
      "name": "cf.example.com",
      "type": "A",
      "ttl": 60
    }
  ],
  "preferred_ip_script": "/path/to/CloudflareST"
}
EOF

# 运行
python3 cf-ddns.py

工具三:自建优选 API

部署一个 API 服务,自动返回最优 IP:

PYTHON
#!/usr/bin/env python3
# cf-optimizer.py - Cloudflare 优选 IP API 服务

import subprocess
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
from datetime import datetime

class CFHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == '/api/optimised-ip':
            # 运行优选脚本
            result = subprocess.run(
                ['./CloudflareST', '-dn', '0', '-p', '1', '-o', 'result.csv'],
                capture_output=True, text=True
            )

            # 解析结果
            with open('result.csv', 'r') as f:
                lines = f.readlines()
                if len(lines) > 1:
                    ip = lines[1].split(',')[0]
                    latency = lines[1].split(',')[5]

                    response = {
                        'ip': ip,
                        'latency': latency,
                        'timestamp': datetime.now().isoformat(),
                        'status': 'success'
                    }
                else:
                    response = {'status': 'error', 'message': 'No result'}

            self.send_response(200)
            self.send_header('Content-type', 'application/json')
            self.end_headers()
            self.wfile.write(json.dumps(response).encode())

        elif self.path == '/api/best-ips':
            # 返回多个优选 IP
            result = subprocess.run(
                ['./CloudflareST', '-dn', '0', '-p', '10', '-o', 'result.csv'],
                capture_output=True, text=True
            )

            ips = []
            with open('result.csv', 'r') as f:
                lines = f.readlines()
                for line in lines[1:11]:  # 前 10 个
                    parts = line.split(',')
                    if len(parts) > 5:
                        ips.append({
                            'ip': parts[0],
                            'latency': parts[5],
                            'speed': parts[9] if len(parts) > 9 else 'N/A'
                        })

            response = {
                'ips': ips,
                'count': len(ips),
                'timestamp': datetime.now().isoformat()
            }

            self.send_response(200)
            self.send_header('Content-type', 'application/json')
            self.end_headers()
            self.wfile.write(json.dumps(response).encode())

        else:
            self.send_response(404)
            self.end_headers()

if __name__ == '__main__':
    server = HTTPServer(('0.0.0.0', 8080), CFHandler)
    print('CF Optimizer API running on http://0.0.0.0:8080')
    server.serve_forever()
BASH
# 运行 API 服务
pip install flask
python3 cf-optimizer.py

# 测试
curl http://localhost:8080/api/optimised-ip
# {"ip": "104.16.123.1", "latency": "142.15", ...}

curl http://localhost:8080/api/best-ips
# {"ips": [...], "count": 10, ...}

使用优选 IP 的场景

场景一:代理节点加速

BASH
# 将优选 IP 用于代理节点
# 在客户端配置中,将 server 替换为优选 IP
# SNI 保持原域名不变

# Clash Meta 配置示例
proxies:
  - name: "CF-Optimized"
    type: vless
    server: 104.16.123.1  # 优选 IP
    port: 443
    uuid: your-uuid
    servername: proxy.example.com  # SNI 保持原域名
    network: ws
    ws-opts:
      path: /secretpath
      headers:
        Host: proxy.example.com  # Host 头保持原域名
    tls: true

场景二:CDN 加速

PLAINTEXT
# 在域名 DNS 中使用优选 IP
# 方法一:A 记录直接指向优选 IP
# 方法二:使用 CNAME 到优选域名

# 假设你的网站是 example.com
# 在 Cloudflare DNS 中:
# A    example.com    104.16.123.1    Proxied
# A    www            172.64.155.1    Proxied

场景三:自建 API 供多设备使用

BASH
# 定时运行优选,更新所有设备
# crontab -e
0 */6 * * * /path/to/CloudflareST -o /path/to/result.csv -dn 0 -p 1

# 脚本自动更新客户端配置
#!/bin/bash
# update-cf-ip.sh
BEST_IP=$(head -2 /path/to/result.csv | tail -1 | cut -d',' -f1)
sed -i "s/server: .*/server: $BEST_IP/" /path/to/clash/config.yaml
systemctl restart clash

🚀 第二部分:Cloudflare WARP 部署

方案一:官方 WARP 客户端

BASH
# 安装 WARP 客户端
# Linux (Debian/Ubuntu)
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list
apt update
apt install cloudflare-warp

# macOS
brew install --cask cloudflare-warp

# Windows
# 下载 https://1.1.1.1/ 并安装

# 注册设备
warp-cli registration new

# 连接
warp-cli connect

# 查看状态
warp-cli status
# 输出:Status update: Connected

# 断开
warp-cli disconnect

WARP 模式:

BASH
# 1. WARP 模式(默认):所有流量走 WARP
warp-cli mode warp

# 2. WARP+ 模式(付费,更快)
warp-cli mode warp
# 需要 WARP+ 订阅或使用 referral 链接获取

# 3. 代理模式(只代理指定流量)
warp-cli mode proxy
# 本地监听 socks5://127.0.0.1:40000

# 4. DoH 模式(只加密 DNS)
warp-cli mode doh

方案二:WireGuard 模式(推荐)

将 WARP 作为 WireGuard 配置,灵活集成到各种代理工具中。

BASH
# 获取 WARP WireGuard 配置
# 方法一:使用 warp-reg 脚本
git clone https://github.com/cmj2002/warp-reg.git
cd warp-reg
python3 warp-reg.py

# 输出:
# [Interface]
# PrivateKey = xxxxxxxx
# Address = 172.16.0.2/32
# Address = 2606:4700:110::xxxx/128
# DNS = 1.1.1.1
# MTU = 1280
#
# [Peer]
# PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
# Endpoint = 162.159.192.1:2408
# AllowedIPs = 0.0.0.0/0
# AllowedIPs = ::/0

保存配置:

BASH
# 保存为 WireGuard 配置文件
cat > /etc/wireguard/warp.conf << 'EOF'
[Interface]
PrivateKey = 你的私钥
Address = 172.16.0.2/32
Address = 2606:4700:110::xxxx/128
DNS = 1.1.1.1
MTU = 1280

[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
Endpoint = 162.159.192.1:2408
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
EOF

# 启动 WARP
wg-quick up warp

# 验证
curl ifconfig.me
# 应显示 Cloudflare 的 IP

# 停止
wg-quick down warp

方案三:WARP+ 免费获取

WARP+ 是付费版($4.99/月),但可以通过 referral 获取免费流量:

BASH
# 方法一:使用 referral 链接
# 在手机 App 中分享你的 referral 链接
# 每邀请一人获得 1GB WARP+ 流量

# 方法二:使用脚本自动刷流量
# GitHub: https://github.com/yyuueexxiinngg/warp-plus-bot

# 方法三:使用 Telegram Bot
# 搜索 @generatewarpplusbot

🔗 第三部分:WARP 与代理协议组合

组合一:WARP 作为代理出口

让代理流量通过 WARP 出口,隐藏真实服务器 IP:

sing-box 配置:

JSON
{
  "outbounds": [
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "wireguard",
      "tag": "warp",
      "server": "162.159.192.1",
      "server_port": 2408,
      "local_address": ["172.16.0.2/32", "2606:4700:110::xxxx/128"],
      "private_key": "你的WARP私钥",
      "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
      "mtu": 1280
    }
  ],
  "route": {
    "rules": [
      {
        "domain_suffix": ["openai.com", "chatgpt.com"],
        "outbound": "warp"
      },
      {
        "domain_suffix": ["netflix.com"],
        "outbound": "warp"
      }
    ],
    "final": "direct"
  }
}

效果:

组合二:WARP + 优选 IP

BASH
# 1. 优选 WARP 的 Endpoint IP
./CloudflareST -url https://speed.cloudflare.com/__down?bytes=100000000 -tl 200 -p 5

# 2. 使用优选 IP 替换 WARP Endpoint
cat > /etc/wireguard/warp.conf << 'EOF'
[Interface]
PrivateKey = 你的私钥
Address = 172.16.0.2/32
Address = 2606:4700:110::xxxx/128
DNS = 1.1.1.1
MTU = 1280

[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
Endpoint = 104.16.123.1:2408  # 优选 IP
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
EOF

# 3. 启动
wg-quick up warp

# 4. 测试延迟
ping -c 10 162.159.192.1
# 对比优选前后延迟

组合三:WARP 链式代理

PLAINTEXT
用户 → 代理服务器 A → WARP → 目标网站

效果:
- 目标网站看到的是 Cloudflare 的 IP
- 即使代理服务器 A 被封锁,WARP 仍然可用
- 双重隐藏真实身份

xray 配置(WARP 出站):

JSON
{
  "outbounds": [
    {
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "socks",
      "tag": "warp",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 40000
          }
        ]
      }
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "domain": ["openai.com", "chatgpt.com", "netflix.com"],
        "outboundTag": "warp"
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "direct"
      }
    ]
  }
}
BASH
# 启动 WARP 代理模式
warp-cli mode proxy
# 本地监听 socks5://127.0.0.1:40000

# 启动 xray
xray -c /etc/xray/config.json

组合四:WARP 解锁流媒体

JSON
// sing-box 配置 - 流媒体分流
{
  "outbounds": [
    {
      "type": "wireguard",
      "tag": "warp",
      "server": "162.159.192.1",
      "server_port": 2408,
      "local_address": ["172.16.0.2/32"],
      "private_key": "你的WARP私钥",
      "peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
      "mtu": 1280
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "rules": [
      {
        "domain_suffix": [
          "netflix.com",
          "nflxvideo.net",
          "nflximg.net",
          "nflxext.com"
        ],
        "outbound": "warp"
      },
      {
        "domain_suffix": ["openai.com", "chatgpt.com", "oaistatic.com"],
        "outbound": "warp"
      },
      {
        "domain_suffix": ["disneyplus.com", "disney-plus.net"],
        "outbound": "warp"
      }
    ],
    "final": "direct"
  }
}

🏗️ 第四部分:完整实战方案

方案 A:家庭网络 WARP 加速

PLAINTEXT
┌──────────────────────────────────────────────────────────┐
│              家庭网络 WARP 加速架构                      │
│                                                          │
│  家庭设备 → 路由器(OpenWrt)→ WireGuard WARP           │
│                    │                                    │
│                    ├── 优选 WARP Endpoint               │
│                    ├── 国内流量直连                     │
│                    └── 国外流量走 WARP                  │
│                                                          │
│  效果:                                                  │
│  - 全家设备自动走 WARP                                   │
│  - 免费、稳定                                            │
│  - 不需要自建服务器                                      │
└──────────────────────────────────────────────────────────┘

OpenWrt 配置:

BASH
# 1. 安装 WireGuard
opkg update
opkg install wireguard-tools luci-proto-wireguard

# 2. 配置 WARP 接口
# 在 OpenWrt 后台:
# 网络 → 接口 → 添加新接口
# 名称:warp
# 协议:WireGuard

# 3. 配置
uci set network.warp=interface
uci set network.warp.proto='wireguard'
uci set network.warp.private_key='你的WARP私钥'
uci set network.warp.addresses='172.16.0.2/32'
uci commit network

# 4. 配置 Peer
uci add network wireguard_warp
uci set network.@wireguard_warp[0].public_key='bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo='
uci set network.@wireguard_warp[0].endpoint_host='162.159.192.1'
uci set network.@wireguard_warp[0].endpoint_port='2408'
uci set network.@wireguard_warp[0].allowed_ips='0.0.0.0/0'
uci set network.@wireguard_warp[0].persistent_keepalive='25'
uci commit network

# 5. 配置防火墙
uci set firewall.warp=zone
uci set firewall.warp.name='warp'
uci set firewall.warp.input='REJECT'
uci set firewall.warp.forward='ACCEPT'
uci set firewall.warp.output='ACCEPT'
uci set firewall.warp.masq='1'
uci set firewall.warp.mtu_fix='1'
uci set firewall.warp.network='warp'
uci commit firewall

# 6. 配置策略路由(国内直连,国外走 WARP)
# 安装 mwan3 或使用 ip-rule
ip route add default dev warp table 100
ip rule add fwmark 0x1 table 100

# 7. 重启网络
/etc/init.d/network restart

方案 B:服务器 WARP 出口

BASH
# 在 VPS 上配置 WARP 作为出口
# 用于解锁 ChatGPT、Netflix 等

# 1. 安装 WireGuard
apt install wireguard

# 2. 获取 WARP 配置
python3 warp-reg.py > /etc/wireguard/warp.conf

# 3. 启动 WARP
wg-quick up warp

# 4. 配置 sing-box 使用 WARP
# (参考前面的 sing-box 配置)

# 5. 测试
curl --interface warp ifconfig.me
# 应显示 Cloudflare 的 IP

方案 C:优选 IP + WARP 双重加速

PLAINTEXT
┌──────────────────────────────────────────────────────────┐
│          优选 IP + WARP 双重加速架构                     │
│                                                          │
│  客户端 → 优选 Cloudflare IP → WARP → 目标网站          │
│                                                          │
│  效果:                                                  │
│  - 优选 IP 降低客户端到 Cloudflare 的延迟                │
│  - WARP 提供干净的出口 IP                                │
│  - 双重加速,速度最大化                                  │
│  - 完全免费                                              │
└──────────────────────────────────────────────────────────┘

实现脚本:

BASH
#!/bin/bash
# warp-optimizer.sh - WARP 优选 IP 脚本

# 1. 优选 Cloudflare IP
cd /path/to/CloudflareST
./CloudflareST -dn 0 -tl 200 -p 1 -o result.csv

# 2. 获取最优 IP
BEST_IP=$(head -2 result.csv | tail -1 | cut -d',' -f1)
echo "最优 IP: $BEST_IP"

# 3. 更新 WARP 配置
sed -i "s/Endpoint = .*/Endpoint = $BEST_IP:2408/" /etc/wireguard/warp.conf

# 4. 重启 WARP
wg-quick down warp
wg-quick up warp

# 5. 验证
echo "WARP 状态:"
wg show warp
echo ""
echo "出口 IP:"
curl --interface warp ifconfig.me

# 6. 设置定时任务(每 6 小时优选一次)
# crontab -e
# 0 */6 * * * /path/to/warp-optimizer.sh

📊 监控与自动化

自动优选定时任务

BASH
# crontab -e

# 每 6 小时优选一次
0 */6 * * * /path/to/warp-optimizer.sh >> /var/log/warp-optimizer.log 2>&1

# 每天凌晨 3 点全面测速
0 3 * * * /path/to/CloudflareST -dn 10 -dt 10 -tl 200 -p 20 -o /var/log/cf-best-ips.csv

# 每小时检查 WARP 连接
0 * * * * /usr/bin/wg show warp > /dev/null 2>&1 || wg-quick up warp

监控脚本

PYTHON
#!/usr/bin/env python3
# monitor-warp.py - WARP 监控脚本

import subprocess
import time
import json
from datetime import datetime

def check_warp():
    """检查 WARP 状态"""
    result = subprocess.run(['wg', 'show', 'warp'], capture_output=True, text=True)
    return result.returncode == 0

def get_warp_ip():
    """获取 WARP 出口 IP"""
    result = subprocess.run(
        ['curl', '--interface', 'warp', '-s', 'ifconfig.me'],
        capture_output=True, text=True, timeout=10
    )
    return result.stdout.strip()

def test_latency():
    """测试延迟"""
    result = subprocess.run(
        ['ping', '-c', '5', '1.1.1.1'],
        capture_output=True, text=True, timeout=30
    )
    # 解析平均延迟
    for line in result.stdout.split('\n'):
        if 'avg' in line:
            return line.split('=')[1].strip()
    return 'N/A'

def main():
    while True:
        status = {
            'timestamp': datetime.now().isoformat(),
            'warp_connected': check_warp(),
            'warp_ip': get_warp_ip() if check_warp() else 'N/A',
            'latency': test_latency()
        }

        print(json.dumps(status, indent=2))

        # 如果断开,自动重连
        if not status['warp_connected']:
            subprocess.run(['wg-quick', 'up', 'warp'])

        time.sleep(60)  # 每分钟检查一次

if __name__ == '__main__':
    main()

🔍 故障排查

问题 1:WARP 连接失败

BASH
# 检查 WireGuard 状态
wg show

# 检查接口
ip addr show warp

# 检查路由
ip route show table main | grep warp

# 查看日志
journalctl -u wg-quick@warp

# 常见原因:
# 1. 私钥配置错误
# 2. Endpoint 不可达
# 3. 防火墙阻止 UDP 2408
# 4. MTU 设置不当

# 解决:
# 1. 重新获取 WARP 配置
python3 warp-reg.py

# 2. 检查 UDP 连通性
nc -zuv 162.159.192.1 2408

# 3. 调整 MTU
sed -i 's/MTU = 1280/MTU = 1360/' /etc/wireguard/warp.conf

问题 2:优选 IP 测速为 0

BASH
# 检查网络连通性
ping 104.16.123.1

# 检查测速 URL
curl -I https://speed.cloudflare.com/__down?bytes=100000000

# 更换测速 URL
./CloudflareST -url https://cf.los9.me/upload

# 检查防火墙
iptables -L -n | grep DROP

# 解决:
# 1. 使用 -dn 0 只测延迟
# 2. 更换测速 URL
# 3. 关闭防火墙测试

问题 3:WARP 解锁失效

BASH
# 检查出口 IP
curl --interface warp ifconfig.me

# 检查 IP 归属地
curl --interface warp https://ipinfo.io

# 如果显示国内 IP,说明 WARP 没生效

# 重新注册 WARP
warp-cli registration delete
warp-cli registration new

# 或重新获取 WireGuard 配置
python3 warp-reg.py

问题 4:速度慢

BASH
# 优选 WARP Endpoint
./CloudflareST -tl 200 -p 5

# 使用优选 IP 替换 Endpoint
# 编辑 /etc/wireguard/warp.conf

# 调整 MTU
# 尝试 1280 / 1360 / 1380 / 1420
sed -i 's/MTU = .*/MTU = 1360/' /etc/wireguard/warp.conf
wg-quick down warp && wg-quick up warp

# 测速
curl --interface warp -o /dev/null -s -w "%{speed_download}\n" \
  https://speed.cloudflare.com/__down?bytes=100000000

🆚 方案对比

方案成本速度配置难度适用场景
优选 IP免费⭐⭐⭐⭐⭐⭐⭐⭐CDN 加速、代理优化
WARP 客户端免费⭐⭐⭐个人设备 VPN
WARP WireGuard免费⭐⭐⭐⭐⭐⭐⭐服务器集成
WARP+$4.99/月⭐⭐⭐⭐⭐追求极致速度
优选 IP + WARP免费⭐⭐⭐⭐⭐⭐⭐⭐⭐最佳免费方案

📋 完整部署检查清单

PLAINTEXT
优选 IP 部署:
□ 下载 CloudflareST 工具
□ 运行延时测试
□ 运行带宽测速
□ 记录最优 IP
□ 配置代理节点使用优选 IP
□ 设置定时优选任务

WARP 部署:
□ 获取 WARP WireGuard 配置
□ 配置 /etc/wireguard/warp.conf
□ 启动 WARP 并验证连接
□ 测试出口 IP
□ 测试延迟和速度

组合应用:
□ 优选 WARP Endpoint IP
□ 配置代理工具使用 WARP 出口
□ 配置流媒体分流规则
□ 测试解锁效果

监控自动化:
□ 设置定时优选任务
□ 配置 WARP 自动重连
□ 部署监控脚本
□ 设置告警通知

结语

Cloudflare 优选 IP 和 WARP 是两大利器——优选 IP 让你找到最快的 Cloudflare 节点,WARP 给你一个免费、干净、全球可用的 VPN。两者结合,就是一套完整、免费、高效的 Cloudflare 加速方案。

总结要点:

推荐组合方案:

PLAINTEXT
个人使用:
  WARP 客户端 + 优选 IP

服务器使用:
  WARP WireGuard + 优选 Endpoint + sing-box 分流

家庭使用:
  OpenWrt + WARP 接口 + 策略路由

极致免费:
  优选 IP + WARP + 流媒体分流

记住:Cloudflare 提供了全球最好的免费 CDN 和 VPN 网络,学会利用它,你就拥有了免费的全球加速通道。

愿你的网络永远快速、自由!☁️

版权声明

作者: 易邦

链接: https://blog.e8k.net/posts/cf-preferred-ip-warp/

许可证: 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。