-
-
Save we11adam/5590703 to your computer and use it in GitHub Desktop.
Revisions
-
messense created this gist
May 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ ## 配置 shadowsocks 架设好 shadowsocks 服务端,在路由器上安装 shadowsocks 客户端,并配置 config.json ,假设本地监听端口为 1080 。启动 shadowsocks ```/etc/init.d/shadowsocks start``` ## 配置 privoxy 安装 privoxy openwrt 版。 ```opkg install privoxy``` 修改 `/etc/privoxy/config` ,假设监听端口为默认的 8118 。修改 listen-address 为 0.0.0.0:8118,其它默认,在文件结尾添加如下配置 ``` forward-socks5 / 127.0.0.1:1080 . forward 192.168.*.*/ . forward 10.*.*.*/ . forward 127.*.*.*/ . forward localhost/ . ``` 意思是将请求转发给我们用 shadowsocks 开启的 socks5 代理,后面的规则让本地和局域网不经过代理直连。 至于 privoxy 的 *.action 和 *.filters 配置这里就不做了,因为后面我们用 PAC 做自动代理。启动 privoxy ```/etc/init.d/privoxy start``` ## 自动分发 PAC 文件 生成 PAC 文件,这里我直接下载了曲径的 pac 文件修改了代理地址为路由器上的地址,即 192.168.1.1:8118 ,保存为 proxy.pac 并 scp 到路由器上。我的路由装了 luci 所以我就直接把 proxy.pac 放到 `/www` 目录中,这样 PAC 的地址就是 http://192.168.1.1/proxy.pac 这里利用 WPAD 协议自动分发 PAC。修改 `/etc/config/dhcp` 在 `config dnsmasq` 选项下面增加配置 ```list dhcp_option '252,http://192.168.1.1/proxy.pac'``` 保存,重启 dnsmasq。 `/etc/init.d/dnsmasq restart` ## 设备配置 * OS X - Network Preferences 里面配置 Proxies 为 Auto Proxy Discovery * Windows - Internet Explorer 连接、局域网设置为自动检测代理 * iOS - 热点代理设置为自动,地址留空 * Android/Windows Phone - 手动填写 http 代理地址吧。。。 感觉 Apple 的 iOS/OS X 系统这些细节做的非常好,真是方便。