V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Ploter
V2EX  ›  问与答

有没有老哥成功使用 magisk-tailscaled 实现 tailscale 和 clash 在安卓上共存的

  •  
  •   Ploter · 13 天前 · 839 次点击

    最近在尝试使用 Tailscale ,使用体验非常美好,但我在墙内又养成了一直挂着 clash 的习惯,所以就出现了一个很痛苦的问题:Tailscale 和 clash 冲突了。

    网上(包括 v2 )看了很多,大多都是说用 tailscale 的 exit node 模式,但我的设备(家里)只有一台 root 的安卓、一台 Ubuntu Server 配 clash-docker ,一台 windows ,我尝试去设置 Ubuntu 为 exit-node ,但照样不能如愿,不知道具体怎么设置。( Ubuntu 是 ping 不通 google 的)

    于是我就想能不能从问题源头安卓手机这下手,还真给我搜到了个 Magisk-Tailscaled,用 KernelSU 安装模块之后,按照步骤,在 Tailscale 管理界面确实能看见设备连接上了,但没办法直接通过类似 http://100.x.y.z:8080 访问其他设备的服务。翻遍项目的 issues ,得知如果要用的话得配置 sock5 代理,然后通过 clash 这种代理软件进行分流。

    问题就出在这了,我配置了之后甚至成功过一次,但重启后就失效了……


    以下是我在手机终端的操作:

    tailscaled -tun=userspace-networking -statedir=/data/adb/tailscale/tmp/ -state=/data/adb/tailscale/tmp/tailscaled.state -socket=/data/adb/tailscale/tmp/tailscaled.sock -port=41641 -socks5-server=localhost:41099
    

    后面这段 -socks5-server=localhost:41099 是我从一篇博客得知的,也即我的 socks5 端口设为 41099 。

    tailscaled.service start
    
    tailscale login
    

    以下是 clash 配置文件:

    dns:
      ...
      nameserver-policy:
      "*.tailscale.io": 8.8.8.8
    proxies:
      - { name: tailscale, type: socks5, server: 127.0.0.1, port: 41099}
      ...
    rules:
      ...
      - 'IP-CIDR,100.64.0.0/10,tailscale,no-resolve'
      - 'DOMAIN-SUFFIX,tailscale.com,DIRECT'
      - 'DOMAIN-SUFFIX,tailscale.io,DIRECT'
    

    按照上面流程下来是成功过一次,但重启之后怎么都成功不了。

    第 1 条附言  ·  12 天前

    按照上面的步骤又来了一遍,发现运行是正常的,只不过每次重启手机之后就得从头打一遍命令,应该是可以写个 shell 脚本简化操作的。 但体验下来,感觉用户层的 tailscale 不太行,原本用官方 APP 能 IPv6 直连的,而用 magisk-tailscaled 只能走中转。 遂放弃使用 magisk-tailscaled,打算尝试常用的 exit-node 模式。

    11 条回复    2024-04-21 13:25:28 +08:00
    shoper
        1
    shoper  
       12 天前   ❤️ 1
    没太明白,OP 都 tailscale 回家了,为啥手机上还要开 clash ?
    Ploter
        2
    Ploter  
    OP
       12 天前 via Android
    @shoper 因为我在墙内_(:з」∠)_
    家里的设备也只是一台 Ubuntu Server ,而不是 openwrt 。
    standin000
        3
    standin000  
       12 天前
    ubuntu 不是更强大,做个代理很方便
    Ploter
        4
    Ploter  
    OP
       12 天前 via Android
    @standin000 能给点关键词我搜搜吗
    我在 .bashrc 设置 http_proxy 没用
    Ploter
        5
    Ploter  
    OP
       12 天前 via Android
    @standin000 你的意思难道是做个 SS 服务器,然后直接通过 clash 回家吗
    ovoo
        6
    ovoo  
       12 天前 via Android   ❤️ 1
    如果自建梯子:
    在梯子上安装 tailscale ,
    clash 配置 100.64.0.0/10 走这个梯子就行了
    ovoo
        7
    ovoo  
       12 天前 via Android
    或者反过来,
    Ubuntu 上安装运行 clash ,以及 tailscale 设置为 exit
    node

    安卓端 use exit node 指定为 ubuntu
    Ploter
        8
    Ploter  
    OP
       12 天前
    @ovoo 刚参照这篇[博客]( https://zhichao.org/posts/c4fc1f)在 ubuntu 上安装 clash 并设置为 tun 透明代理,但 `ping google.com` 时显示如下:
    ```
    krdw@thinkpad:~$ ping google.com
    PING google.com (198.18.0.6) 56(84) bytes of data.
    ^C
    ```
    Puteulanus
        9
    Puteulanus  
       12 天前
    Ubuntu Server 或者 Windows 上能跑虚拟机吗,给个 512M 内存跑个 openwrt ,把 openclash 和 tailscale 都挂上,设成 exit node ,还能给家里的设备当旁路由
    ovoo
        10
    ovoo  
       12 天前 via Android
    @Ploter 这是 fakedns 引起的。把域名添加到 clash 配置文件 fake-ip-filter 里即可
    ovoo
        11
    ovoo  
       12 天前
    @Ploter 如果 clash 里要使用 MagicDNS :

    配置文件添加:
    search-domains: [local, 此处添加你的 Tailnet name: xxxx.ts.net ] # A/AAAA 记录的搜索域
    nameserver-policy:
    "+.ts.net": "100.100.100.100"

    可以实现浏览器里通过主机名访问服务
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   935 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:24 · PVG 07:24 · LAX 16:24 · JFK 19:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.