服务端配置
- 安装squid
# 安装
sudo apt-get install squid
- 放行网络
# 修改规则,放行网络,注意要是管理员权限
nano /etc/squid/squid.conf
# 找到 acl localnet 内容如下,仿造写自己要放行的网络就行,对于私有网段已经预设过了,可以不作处理
acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)
acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)
acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)
acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines
acl localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)
acl localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
- 启动、停止命令(命令好像会卡住,不知道为啥,可以多等一阵)
# 查看状态
systemctl status squid
# 启动
systemctl start squid
# 启动
systemctl stop squid
# 开启自启动,安装完成后默认开机自启动,不用调整
systemctl enable squid
客户端配置
# 当前终端有效,关闭后效果消失
export http_proxy=http://IP地址:端口(默认3128)