0、思路

1、尝试 x-ui 面板配置,实际只能走 ipv4(warp),无 ipv6
2、尝试 xrayL(不良林提供 xray 脚本)配置,实际只能走直连,无 ipv4

将两个服务同时开启,监听不同端口,则可以实现不同端口分流

1、安装 warp 和 proxychains4

apt update && apt install -y curl gnupg lsb-release proxychains4
 
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg |  gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg
 
echo "deb [arch=amd64 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 -y cloudflare-warp
 
 
# 注册设备和修改设置
warp-cli register # 看提示输入Y
warp-cli set-mode proxy
warp-cli set-proxy-port 1835 # 可以自己改本地监听端口
warp-cli connect
 
# 手!动!修!改!
nano /etc/proxychains4.conf
最后一行 socks4 开头的内容改成
socks5 127.0.0.1 1835 # 上面那个端口

2、x-ui 安装

wget https://github.com/vaxilu/x-ui/releases/download/0.3.2/x-ui-linux-amd64.tar.gz
rm x-ui/ /usr/local/x-ui/ /usr/bin/x-ui -rf
tar zxvf x-ui-linux-amd64.tar.gz
chmod +x x-ui/x-ui x-ui/bin/xray-linux-* x-ui/x-ui.sh
cp x-ui/x-ui.sh /usr/bin/x-ui
cp -f x-ui/x-ui.service /etc/systemd/system/
mv x-ui/ /usr/local/
systemctl daemon-reload
systemctl enable x-ui
systemctl restart x-ui

3、x-ui 配置

进入面板 [ipv6]:54321 -> 面板设置 -> xray 相关设置 ->

{
  "api": {
    "services": [
      "HandlerService",
      "LoggerService",
      "StatsService"
    ],
    "tag": "api"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 62789,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1"
      },
      "tag": "api"
    }
  ],
  "outbounds": [
    {
      "tag": "outbound-warp",
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 1835
          }
        ]
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom"
    },
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "policy": {
    "system": {
      "statsInboundDownlink": true,
      "statsInboundUplink": true
    }
  },
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": [ "0.0.0.0/0" ],
        "outboundTag": "outbound-warp"
      },
      {
        "type": "field",
        "ip": [ "::/0" ],
        "outboundTag": "direct"
      },
      {
        "inboundTag": [
          "api"
        ],
        "outboundTag": "api",
        "type": "field"
      },
      {
        "ip": [
          "geoip:private"
        ],
        "outboundTag": "blocked",
        "type": "field"
      },
      {
        "outboundTag": "blocked",
        "protocol": [
          "bittorrent"
        ],
        "type": "field"
      }
    ]
  },
  "stats": {}
}

4、 xrayL 安装

proxychains4 bash <(curl -fsSLk https://raw.githubusercontent.com/bulianglin/demo/main/xrayL.sh) vmess
# 配置socks5代理 
bash <(curl -fsSLk https://raw.githubusercontent.com/bulianglin/demo/main/xrayL.sh) socks 

5、 xrayL 配置

nano /etc/xrayL/config.toml

[[inbounds]]
port = 20000
protocol = "vmess"
tag = "tag_0"
[inbounds.settings]
[[inbounds.settings.clients]]
id = "cec97416-12a4-4bc0-b1cd-92006383b123"
[inbounds.streamSettings]
network = "ws"
[inbounds.streamSettings.wsSettings]
path = "/wap"
 
[[outbonds]]
sendThrough = "127.0.0.1"
tag = "warp"
protocol = "socks"
 
[outbonds.settings]
[[outbonds.settings.servers]]
address = "127.0.0.1"
port = 1835
 
[[outbounds]]
sendThrough = "2400:8123:112:1::123"
protocol = "freedom"
tag = "direct"
 
[routing]
[[routing.rules]]
type = "field"
ip = [ "0.0.0.0/0" ]
inboundTag = "tag_0"
outboundTag = "warp"
 
[[routing.rules]]
type = "field"
ip = [ "::/0" ]
inboundTag = "tag_0"
outboundTag = "direct"
 
 
 
[[inbounds]]
port = 20001
protocol = "vmess"
tag = "tag_1"
[inbounds.settings]
[[inbounds.settings.clients]]
id = "cec97416-12a4-4bc0-b1cd-92006383b123"
[inbounds.streamSettings]
network = "ws"
[inbounds.streamSettings.wsSettings]
path = "/wap6"
 
[[outbounds]]
sendThrough = "2400:8a20:112:1::305"
protocol = "freedom"
tag = "tag_1"
 
[[routing.rules]]
type = "field"
inboundTag = "tag_1"
outboundTag = "tag_1"

6、效果

在 x-ui 中添加一个入站,添加节点,即可通过 warp

根据 xrayL 的配置,手动添加节点,即可通过直连 ipv6 访问