查看: 79|回覆: 0

内网环境使用squid访问特定域名

[複製鏈接]

1

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2010-8-4
發表於 2020-6-1 16:59:00 | 顯示全部樓層 |閲讀模式

1 安装

yum install squid -y

2 Squid主要组成部分

服务名:squid
主程序:/usr/sbin/squid
配置目录:/etc/squid
主配置文件:/etc/squid/squid.conf
监听tcp端口号:3128
默认访问日志文件:/var/log/squid/access.log

3 配置内网访问外网特定域名

[root@localhost ~]# cat /etc/squid/squid.conf

acl localnet src 172.172.3.2 # RFC1918 possible internal network #定义ip或ip段 为localnet
acl localnet src 172.18.240.99 # RFC1918 possible internal network #定义ip或ip段 为localnet
acl SSL_ports port 443
acl Safe_ports port 80 # http 添加80端口到Safe_prots 以下同义
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 Safe_ports port 8686 # 美康端口
acl CONNECT method CONNECT

acl allowWeb dstdomain .dingtalk.com# 添加域名到 allowweb
#acl allowweb dstdomain mirrors.aliyun.com
acl allowweb dstdomain .baidu.com
http_access deny !allowWeb # deny allowweb范围以外的域名

http_access deny !Safe_ports #deny safe_ports以外的端口

http_access deny CONNECT !SSL_ports #deny ssl_ports以外的端口
http_access allow localnet #允许localnet 网络内的ip
http_access allow localhost

http_access deny all

# Squid normally listens to port 3128
http_port 33128 #端口

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

#
# Add any of your own refresh_pattern entries above these.
#
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



来源:https://www.cnblogs.com/linuxbai/p/13026101.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部