Skip to content
intermediate

在 Linux 上配置 ChangeMyIP WireGuard

使用 wg-quick 在 Linux 上设置 ChangeMyIP WireGuard 隧道,支持全隧道或分流隧道路由选项。

Linux WireGuard 隐私/匿名性

概述

本教程介绍如何在 Linux 上配置 ChangeMyIP WireGuard 隧道。ChangeMyIP 将 WireGuard 列为受支持的协议,与 HTTP、SOCKS5、Shadowsocks、Trojan 和 DNS 并列。WireGuard 创建的是加密网络接口,而不是本地代理。请使用 ChangeMyIP 为你的账户提供的 WireGuard 配置信息。

步骤

  1. 登录 ChangeMyIP,找到或生成你所选端点的 WireGuard 配置。如果你的套餐不包含 WireGuard,请改用 HTTP 或 SOCKS5 代理教程。
  2. 在你的 Linux 发行版上安装 WireGuard 工具。对于 Debian 或 Ubuntu: sudo apt update && sudo apt install wireguard
  3. 将 ChangeMyIP 的 WireGuard 配置保存为 /etc/wireguard/changeip.conf。
  4. 限制权限: sudo chmod 600 /etc/wireguard/changeip.conf
  5. 启动隧道: sudo wg-quick up changeip
  6. 检查接口: sudo wg show
  7. 测试你的公网 IP: curl https://ifconfig.me
  8. 如果该 IP 与 ChangeMyIP 端点一致,则说明隧道已启用。
  9. 如需分流隧道,请编辑配置中的 AllowedIPs,使只有目标子网使用该隧道。仅当你希望通过隧道进行 DNS 查询时才保留 DNS 设置。
  10. 停止隧道: sudo wg-quick down changeip
  11. 开机自动启动: sudo systemctl enable wg-quick@changeip
  12. 如果隧道失败,请检查端点、密钥和防火墙规则,并确认你的 ChangeMyIP 套餐包含 WireGuard。