Server A can access the Internet, but server B cannot. I want server B to use A to access the Internet.
1. A server configuration
1. Install squid
# yum install squid.x86_64
2. Configure squid
# # 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 10.0 . 0.0 / 8 # RFC1918 possible internal network #Define source 10.0.0.0/8 The name of this network segment is loaclnet 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 # Define the name of port 443 as SSL_ports acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher 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
# # Recommended minimum Access Permission configuration: Recommended minimum permission configuration # # Deny requests to certain unsafe ports is not a port in the Safe_ports group All access is prohibited http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports are not allowed connections to ports in the SSL_ports group
http_access deny CONNECT !SSL_ports
# Only allow cachemgr access from localhost allows both groups localhost manager to access
http_access allow localhost manager
http_access deny manager does not allow access from manager group
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
Add your rules here, which clients are allowed to use the proxy as follows
acl localhost src 10.11.0.31
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
# Squid normally listens to port 3128 service listens to port
http_port 3128
# Uncomment and adjust the following to add a disk cache directory .
#cache_dir ufs /var/spool/squid 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid
#
# Add any of your own refresh_pattern entries above these. 添加您自己的refresh_pattern条目
#
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
2. B server settings
Temporarily modify environment variables, restart fails
#export PROXY=http: //A server ip :80/
export http_proxy="http://210.45.72.XX:808"
permanent
# vi /etc/ profile Add the following
ftp_proxy =A's ip:3128
http_proxy =A's ip:3128
https_proxy =A's ip:3128
no_proxy =www.baidu.com #Baidu does not go to proxy
export ftp_proxy
export http_proxy
export https_proxy
export no_proxy
#source /etc/profile 生效