在服务器上搭了 clash_premium ,并且开启了 TUN 模式,希望服务器上所有的软件都能走代理,但是发现并没有生效,以下是我的代理,配置有问题吗
docker-compose.yml
services: clash: # ghcr.io/dreamacro/clash # ghcr.io/dreamacro/clash-premium # dreamacro/clash # dreamacro/clash-premium image: dreamacro/clash-premium container_name: clash volumes: - ./config.yaml:/root/.config/clash/config.yaml - ./profiles:/root/.config/clash/profiles - ./ui:/ui # dashboard volume ports: - "7890:7890" - "1081:1081" - "9090:9090" # external controller (Restful API) # TUN cap_add: - NET_ADMIN devices: - /dev/net/tun restart: unless-stopped network_mode: "bridge" # or "host" on Linux
config.yaml
port: 7890 socks-port: 1081 allow-lan: true mode: rule log-level: info ipv6: true # external-controller 也可以为 0.0.0.0:9090 # 参考 https://github.com/Dreamacro/clash/wiki/Configuration external-controller: 0.0.0.0:9090 external-ui: /ui tun: enable: true stack: system auto-detect-interface: true ...
![]() | 1 Lemonad3 2023-12-13 12:34:27 +08:00 下面是我瞎说的 vim /etc/profile export http_proxy=“http://ip:port” export https_proxy=“http://ip:port” source /etc/profile |
![]() | 2 YaD2x 2023-12-13 12:40:31 +08:00 没用过 clash 有啥全局代理,他的 tun 模式和全局代理等同吗? 我知道一个有透明代理的几乎可以实现全局代理 |
![]() | 3 Puteulanus 2023-12-13 12:52:10 +08:00 docker 运行的 tun 模式,应该只能创建网卡吧,宿主机还得手动设置一下路由表的默认网关才行? 没用过 clash_premium ,按 VPN 来猜的 |
![]() | 4 4Qd5zQCm26 2023-12-13 13:06:32 +08:00 一楼 那样设置后 # 设置系统代理 cat <<EOL > /etc/profile.d/proxy.sh export http_proxy="http://127.0.0.1:7890" export https_proxy="http://127.0.0.1:7890" export no_proxy="localhost, 127.0.0.1" EOL source /etc/profile Docker 具体容器 在启动的时候,还是要 指定 类似的 proxy |
![]() | 5 ysc3839 2023-12-13 13:27:03 +08:00 via Android 首先 clash 没有外部依赖,没必要用 Docker 。 其次要用 Docker 的话,network_mode 需要设置成 host 。 |
![]() | 6 roding 2023-12-13 14:21:54 +08:00 ![]() V2raya, 全局透明代理,装了都不用配 |
7 zhangyichent 2023-12-13 14:27:25 +08:00 clash 我之前在服务器上也试了一下,不知道咋搞的不管用,我干脆就把 http_proxy 全都指向我的 windows 机器,在 windows 机器开局域网模式。。。省的 linux 上配的太麻烦了。 |
![]() | 8 676529483 2023-12-13 14:49:44 +08:00 走全局的话要改 iptables |
9 Corybyte 2023-12-13 15:10:34 +08:00 proxychains |
10 lijiangang886 2023-12-13 20:27:46 +08:00 这是 clash 装在 docker 里了?那这个 tun 只对 docker 内部生效啊 |
11 EVANGELIONAir 2023-12-13 22:14:22 +08:00 v2raya 全局透明代理,clash 开 tun ,两者都行 |
12 cyp0633 2023-12-14 12:01:38 +08:00 建议 nftables tproxy |