请注意,本文编写于 1386 天前,最后修改于 807 天前,其中某些信息可能已经过时。
在Linux环境下,由于偶尔需要从github下载一些源码来学习,但是国内访问github非常不稳定,因此不得不借助代理来访问,我的树莓派3B+装的是raspbian lite os,很多自己写着玩的一些自动化任务脚本在上面运行。所以平时是不会让它全局科学上网的,当偶尔需要访问github或google时,我使用了proxychains4和内网N1盒子做的OpenWRT旁路由来实现。
1、安装proxychains4(以Raspberry pi raspbian os 为例)
sudo apt install proxychains4
2、安装完成后,修改/etc/proxychains4.conf中代理服务器配置,例如,我内网旁路由网关为192.168.50.2,已有科学上网环境,直接将代理服务器配置段ProxyList部分添加旁路由的服务地址与端口。
[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
socks4 192.168.50.2 1080
3、使用proxychains4 代理访问之前无法访问的站点:
pi@raspberrypi:~ $ proxychains4 curl https://www.google.com
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/aarch64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain ... 192.168.50.2:1080 ... www.google.com:443 ... OK
4、如果觉得命令太长,可以考虑使用alias命令为proxychains4取个别名,我是在/etc/bash.bashrc最后插入如下命令
alias pc='proxychains4'
参考资料:
https://monkeywie.cn/2020/07/06/linux-global-proxy-tool-proxychain/