目前整理的配置文件如下,已做最简化配置,如有问题请留言。
如果有需要主路由的规则配的话回头我再整理一下。
使用到的第三方软件:
CLASH: https://github.com/Dreamacro/clash
目前整理的配置文件如下,已做最简化配置,如有问题请留言。
如果有需要主路由的规则配的话回头我再整理一下。
使用到的第三方软件:
CLASH: https://github.com/Dreamacro/clash
#软路由上的Clash配置文件 | |
redir-port: 7892 | |
allow-lan: true | |
#external-controller: :9090 #可选,webapi管理端口 | |
log-level: info | |
mode: rule | |
#ipv6: true #可选,根据网络环境决定是否启用 | |
dns: | |
enable: true | |
listen: :5353 | |
nameserver: | |
- dhcp://eth0 #将此处eth0修改为你主/软路由的网卡名称 | |
enhanced-mode: fake-ip | |
fake-ip-filter: | |
- '*' | |
- '*.lan' | |
hosts: | |
time.google.com: 203.107.6.88 #ntp.aliyun.com 目前CLASH版本hosts仅支持对应IP | |
proxies: #以下修改为你的代理配置,上面的配置不要改 | |
- name: PROXY | |
type: ss | |
server: example.com | |
port: 443 | |
cipher: chacha20-ietf-poly1305 | |
password: password | |
rules: | |
- MATCH,PROXY |
#主路由dnsmasq的配置文件,第一行为指定MAC分配对应IP,第二行第三行分别为分配指定网关和DNS | |
dhcp-host=AA:BB:CC:DD:EE:FF,set:box,192.168.0.250,Google-Home-Mini | |
dhcp-option=tag:box,3,192.168.0.254 | |
dhcp-option=tag:box,6,192.168.0.254 | |
#禁止给google home mini分配ipv6地址 | |
#ip6tables -t mangle -I PREROUTING -m mac --mac-source aa:bb:cc:dd:ee:ff -j DROP |
#旁路由iptables所需要的规则 | |
#将其中192.168.0.250更换为你Google Home的设备IP | |
iptables -t nat -A PREROUTING -s 192.168.0.250/32 ! -d 192.168.0.0/16 -p tcp -j REDIRECT --to-ports 7892 | |
iptables -t nat -A PREROUTING -s 192.168.0.250/32 -p udp --dport 53 -j REDIRECT --to-ports 5353 | |
iptables -t nat -A PREROUTING -s 192.168.0.250/32 -p udp --dport 123 -j DNAT --to-destination 203.107.6.88 #ntp.aliyun.com | |
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE |