背景:有几台华为云节点,只有一个节点可以访问互联网,其他节点无法访问互联网,这给安装软件带来不便(因为我们常常使用yum安装软件,但是这个需要联网才行)
1 配置代理服务器
安装代理软件squid
yum install squid
配置
vi /etc/squid/squid.conf
# 主要是标红的那些配置,其他配置保持默认即可 # Recommended minimum configuration: # # Example rule allowing access from your local networks. # Adapt to list your (internal) IP networks from where browsing # should be allowed acl localnet src xxx.xxx.xxx.xxx/xx # RFC1918 possible internal network 这里是允许访问的客户端网络地址 # acl localnet src 172.16.0.0/12 # RFC1918 possible internal network # acl localnet src 192.168.0.0/16 # RFC1918 possible internal network # acl localnet src fc00::/7 # RFC 4193 local private network range # acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines acl SSL_ports port 443 acl Safe_ports port 80 # http # acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https # acl Safe_ports port 210 # wais # acl Safe_ports port 1025-65535 # unregistered ports # acl Safe_ports port 280 # http-mgmt # acl Safe_ports port 488 # gss-http #acl Safe_ports port 591 # filemaker #acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT
启动服务
systemctl start squid
2 配置客户端
vi ~/.bashrc
添加如下配置
export http_proxy=http://10.xxx.xxx.76:3128 export https_proxy=https://10.xxx.xxx.76:3128
生效
source ~/.bashrc
3 试一试
我们使用yum安装软件试试,如下图,可以上网了
标签:xxx,http,Safe,网络,acl,port,linux,代理,ports From: https://www.cnblogs.com/zhenjingcool/p/18655385