Skip to content

Instantly share code, notes, and snippets.

@codexss
Last active May 14, 2023 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codexss/942c3ba65bf4d960e8c909e3be23a932 to your computer and use it in GitHub Desktop.
Save codexss/942c3ba65bf4d960e8c909e3be23a932 to your computer and use it in GitHub Desktop.
Google Home Mini for use in China / 在中国使用Google Home Mini

目前整理的配置文件如下,已做最简化配置,如有问题请留言。
如果有需要主路由的规则配的话回头我再整理一下。

使用到的第三方软件:
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment