LoginSignup
2
4

More than 3 years have passed since last update.

多段プロキシ構成のSquid

Posted at

前置き

Squidを使って多段プロキシ環境を構築したので。Configの作り方をすごくざっくりメモ。

Network構成

まず、イントラネット(ローカルNW)には、インターネットに出るためのプロキシがあります。
イントラネットの中にはさらにローカルNWのラボ環境があり、今回はこのラボ環境にSquidを新設してイントラネットの親プロキシと連携し、ネットワークA、Bからインターネットに出られるようにしましょう、という計画です。(ながい)

インターネット
└── イントラネット
    ├── 親プロキシ  (172.10.10.10:8080)
    └── ラボ環境
        ├── Squidサーバー
        ├── ネットワークA  (10.x.x.x)
        └── ネットワークB  (192.168.x.x)

できたConfig

不要な設定がある可能性があるので、自身の環境に構築する場合は十分確認してください。
わかりづらくなりまずが、長いのでコメントアウトされた説明行は消しました。
各パラメータについてはSquidの公式からリファレンスが参照できます。

squid.conf

acl localnet src 10.x.x.x/8 # ネットワークA
acl localnet src 192.168.x.x/16 # ネットワークB
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 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

acl SSL_ports port 443
acl SSL method CONNECT
acl CONNECT method CONNECT
http_access deny CONNECT !SSL_ports

http_access allow localhost manager
http_access deny manager

http_access allow localnet
http_access allow localhost

http_access deny all

http_port 3128

coredump_dir /var/cache/squid

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

dns_nameservers <イントラネットにあるDNSを設定した>

never_direct allow all
cache_peer 172.10.10.10 parent 8080 7 no-query

visible_hostname squidForward

pid_filename /var/run/${service_name}.pid
logformat squid %tl %6tr %>a %Ss/%03>Hs %<st %rm %ru %un %Sh/%<A %mt

query_icmp on

これでネットワークA、Bのサーバー達がインターネットにアクセスしてyum install等できるようになりました。めでたし

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4