参考にしたのはここ
FreeBSD 5.4 で squid
Squid を透過型 HTTP Proxy としてインストールする
FreeBSD で ipfw のみで squid を 透過型 web proxy にする方法
目標は透過型です。
まずはいつものようにports を利用します。
ports を最新にします。
[svr-root]::csup -g -L 2 /usr/share/examples/cvsup/ports-supfile
[svr-root]::cd /usr/ports/www/squid
[svr-root]::make install
デフォルトでインストールします。
[X] SQUID_WCCP Enable Web Cache Coordination Protocol
[X] SQUID_UNDERSCORES Allow underscores in hostnames
[X] SQUID_CHECK_HOSTNAME Do hostname checking
squid-2.6.STABLE12.tar.bz2 が インストールされるようです。
o You can find the configuration files for this package in the
directory /usr/local/etc/squid.
o A cache directory has been created in /usr/local/squid/cache.
Log files will be written to /usr/local/squid/logs.
Note:
You must initialize new cache directories before you can start
squid. Do this by running "squid -z" as 'root' or 'squid'.
If your cache directories are already initialized (e.g. after an
upgrade of squid) you do not need to initialize them again.
o The default configuration will deny everyone access to the
proxy service. Edit the "http_access" directives in
/usr/local/etc/squid/squid.conf to suit your needs.
Please note that the Squid start script is an rc.d style script.
This means that Squid will not start automatically at boot
time unless it is explicitly enabled.
To enable Squid, set squid_enable=yes in either
/etc/rc.conf, /etc/rc.conf.local or /etc/rc.conf.d/squid
Please see /usr/local/etc/rc.d/squid(.sh) for further details.
Note:
If you just updated your Squid installation from 2.5 or earlier,
make sure to check your Squid configuration against the 2.6 default
configuration file /usr/local/etc/squid/squid.conf.default.
Additionally, you should check your configuration by calling
'squid -f /path/to/squid.conf -k parse' before starting Squid.
===> Installing rc.d startup script(s)
===> Compressing manual pages for squid-2.6.12
===> Registering installation for squid-2.6.12
===> SECURITY REPORT:
This port has installed the following files, which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/squid
This port has installed the following startup scripts, which may cause
these network services to be started at boot time.
/usr/local/etc/rc.d/squid.sh
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://www.squid-cache.org/
swap ディレクトリを作成する。
[svr-root]::squid -z
設定ファイルを編集する。
[svr-root]::vi /usr/local/etc/squid/squid.conf
変更箇所は以下のとおり
maximum_object_size 32 MB
acl localsubnet src 192.168.1.0/255.255.255.0
http_access allow localsubnet
http_access allow localhost
http_port 192.168.1.15:3128 transparent
ここで透過型にするにはIPFW機能を使用しなければならないようなので、カーネルの再構築をすることにします。
[svr-root]::cd /usr/src/sys/i386/conf/
[svr-root]::cp GENERIC MYKERNEL_20070421
[svr-root]::vi MYKERNEL_20070421
カーネルに
options IPFIREWALL # Add on 2007 04 21
options IPFIREWALL_VERBOSE # Add on 2007 04 21
を追加
[svr-root]::/usr/sbin/config MYKERNEL_20070421
Kernel build directory is ../compile/MYKERNEL_20070421
[svr-root]::make depend
[svr-root]::make
[svr-root]::make install
カーネルが起動しない
新しいカーネルが起動しなかった場合は、システムが 10 からカウントダウンしている時に、 Enter キー以外の任意のキーを押して、 unload と入力してから、 boot kernel.old か他の正常に起動するカーネルを入力してください。
最新の画像もっと見る
最近の「FreeBSD」カテゴリーもっと見る
最近の記事
カテゴリー
バックナンバー
2012年
人気記事