树莓派做路由器 2018.03 (Part 3) Google 硬件(Home/Wear/Chromecast...)上网配置

前言:写于 2018.03,分成三篇blog,介绍为了在家里使用 Google Home Mini 而进行的一系列努力;
本文为第三部分,进阶路由配置,github 官方页面上相应的 iptables 配置已经介绍的很全面了;本文只描述几个特定的坑
第一部分: 树莓派做路由器 2018.03 (Part 1) 最基础的Hotspot配置知识
第二部分: 树莓派做路由器 2018.03 (Part 2) hostapd 和 RTL8188CUS 网卡,如何在 Raspbian Stretch/Kernel 4.9.x 下工作?

从源码编译 https://github.com/shadowsocks/shadowsocks-libev#linux 和 https://github.com/shadowsocks/simple-obfs 非常简单,毕竟树莓派系统是一个很完整的 Debian Stretch 变种,首先安装依赖的包,然后从源码 clone 下来按说明编译和配置即可

  • sudo apt install --no-install-recommends gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev
  • 。。。略去官网里的步骤

因为这个树莓派目的很简单,只是为了服务 Google Home Mini,不需要复杂的国内国际流量区分,所有流量统统全局路由出去;为了避免投毒只是简单的自己搭了一个 DNS 转发,然后在 dnsmasq 里把 第一部分所描述的 "dhcp-option=option:dns-server,114.114.114.114" 改成自己的 IP 即可

  • ss-tunnel -c /etc/shadowsocks-libev/crown2.json -b 192.168.x.1 -l 53 -L 8.8.8.8:53 -u -f /var/run/ss-tunnel.pid
  • 如果是在 rc.local 里启动 ss-tunnel 可能出现启动不了的情况。参考 https://www.v2ex.com/t/348171 加上 "sleep 15 && " 解决问题

但是后来发现这样做是不够的,因为 Google 的硬件不理会 DHCP 的 DNS-Server 配置,固执的使用自己的 DNS Server 进行解析

  • 参考 https://github.com/qiwihui/hiwifi-ss/issues/106 和 https://gist.github.com/willwhui/28e8896b6e4560f1cf0d32a5acf501f3 搞定
  • Google Home Mini 联网之后,我的 LG Watch Style 现在也正常通过该路由器连上 Play 并更新到 8.0 了!!

附录:在解决问题中发现的其它可能有帮助的链接

  • https://github.com/shadowsocks/shadowsocks-libev/issues/1252
  • http://blog.csdn.net/lvshaorong/article/details/53203674 【推荐】
Topic: 
技术

你可能感兴趣的:(树莓派,路由器,part)