ubuntu借网

能上网机器安装代理软件

apt install squid

修改配置

vim /etc/squid/squid.conf

http_access deny all -> http_access allow all

重启

squid -k shutdown | systemctl restart squid

要上网机器添加代理

proxy () {
export ALL_PROXY="http://127.0.0.1:3128"
export all_proxy="http://127.0.0.1:3128"
echo -e "Acquire::http::Proxy \"http://127.0.0.1:3128\";" | tee -a /etc/apt/apt.conf > /dev/null
echo -e "Acquire::https::Proxy \"http://127.0.0.1:3128\";" | tee -a /etc/apt/apt.conf > /dev/null
curl https://ip.gs
}

noproxy () {
unset ALL_PROXY
unset all_proxy
sudo sed -i -e '/Acquire::http::Proxy/d' /etc/apt/apt.conf
sudo sed -i -e '/Acquire::https::Proxy/d' /etc/apt/apt.conf
curl https://ip.gs
}

posted @ 2021-02-20 20:39  benny1  阅读(63)  评论(0编辑  收藏  举报