星期日, 九月 07, 2025

188 IPv6 only 服务器上 Mihomo 入站 + 安装 WARP

环境与需求: 

IPv6 only 小鸡, 想上双栈 warp, 同时开放一个 socks5 端口, 用于 Mihomo 连入. warp 不要像 tun 那样来占用我的整个小鸡网络. 

流程: 

目标网站 - warp - socks5 - Mihomo - 机场 - 我的设备 

 

1, 运行脚本

wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh

2, 选

3. 为 IPv6 only 添加 WARP 双栈网络接口
1. wireguard 内核 (默认)
2. 非全局
1. 使用免费账户 (默认)
3. 使用 VPS 初始设置 (默认)

3, 选 13 安装 wireproxy 和进行设置, 最后可能会出错, 会显示如下信息, 看起来像是安装完成, 但是 wget 解析域名的时候解析到了 IPv4 的地址, 所以返回了 Network is unreachable: 

 进度 1/3: 安装系统依赖……

--2025-09-07 09:11:58--  https://github.com/pufferffish/wireproxy/releases/download/v1.0.9/wireproxy_linux_amd64.tar.gz
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... failed: Network is unreachable.
--2025-09-07 09:11:58--  https://gitlab.com/fscarmen/warp/-/raw/main/wireproxy/wireproxy_linux_amd64.tar.gz
Resolving gitlab.com (gitlab.com)... 172.65.251.78
Connecting to gitlab.com (gitlab.com)|172.65.251.78|:443... failed: Network is unreachable.
0% [Working]
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
0% [Waiting for headers]
 进度 2/3: 已处理好 WARP 配置文件

Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy-security InRelease
Fetched 128 kB in 8s (16.3 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
157 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
openresolv is already the newest version (3.12.0-2).
iptables is already the newest version (1.8.7-1ubuntu5.2).
net-tools is already the newest version (1.60+git20181103.0eebece-1ubuntu5.4).
dnsutils is already the newest version (1:9.18.30-0ubuntu0.22.04.2).
0 upgraded, 0 newly installed, 0 to remove and 157 not upgraded.

 进度 3/3: 寻找 MTU 最优值已完成

 创建快捷 warp 指令成功
 WireProxy 还未安装

4, 直接去下载 wireproxy 的 amd64 包, 放入 /usr/bin/ 下, 给 0755 权限, 注意不是放在 /usr/local/bin/ 里面

https://github.com/whyvl/wireproxy/releases

5, 修改 /etc/wireguard/ 下的各项配置文件, 保证 dns 不为 IPv4. 不然 wireproxy 服务会报错:

journalctl -xeu wireproxy.service


-- Support: http://www.ubuntu.com/support
--
-- A start job for unit wireproxy.service has finished successfully.
--
-- The job identifier is 3900.
Sep 07 09:46:52 HK-LXC wireproxy[13136]: 2025/09/07 09:46:52 lookup engage.cloudflareclient.com on 8.8.8.8:53: dial udp 8.8.8.8:53: connect: network is unreachable
Sep 07 09:46:52 HK-LXC systemd[1]: wireproxy.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit wireproxy.service has exited.

修改 warp.conf 底下的 DNS 和 Endpoint 为 IPv6, 改 Endpoint 是因为域名不知道去哪个弱智 IPv4 DNS 请求导致不能解析, 所以就直接写成固定的 IPv6 地址:

DNS = 2606:4700:4700::1001,2606:4700:4700::1111
Endpoint = [2606:4700:d0::a29f:c001]:2408

修改 proxy.conf 底下的 DNS 和 Endpoint 为 IPv6, 如上.

5, 再次执行 warp 命令, 选 2.连接 Wireproxy (warp y) 或者直接执行 warp y

如果还启不来, 看看是否有 wireproxy 的服务:

systemctl list-unit-files | grep wire

如果没有服务, 手动添加一个, 注意从 /lib/systemd/system/wireproxy.service

[Unit]
Description=WireProxy for WARP
After=network.target
Documentation=https://github.com/fscarmen/warp-sh
Documentation=https://github.com/pufferffish/wireproxy
[Service]
ExecStart=/usr/bin/wireproxy -c /etc/wireguard/proxy.conf
RemainAfterExit=yes
Restart=always
[Install]
WantedBy=multi-user.target
systemctl daemon-reload

service 命令如果启动还有报错, 尝试手动运行

/usr/bin/wireproxy -c /etc/wireguard/proxy.conf

可能会看到

2025/09/07 09:59:06 lookup engage.cloudflareclient.com on 8.8.8.8:53: dial udp 8.8.8.8:53: connect: network is unreachable

这样的报错, warp 或者一键脚本擅自修改了 resolv.conf 也就是系统 DNS, 改回 IPv6 的即可, 如

nameserver 2606:4700:4700::1001
nameserver 2606:4700:4700::1111

另外可能有端口占用的问题, 从 netstat -lntpu 会看到哪个进程占用, 干掉端口占用的进程或者用脚本换新的 socks 端口. 


Mihomo 入站只需提一嘴, 会搓配置的人一看就懂

#config.yaml
log-level: silent
ipv6: true
tcp-concurrent: true
listeners:
  - name: myvmess
    type: vmess
    port: 80
    listen: 0.0.0.0
    users:
     - username: 1
       uuid: c441dae3-1176-4640-9c51-666e2f80d92c
       alterId: 0
       udp: true
       cipher: auto
proxies:
  - name: warp
    type: socks5
    server: 127.0.0.1
    port: 1080
    udp: true
dns:
  enable: true
  listen: 127.0.0.1:53
  ipv6: true
  nameserver:
    - https://[2606:4700:4700::1001]:443/dns-query#DIRECT
    - https://[2606:4700:4700::1111]:443/dns-query#DIRECT
  default-nameserver:
    - https://[2606:4700:4700::1001]:443/dns-query#DIRECT
rules:
  - MATCH,warp

注意 proxies 里面 udp 要开, 查看 udp 是否能通, 去 https://networktest.twilio.com/ 网站检测一下就行, 如果 udp: true 忘记写了的话, twilio 里面第一条  NTS: TURN UDP Connectivity 会显示 failed. 

nameserver 我用了 Cloudflare 的两个 doh 来查询, warp 只管和 ip 之间的流量, warp 用的是 udp 53 的传统 dns, 我完全不信任这种协议. 

0 条评论: