Skip to content

Linux PAC自动代理

1. 安装genpac

如果没有安装pip,先安装pip sudo apt-get install python-pip pip install genpac

2. 生成配置文件

mkdir ~/shadowsocks
cd shadowsocks
genpac --proxy="SOCKS5 127.0.0.1:1080" --gfwlist-proxy="SOCKS5 127.0.0.1:1080" -o autoproxy.pac --gfwlist-url="https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"
- 其中1080表示代理的端口号

3. 命令行中输入以下命令,查看代理是否正常运行

curl -so /dev/null -w "%{http_code}" google.com -x socks5://127.0.0.1:1080
- socks5表示使用的代理协议,可以换成http等其他协议 - 10080是代理的端口号,对应代理服务的Input端口

4. 配置系统网络Proxy

GUI界面

打开下列路径 [system] settings -> network -> network proxy 选择代理方式为automatic, 配置url填写为

file:///PATH_TO_PAC/autoproxy.pac

  • 按照实际情况填写pac文件的路径

REF

[1]. https://stackoverflow.club/using-pac-in-linux/

[2]. 检测代理是否运行正常