🟢Linux clash 使用tun模式

编写配置文件

新建一个 或者修改config.yaml配置文件,那就先说明启用tun模式需要添加的内容

dns:
  enable: true
  listen: 0.0.0.0:54
  enhanced-mode: fake-ip
  nameserver:
    - 1.1.1.1
    - 8.8.8.8

tun:
  enable: true
  stack: system # or gvisor
  dns-hijack:
    - 192.168.100.1:54
  auto-route: true
  auto-detect-interface: true
    

需要保证本地的53端口没有被占用。fallback内的服务器地址是我从互联网上搜索得到可以直连的服务器。服务器地址什么的可以根据自己的需要更改.

在Linux下你需要手动将DNS服务器指定为本地

以Ubuntu为例,修改/etc/systemd/resolved.conf

然后重启服务

最后到 clash 目录运行即可

Last updated