在 B 上运行 ss-server: ss-server -p B 的监听端口 -k B 的密码 -m B 的加密方式 -t 600 -u
在 A 上运行 ss-redir: ss-redir -s B 的 IP -p B 的端口 -l A 的监听端口 -k B 的密码-m B 的加密方式 -t 600 -u
剩下的其实和在 openwrt 上做的类似 在 A 上用 ipset 创建 google ip 的 set: ipset create google hash:net ipset add google 8.34.208.0/21 ipset add google 8.34.216.0/21 ipset add google 8.35.192.0/21 ipset add google 8.35.200.0/21 ipset add google 23.236.48.0/20 ipset add google 23.251.128.0/19 ipset add google 35.184.0.0/13 ipset add google 64.233.160.0/19 ipset add google 64.233.160.0/24 ipset add google 64.233.161.0/24 ipset add google 64.233.162.0/24 ipset add google 64.233.163.0/24 ipset add google 64.233.164.0/24 ipset add google 64.233.165.0/24 ipset add google 64.233.166.0/24 ipset add google 64.233.167.0/24 ipset add google 64.233.168.0/24 ipset add google 64.233.169.0/24 ipset add google 64.233.171.0/24 ipset add google 64.233.176.0/24 ipset add google 64.233.177.0/24 ipset add google 64.233.178.0/24 ipset add google 64.233.179.0/24 ipset add google 64.233.180.0/24 ipset add google 64.233.181.0/24 ipset add google 64.233.182.0/24 ipset add google 64.233.183.0/24 ipset add google 64.233.184.0/24 ipset add google 64.233.185.0/24 ipset add google 64.233.186.0/24 ipset add google 64.233.187.0/24 ipset add google 64.233.188.0/24 ipset add google 64.233.189.0/24 ipset add google 64.233.190.0/24 ipset add google 64.233.191.0/24 ipset add google 66.102.0.0/20 ipset add google 66.102.1.0/24 ipset add google 66.102.2.0/24 ipset add google 66.102.3.0/24 ipset add google 66.102.4.0/24 ipset add google 66.102.12.0/24 ipset add google 66.249.64.0/19 ipset add google 66.249.68.0/24 ipset add google 66.249.72.0/24 ipset add google 70.32.128.0/19 ipset add google 70.32.131.0/24 ipset add google 70.32.132.0/23 ipset add google 70.32.145.0/24 ipset add google 70.32.146.0/23 ipset add google 70.32.151.0/24 ipset add google 72.14.192.0/18 ipset add google 74.114.24.0/21 ipset add google 74.125.0.0/16 ipset add google 104.132.0.0/23 ipset add google 104.132.5.0/24 ipset add google 104.132.7.0/24 ipset add google 104.132.8.0/24 ipset add google 104.132.11.0/24 ipset add google 104.132.34.0/24 ipset add google 104.132.51.0/24 ipset add google 104.132.141.0/24 ipset add google 104.133.0.0/24 ipset add google 104.133.2.0/23 ipset add google 104.154.0.0/15 ipset add google 104.196.0.0/14 ipset add google 107.167.160.0/19 ipset add google 107.178.192.0/18 ipset add google 108.59.80.0/20 ipset add google 108.170.192.0/18 ipset add google 108.177.0.0/17 ipset add google 108.177.2.0/24 ipset add google 108.177.4.0/23 ipset add google 108.177.7.0/24 ipset add google 108.177.8.0/24 ipset add google 108.177.9.0/24 ipset add google 108.177.10.0/24 ipset add google 108.177.11.0/24 ipset add google 108.177.12.0/24 ipset add google 108.177.14.0/24 ipset add google 108.177.15.0/24 ipset add google 108.177.18.0/23 ipset add google 108.177.96.0/24 ipset add google 108.177.97.0/24 ipset add google 108.177.98.0/24 ipset add google 130.211.0.0/16 ipset add google 142.250.0.0/15 ipset add google 146.148.0.0/17 ipset add google 162.216.148.0/22 ipset add google 162.222.176.0/21 ipset add google 172.102.8.0/21 ipset add google 172.102.8.0/24 ipset add google 172.102.9.0/24 ipset add google 172.102.10.0/24 ipset add google 172.102.11.0/24 ipset add google 172.102.12.0/23 ipset add google 172.102.14.0/23 ipset add google 172.110.32.0/21 ipset add google 172.217.0.0/16 ipset add google 172.253.0.0/16 ipset add google 173.194.0.0/16 ipset add google 173.255.112.0/20 ipset add google 185.150.148.0/22 ipset add google 192.104.160.0/23 ipset add google 192.158.28.0/22 ipset add google 192.178.0.0/15 ipset add google 193.200.222.0/24 ipset add google 199.192.112.0/22 ipset add google 199.223.232.0/21 ipset add google 207.223.160.0/20 ipset add google 208.68.108.0/22 ipset add google 209.85.128.0/17 ipset add google 209.85.144.0/24 ipset add google 209.85.145.0/24 ipset add google 209.85.147.0/24 ipset add google 209.85.200.0/24 ipset add google 209.85.201.0/24 ipset add google 209.85.202.0/24 ipset add google 209.85.203.0/24 ipset add google 209.85.232.0/24 ipset add google 209.85.233.0/24 ipset add google 209.85.234.0/24 ipset add google 209.85.235.0/24 ipset add google 209.107.176.0/20 ipset add google 209.107.176.0/23 ipset add google 209.107.182.0/23 ipset add google 216.58.192.0/19 ipset add google 216.58.200.0/24 ipset add google 216.58.208.0/24 ipset add google 216.58.209.0/24 ipset add google 216.58.210.0/24 ipset add google 216.58.211.0/24 ipset add google 216.58.212.0/24 ipset add google 216.58.213.0/24 ipset add google 216.58.214.0/24 ipset add google 216.58.215.0/24 ipset add google 216.58.216.0/24 ipset add google 216.58.217.0/24 ipset add google 216.58.218.0/24 ipset add google 216.58.219.0/24 ipset add google 216.58.220.0/24 ipset add google 216.58.221.0/24 ipset add google 216.58.222.0/24 ipset add google 216.58.223.0/24 ipset add google 216.73.80.0/20 ipset add google 216.239.32.0/19 ipset add google 216.239.32.0/24 ipset add google 216.239.33.0/24 ipset add google 216.239.34.0/24 ipset add google 216.239.35.0/24 ipset add google 216.239.36.0/24 ipset add google 216.239.38.0/24 ipset add google 216.239.39.0/24 ipset add google 216.252.220.0/22 ipset add google 216.252.220.0/24 ipset add google 216.252.221.0/24 ipset add google 216.252.222.0/24
A 上添加 iptables iptables -t nat -A OUTPUT -m set --match-set google dst -p tcp -j REDIRECT --to-port A 的 ss-redir 监听端口
缺陷: 如果 A 和 B 距离较远的话(比如 B 是美国 vps ),那么由于 DNS 用的是 A 解析出来的,一般是香港、台湾 Google ,通过 B 访问要绕一圈回来 不过看 Youtube 则不会绕回来,因为 Youtube 是 Http 方式分配 server ,一般会分到距离 B 较近的