1. 程式人生 > >內網服務器通過Squid代理訪問外網

內網服務器通過Squid代理訪問外網

-c etc mach rmi port 圖片 ins machine determine

環境說明

  項目整體需部署Zabbix監控並配置微信報警,而Zabbix Server並不能訪問外網,故運維小哥找了臺能訪問外網的服務器做Suqid代理,Zabbix Server服務器通過代理服務器訪問外網。

操作說明

技術分享圖片

[root@squid ~]# echo "1" >/proc/sys/net/ipv4/ip_forward

[root@squid ~]# yum -y install squid

[root@squid ~]# vim /etc/squid/squid.conf

# 配置文件中將deny修改為allow;

技術分享圖片

# 配置本地ip;

技術分享圖片

[root@squid ~]# systemctl start squid

[root@squid ~]# systemctl enable squid

技術分享圖片

[root@zabbix-server ~]# tail -2 /etc/profile

export http_proxy=http://192.168.10.15:3128
export https_proxy=http://192.168.10.15:3128

技術分享圖片

[root@zabbix-server ~]# curl http://www.baidu.com

[root@zabbix-server ~]# curl https://www.baidu.com

技術分享圖片

技術分享圖片

Could not determine this machines public hostname
. Please configure one or set visible_hostname

技術分享圖片

在配置文件/etc/squid/squid.conf中添加如下行,重啟即可;

visible_hostname squid.packet-pushers.net

內網服務器通過Squid代理訪問外網