安装配置squid
yum install squid
mv /etc/squid/squid.conf /etc/squid/squid.conf.1
#添加配置,详见配置详情
vim /etc/squid/squid.conf
systemctl start squid
删除iptables
#清空下边文件
/etc/sysconfig/iptables
#重启iptables
systemctl restart iptables
测试是否生效
#在as_crawler1服务其中测试
#修改代理,执行看返回是否为代理的外网ip。
curl -x http://192.144.156.212:8889 --connect-timeout 3 -m 5 http://121.40.43.194/get_ip/ip.php
配置详情
下边内容只需要将内网ip改为自己账号下内网ip。其他都不需要改
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 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
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localhost
acl ascrawler1 src 101.37.64.0/24
http_access allow ascrawler1
acl asbigdata2 src 101.37.157.0/24
http_access allow asbigdata2
acl ip1 myip 192.168.2.9
acl ip2 myip 192.168.2.10
acl ip3 myip 192.168.2.11
acl ip4 myip 192.168.2.12
acl ip5 myip 192.168.2.13
acl ip6 myip 192.168.2.14
acl ip7 myip 192.168.2.15
acl ip8 myip 192.168.2.16
acl ip9 myip 192.168.2.17
acl ip10 myip 192.168.2.18
acl ip11 myip 192.168.2.19
acl ip12 myip 192.168.2.20
acl ip13 myip 192.168.2.21
acl ip14 myip 192.168.2.22
acl ip15 myip 192.168.2.23
acl ip16 myip 192.168.2.24
acl ip17 myip 192.168.2.25
acl ip18 myip 192.168.2.26
tcp_outgoing_address 192.168.2.9 ip1
tcp_outgoing_address 192.168.2.10 ip2
tcp_outgoing_address 192.168.2.11 ip3
tcp_outgoing_address 192.168.2.12 ip4
tcp_outgoing_address 192.168.2.13 ip5
tcp_outgoing_address 192.168.2.14 ip6
tcp_outgoing_address 192.168.2.15 ip7
tcp_outgoing_address 192.168.2.16 ip8
tcp_outgoing_address 192.168.2.17 ip9
tcp_outgoing_address 192.168.2.18 ip10
tcp_outgoing_address 192.168.2.19 ip11
tcp_outgoing_address 192.168.2.20 ip12
tcp_outgoing_address 192.168.2.21 ip13
tcp_outgoing_address 192.168.2.22 ip14
tcp_outgoing_address 192.168.2.23 ip15
tcp_outgoing_address 192.168.2.24 ip16
tcp_outgoing_address 192.168.2.25 ip17
tcp_outgoing_address 192.168.2.26 ip18
# And finally deny all other access to this proxy
http_access deny all
http_port 8889
coredump_dir /var/spool/squid3
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880
# example lin deb packages
#refresh_pattern (\.deb|\.udeb)$ 129600 100% 129600
refresh_pattern . 0 20% 4320
via off
dns_v4_first on
forwarded_for delete