OpenWRT配置Privoxy转SOCKS5为HTTP

很多应用程序不支持SOCKS5代理,只支持HTTP代理,因而需要使用Privoxy将SOCKS5代理转为HTTP代理。

Privoxy是一个跨平台的、带有过滤功能的HTTP代理,为了免去在每台电脑上配置的麻烦,故使其运行在路由器上。

1.安装Privoxy.

opkg install privoxy

如果出现E:开头的报错,先执行

opkg update

2.修改配置文件vim /etc/privoxy/config:

#监听端口
listen-address  192.168.1.1:8080
toggle  0
enable-remote-toggle  0
enable-remote-http-toggle  0
enable-edit-actions 0
enforce-blocks 0
buffer-limit 4096
forwarded-connect-retries  0
accept-intercepted-requests 0
allow-cgi-request-crunching 0
split-large-forms 0
keep-alive-timeout 300
socket-timeout 300
#允许访问的地址段
permit-access  192.168.1.0/24
debug   1    # show each GET/POST/CONNECT request
debug   4096 # Startup banner and warnings
debug   8192 # Errors - *we highly recommended enabling this*
#SOCKS5代理
forward-socks5 / 127.0.0.1:1080 .
#不代理本地
forward         192.168.*.*/     .  
forward         10.*.*.*/        .  
forward         127.*.*.*/       .
#不代理国内网站
forward         .cn              .
forward         .com.cn          .

3.运行

/etc/init.d/privoxy restart

不出意外的话,将HTTP代理设为192.168.1.1:8080就可以使用HTTP代理了.

4.开机自运行

*:若OpenWRT安装了LuCI,可直接登入LuCI-系统-启动项,找到Privoxy,设为"启用"即可.

vim /etc/rc.local,在exit 0以上插入:

/etc/init.d/privoxy start

2条评论

评论已关闭。