Clash Meta 是 Clash 核心的一个衍生版,具有开源的 Tun 实现、自动处理 TProxy 与调用规则集等额外的功能。
配置文件
DNS 配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| dns: enable: true use-hosts: false ipv6: true enhanced-mode: redir-host fake-ip-range: 198.18.0.1/16 listen: 127.0.0.1:5353 default-nameserver: - 119.29.29.29 - 114.114.114.114 nameserver: - https://doh.pub/dns-query - tls://223.5.5.5:853 fallback: - 'https://1.0.0.1/dns-query' - 'tls://8.8.4.4:853' fallback-filter: geoip: false geosite: - gfw - google - github - youtube domain: - +.google.com - +.youtube.com - +.twitter.com - +.github.com ipcidr: - 0.0.0.0/32
|
Tun 配置
1 2 3 4 5 6
| tun: enable: true stack: gvisor dns-hijack: - 0.0.0.0:53 auto-route: true
|
其它配置
1 2 3 4 5 6
| mixed-port: 7890 allow-lan: true mode: Rule log-level: info external-controller: :9090 external-ui: /usr/local/share/clash/
|
服务文件
WinSW
1 2 3 4 5 6 7 8 9 10 11
| <service> <id>org.clash.meta</id> <name>Clash Meta</name> <description>Clash Meta, yet another Clash Core.</description> <executable>D:\Apps\ClashMeta\clash.exe</executable> <arguments>-d D:\Apps\ClashMeta\</arguments> <log mode="roll"></log> <delayedAutoStart>true</delayedAutoStart> <onfailure action="restart" delay="10 sec"/> <onfailure action="restart" delay="20 sec"/> </service>
|
Systemd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| [Unit] Description=Clash-Meta, another Clash core, Tun Service. After=network.target NetworkManager.service systemd-networkd.service iwd.service
[Service] Type=exec LimitNPROC=500 LimitNOFILE=1000000 Restart=always ExecStartPre=/bin/sleep 5 ExecStartPre=/bin/bash -c "cat /etc/resolv.conf > /etc/rs-back.conf" ExecStartPre=/bin/bash -c "echo 'nameserver 198.18.0.2' > /etc/resolv.conf" ExecStart=/usr/local/bin/clash -d /usr/local/etc/clash/ ExecStopPost=/bin/bash -c "cat /etc/rs-back.conf > /etc/resolv.conf" [Install] WantedBy=multi-user.target
|
如果使用 Network Manager,那么需要配置 dns=none,这样 /etc/resolv.conf 就不会被修改,从而能保证 DNS 请求都会发给 Clash Meta。