原帖:HAX IPv6 VPS 搭 V2ray 梯子 VLESS+Websocket+TLS 模式 Warp开IPv4'网口' 免费 白嫖 全程手机操作
时间:2022年03月08日
链接:https://zelikk.blogspot.com/2022/03/hax-ipv6-only-vps-v2ray-vmess-tcp-warp-ipv4.html

先放命令:

bash <(curl -L https://github.com/crazypeace/V2ray_VLESS_WebSocket_TLS_CaddyV2/raw/main/install.sh)
bash <(curl -L git.io/warp.sh) 4

前提条件:

手机能上Telegram。
手机有个翻墙工具,比如 Shadowrocket,或者 V2rayNG.
手机走数据流量有IPv6。一般来说都有。用你的手机流量访问 http://test-ipv6.com/ 测试一下。
转载注:其实这个条件并不是一定需要手机的,也可以使用电脑,只要能电脑能翻墙,能上Telegram,有ipv6地址就行了。
测试ipv6连通性
手机要有个SSH工具。
转载注:电脑上可以使用SSH工具,而且有很多选择,在这里不做过多介绍
iOS可以用 Termius 图标是这个
iOS可以用 Termius 图标
安卓可以用 JuiceSSH (官方网站changelog)
安卓可以用  JuiceSSH (官方网站changelog)

搭建过程

1. 创建 HAX VPS

访问 https://hax.co.id/ 点击左上角 "三" - Register
也可以直接访问 https://hax.co.id/register
创建 HAX VPS 访问 https://hax.co.id/ 点击左上角 "三" - Register
点击机器人的名字,发送 /getid 给机器人,就会得到你的 Telegram ID,将其填到此页面内。点击"Submit"
点击机器人的名字,发送 /getid 给机器人,就会得到你的 Telegram ID,将其填到此页面内。点击"Submit"
接收验证码,填写到页面中,输入你的HAX账户密码。点击"Submit"
接收验证码,填写到页面中,输入你的HAX账户密码。点击"Submit"
登录HAX账户,也可以直接访问 https://hax.co.id/login
登录HAX账户,也可以直接访问 https://hax.co.id/login
输入用户名,密码,通过人机验证,点击"Submit"
输入用户名,密码,通过人机验证,点击"Submit"
点击 "三" - "VPS" - "Create VPS",也可以直接访问 https://hax.co.id/create-vps/
点击 "三" - "VPS" - "Create VPS",也可以直接访问 https://hax.co.id/create-vps/
数据中心随便选,不是OPENVZ的就行,操作系统推荐 Debian 11,root密码自己定一个,推荐用 https://git.io/xkcdpw 生成,VPS目的随便选,勾上一堆"我同意",再通过一下人机验证。点击 "CREATE VPS"
数据中心随便选
过几分钟去看 VPS - VPS Info,也可以直接访问 https://hax.co.id/vps-info
把你的 VPS 的 IPv6 地址记下来
VPS 的 IPv6 地址
VPS 的 IPv6 地址

2. SSH 登录 VPS

打开 Termius,进入 Host
打开 Termius,进入 Host
右上角的 "+" 号,添加 Host
右上角的 "+" 号,添加 Host
Hostname 填 VPS 的 IPv6 地址
Username 填 root
Password 填 root 密码 (Create VPS那一步填的密码)
点击 "Save"
Hostname 填 VPS 的 IPv6 地址
点击刚刚保存的 Host
点击刚刚保存的 Host
第一次登录 要同意服务器的指纹。
第一次登录 要同意服务器的指纹。
点击 连接好的 Host
点击 连接好的 Host
就可以命令行操作 HAX VPS 了。
就可以命令行操作 HAX VPS 了。
推荐优化一下 Termius 的设置,以方便你自己使用:Termius 附加键盘设置
https://zelikk.blogspot.com/2022/03/termius-ctrl-paste.html
不作此设置也可以,不影响以下步骤,只是操作方便与否。
转载注:以上SSH的操作在电脑上也可以进行,或者手机开一个热点,用电脑连接,这样电脑也就有了ipv6地址了。

3. 申请Hax提供的免费域名

点击 DNS Pointing CF
也可以直接访问 https://hax.co.id/dns-pointing
点击 DNS Pointing CF
CF Proxy - No
DNS Name - 数字字母组合随便弄一个
IPv6 Address - 你的VPS的IPv6地址
通过人机验证
点击 Create DNS
点击 Create DNS
你申请出来的域名是这样的
你申请出来的域名是这样的
如果不成功,可以把Domain Name那一栏换一下
如果不成功,可以把Domain Name那一栏换一下

4. 搭建 VLESS + WebSocket + TLS 模式的 V2Ray

用SSH工具登录VPS,输入命令

apt update
apt install -y curl
bash <(curl -L https://github.com/crazypeace/V2ray_VLESS_WebSocket_TLS_CaddyV2/raw/main/install.sh)

* 注意第3条命令很长,其实是一条命令。
一路上按提示输入。
域名填你刚刚申请的
问你IPv4还是IPv6输入6
其它的选项都可以回车默认
最终得到一个vless://链接。复制这个vless链接,添加到你手机的翻墙软件里面。访问google.com试试。
正常的完整安装日志请见文末。出现问题时可以与你自己的安装过程日志进行对比。

5. 添加 warp IPv4 '网口'

有些应用只支持IPv4,比如Telegram。所以我们利用warp给纯IPv6的小鸡添加IPv4对外访问的能力。

bash <(curl -fsSL git.io/warp.sh) 4

---------------------
到目前为止,这个梯子只能接受IPv6访问。也就是说只有你的手机数据流量能用。如果你想给你的电脑使用,我们可以利用Cloudflare的CDN在中间作个转换。

6. 打开CDN

回到前面添加域名的那里 https://hax.co.id/dns-pointing
回到前面添加域名的那里 https://hax.co.id/dns-pointing
先删除CF Proxy为No的那条DNS
先删除CF Proxy为No的那条DNS
(注意,有可能你前面操作时间过长,hax.co.id变为未登录状态,是查看不到你添加过的DNS记录的)
再申请一个CF Proxy为Yes的DNS,注意只有CF Proxy为Yes,DNS name与之前的保持一致。
再申请一个CF Proxy为Yes的DNS
生效IPv4的访问需要多一点时间,你可以在你的IPv4环境上ping你的域名,有解析IP地址了就可以用这个梯子了。
梯子的配置参数没有变化,可以使用安装完成时显示的vless://链接。
---------------------



---------------------
后记
---------------------
如果你是在US-1下面开的实例,遇到了脚本跑起来会卡住的问题


也许是Github相关域名解析失败的原因。
https://zelikk.blogspot.com/2022/03/hax-vps-us-1-github-warp-usercontents.html
你需要先跑warp脚本添加IPv4的访问能力

bash <(curl -fsSL https://raw.githubusercontents.com/crazypeace/warp.sh/main/warp.sh) 4

用我的脚本搭WebSocket + TLS 模式,在最后一步脚本显示即将安装 warp 时,按Ctrl+C退出脚本。
个别母鸡上搭了WARP的IPv4,拉github资源还是会卡住。这时候可以设置IPv4优先

bash <(curl -L https://raw.githubusercontents.com/crazypeace/warp.sh/main/ipv4v6.sh) 4

---------------------
有时候hax和woiden的网络环境影响脚本查询本机IP地址,你确认准备工作都是正确的,但是脚本就是提示"你的域名未解析到xxxxxx"。
此时你可以带域名参数跑脚本,这样可以跳过IP地址检查。

bash <(curl -L https://github.com/crazypeace/V2ray_VLESS_WebSocket_TLS_CaddyV2/raw/main/install.sh) 你的域名 6

---------------------
如果你的域名解析很长时间都没有在你的IPv4环境(电脑)生效。
先检查一下Cloudflare服务器上的IPv4解析是否生效了。蓝色部分换成你的域名。

curl -sH 'accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=chacuoganzao.ipv6a.my.id&type=A" | jq -r '.Answer[0].data'

如果返回了一个IPv4地址。说明Cloudflare那边已经生效了。

如果返回了一个IPv4地址。说明Cloudflare那边已经生效了。

如果这个IPv4你在自己的网络环境可以ping通,你可以自行修改你的IPv4环境(电脑)hosts文件,添加一行。蓝色部分换成你自己的IPv4和域名。

104.21.46.211 chacuoganzao.ipv6a.my.id

你也可以试试Cloudflare的IP优选找出你能用的Cloudflare的CDN的IPv4。
https://github.com/XIU2/CloudflareSpeedTest
---------------------
想在电脑上操作也不是不行。先要通过端口转发让电脑IPv4可以登录到HAX的IPv6的22端口上。目前Hax.co.id提供了端口转发,参考此文的第4步和第5步。不过有些转发机的IPv4已经被封了。目前还有可用的,不知道未来怎么样。
https://zelikk.blogspot.com/2022/02/gfw-hax-swap-ssh.html

update:
如果Hax是你的第一个VPS
IPv4环境下 Xshell 使用本地Socks5代理 + IPv4-IPv6 Gateway SSH 登录 IPv6 only VPS 服务器
https://zelikk.blogspot.com/2022/05/ipv4-xshell-socks5-gateway-ipv6-only-vps.html
youtube视频:https://youtu.be/0a1rKuTaJ3c

如果IPv4-IPv6 Gateway转发申请不了,可以利用Woiden的公共IPv4地址的SSH登录端口,再通过ssh命令向外登录你想操作的VPS的IPv6 SSH端口。
<在IPv4网络环境下 将Woiden VPS-A作为跳板SSH命令登录Woiden VPS-B的IPv6端口>
https://zelikk.blogspot.com/2022/08/ipv4-woiden-vps-jumphost-ssh-ipv6.html
如果你手里已经有其它VPS,还可以用这个方法
IPv4环境下 Xshell 使用JumpHost 连接 IPv6 only VPS
https://zelikk.blogspot.com/2022/04/ipv4-xshell-jumphost-ipv6-only-vps.html
---------------------
没有IPv6的环境还有一个办法操作VPS,WebBase-SSH Client.
https://ssh.hax.co.id/
没有IPv6的环境还有一个办法操作VPS,WebBase-SSH Client.
---------------------
附:一次完整操作的日志,请对比自己的操作。

[BEGIN] 2022/3/30 23:01:41
Connecting to 91.134.238.133:4487...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Linux 391932510hax.localdomain 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Mar 30 10:38:54 2022 from 2101:41d0:8:824f:22:d9e4:90a3:1
root@391932510hax:~# apt update
apt install -y curl
root@391932510hax:~# apt update
apt install -y curl
bash <(curl -L https://github.com/crazypeace/V2ray_VLESS_WebSocket_TLS_CaddyV2/raw/main/install.sh)
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]                         
Get:4 https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version InRelease [7,491 B]   
Fetched 46.8 kB in 2s (30.9 kB/s)                                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
79 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
curl is already the newest version (7.74.0-1.3+deb11u1).
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   160  100   160    0     0    124      0  0:00:01  0:00:01 --:--:--   124

此脚本仅兼容于Debian 10+系统. 如果你的系统不符合,请Ctrl+C退出脚本
可以去 https://github.com/crazypeace/V2ray_VLESS_WebSocket_TLS_CaddyV2 查看脚本整体思路和关键命令, 以便针对你自己的系统做出调整.
----------------------------------------------------------------
100 13292  100 13292    0     0   9036      0  0:00:01  0:00:01 --:--:--  9036
按  Enter 回车键  继续....或按  Ctrl + C  取消.
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease                                          
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease                                  
Get:4 https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version InRelease [7,491 B]  
Fetched 7,491 B in 2s (4,232 B/s)                                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
79 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
bash is already the newest version (5.1-2+b3).
curl is already the newest version (7.74.0-1.3+deb11u1).
jq is already the newest version (1.6-2.1).
sudo is already the newest version (1.9.5p2-3).
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.

安装V2ray最新版本
----------------------------------------------------------------
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21647  100 21647    0     0  81686      0 --:--:-- --:--:-- --:--:-- 81686
info: No new version. The current version of V2Ray is v4.44.0 .

安装CaddyV2最新版本
----------------------------------------------------------------
sudo: unable to resolve host 391932510hax.localdomain: Name or service not known
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https is already the newest version (2.2.4).
debian-archive-keyring is already the newest version (2021.1.1).
debian-keyring is already the newest version (2021.07.26).
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
sudo: unable to resolve host 391932510hax.localdomain: Name or service not known
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
sudo: unable to resolve host 391932511hax.localdomain: Name or service not known
# Source: Caddy
# Site: https://github.com/caddyserver/caddy
# Repository: Caddy / stable
# Description: Fast, multi-platform web server with automatic HTTPS


deb https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main

deb-src https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main
sudo: unable to resolve host 391932511hax.localdomain: Name or service not known
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease                                          
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease                                  
Get:4 https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version InRelease [7,491 B]  
Fetched 7,491 B in 2s (4,422 B/s)                                        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
79 packages can be upgraded. Run 'apt list --upgradable' to see them.
sudo: unable to resolve host 391932510hax.localdomain: Name or service not known
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
caddy is already the newest version (2.4.6).
0 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
打开BBR
----------------------------------------------------------------


配置 VLESS_WebSocket_TLS 模式
----------------------------------------------------------------
请输入 V2RayID 
(默认ID: 2c526f65-2f9a-4354-ae34-2135e19b2e41):


 V2RayID = 2c526f65-2f9a-4354-ae34-2135e19b2e41
----------------------------------------------------------------

请输入 V2Ray 端口 [1-65535], 不能选择 80 或 443 端口
(默认端口: 64994):


 V2Ray 端口 = 64994
----------------------------------------------------------------


请输入一个 正确的域名, 一定一定一定要正确, 不! 能! 出! 错! 
(例如: zelikk.blogspot.com): chacuoganzao.ipv6a.my.id


 你的域名 = chacuoganzao.ipv6a.my.id
----------------------------------------------------------------
如果你的小鸡是双栈(同时有IPv4和IPv6的IP),请选择你把v2ray搭在哪个'网口'上
如果你不懂这段话是什么意思, 请直接回车
Input 4 for IPv4, 6 for IPv6:  


 请将 chacuoganzao.ipv6a.my.id  解析到: 2101:4f8:151:334b:face:452:8586:1

 Resolve chacuoganzao.ipv6a.my.id  to: 2101:4f8:151:334b:face:452:8586:1

 请将 chacuoganzao.ipv6a.my.id  解析到: 2101:4f8:151:334b:face:452:8586:1
----------------------------------------------------------------

(是否已经正确解析: [Y]): Is resolution correct?y


 域名解析 = 我确定已经有解析了
----------------------------------------------------------------

请输入想要  用来分流的路径  , 例如 /v2raypath , 那么只需要输入 v2raypath 即可
(默认: [2135e19b2e41]):


 分流的路径 = /2135e19b2e41
----------------------------------------------------------------

请输入 一个正确的  网址 用来作为 网站的伪装 , 例如 https://zelikk.blogspot.com
(默认: [https://zelikk.blogspot.com]):


 伪装的网址 = https://zelikk.blogspot.com
----------------------------------------------------------------


配置 /usr/local/etc/v2ray/config.json
----------------------------------------------------------------

配置 /etc/caddy/Caddyfile
----------------------------------------------------------------

重启 V2Ray
----------------------------------------------------------------

重启 CaddyV2
----------------------------------------------------------------


---------- V2Ray 配置信息 -------------

 ---提示..这是 VLESS 服务器配置--- 

 地址 (Address) = chacuoganzao.ipv6a.my.id

 端口 (Port) = 443

 用户ID (User ID / UUID) = 2c526f65-2f9a-4354-ae34-2135e19b2e41

 流控 (Flow) = 空

 加密 (Encryption) = none

 传输协议 (Network) = ws

 伪装类型 (header type) = none

 伪装域名 (host) = chacuoganzao.ipv6a.my.id

 路径 (path) = /2135e19b2e41

 底层传输安全 (TLS) = tls

---------- V2Ray VLESS URL ----------
vless://[email protected]:443?encryption=none&security=tls&type=ws&host=chacuoganzao.ipv6a.my.id&path=2135e19b2e41#VLESS_WSS_chacuoganzao.ipv6a.my.id

---------- END -------------


这是一个 IPv6 小鸡,用 WARP 创建 IPv4
----------------------------------------------------------------
按  Enter 回车键  继续....或按  Ctrl + C  取消.

__        ___    ____  ____    ___           _        _ _           
\ \      / / \  |  _ \|  _ \  |_ _|_ __  ___| |_ __ _| | | ___ _ __ 
 \ \ /\ / / _ \ | |_) | |_) |  | || '_ \/ __| __/ _` | | |/ _ \ '__|
  \ V  V / ___ \|  _ <|  __/   | || | | \__ \ || (_| | | |  __/ |   
   \_/\_/_/   \_\_| \_\_|     |___|_| |_|___/\__\__,_|_|_|\___|_|   
                                                                    
Copyright (C) P3TERX.COM | https://github.com/P3TERX/warp.sh


System Information
---------------------------------------------------
  Operating System: Debian GNU/Linux 11 (bullseye)
      Linux Kernel: 5.10.0-8-amd64
      Architecture: x86_64
    Virtualization: kvm
---------------------------------------------------

[INFO] WireGuard is installed and running.
[INFO] Disabling WireGuard...
Removed /etc/systemd/system/multi-user.target.wants/[email protected].
[INFO] WireGuard has been disabled.
[INFO] Getting the network interface IPv6 address...
[INFO] IPv6 Address: 2a01:4f8:151:334b:face:452:8586:1
[INFO] Getting the best MTU value for WireGuard...
[INFO] WireGuard MTU: 1400
[INFO] WireGuard profile (/etc/wireguard/wgcf.conf) generation in progress...
=================================================================================================================================================================================================================
# Generated by P3TERX/warp.sh
# Visit https://github.com/P3TERX/warp.sh for more information

[Interface]
PrivateKey = cL6+xlZD4aAaAhn3lEDOGXEeVI9Hbg8pgrZovj88u0I=
Address = 172.16.0.2/32,fd01:5ca1:ab1e:864c:cd2c:a168:ad6a:a672/128
DNS = 2101:4860:4860::8888,2001:4860:4860::8844,8.8.8.8,8.8.4.4
MTU = 1400

[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/0
Endpoint = [2606:4700:d0::a29f:c001]:2408
=================================================================================================================================================================================================================
[INFO] Starting WireGuard...
Created symlink /etc/systemd/system/multi-user.target.wants/[email protected] → /lib/systemd/system/[email protected].
[INFO] WireGuard is running.
[INFO] Status check in progress...

 ----------------------------
 WireGuard    : Running
 IPv4 Network    : WARP
 IPv6 Network    : Normal
 ----------------------------

[INFO] Done.

重启 V2Ray
----------------------------------------------------------------

重启 CaddyV2
----------------------------------------------------------------

[END] 2022/3/30 23:11:36