.. index:: unbound_1.4.22 unbound 1.4.22 ================ .. contents:: Contents =========== 実行環境 =========== | :ref:`sl_6.4` | :ref:`ubuntsu_server_12.04` =========== 最終検証日 =========== 2014/08/05 =========== 依存関係 =========== * :doc:`../../library/openssl/index` * :doc:`../../library/expat/index` =========== コンパイル =========== .. note:: 基本的には管理者ユーザ(rootなど)で実施していることを前提としています .. code-block:: bash #------------------------------------------------------------ # unbound-1.4.22 #------------------------------------------------------------ BASE=/opt/brew # ソースダウンロード先 comp_dir=/usr/local/src # パッケージ名 pack_name=unbound # バージョン version=-1.4.22 # ソースのファイル形式 ext=.tar.gz # 解凍コマンド tar_cmd="tar zxf" # インストール先ディレクトリ ins_dir=/opt/${pack_name}/${version##-} # ダウンロード元パッケージ dl_uri="http://unbound.net/downloads/unbound-1.4.22.tar.gz" # コンパイル時の並列数 proc_num=`cat /proc/cpuinfo | grep processor | wc -l` cd ${comp_dir} rm -rf ${pack_name}${version} test -f ${pack_name}${version}${ext} \ || wget ${dl_uri} -O ${pack_name}${version}${ext} ${tar_cmd} ${pack_name}${version}${ext} cd ${pack_name}${version} ./configure \ --prefix=${ins_dir} \ --with-openssl=${ins_dir} \ --with-ssl=${BASE} \ --with-libexpat=${BASE} \ && nice -n 15 make -j${proc_num}\ && make install ================ Pathの設定 ================ .. code-block:: bash for type in $(ls -1 ${ins_dir}) do for src in $(find ${ins_dir}/${type} -xtype f) do parent=`dirname ${src#*/${type}/}` mkdir -p /opt/brew/$type/$parent echo "ln -fs ${src} ${BASE}/${type}/${parent}/${filename}" ln -fs ${src} ${BASE}/${type}/${parent}/${filename} done done grep -q ${BASE}/bin ~/.bashrc \ || echo "export PATH=${BASE}/bin:${BASE}/sbin:"'${PATH}' >> ~/.bashrc \ ; source ~/.bashrc ======================== 主なconfigureオプション ======================== ``--prefix=[DIR]`` インストール先ディレクトリの指定 =============== 初期設定 =============== ユーザの作成 --------------------- ユーザはセキュリティのため、一般ユーザを使用します。ここではunboundのデフォルトのユーザとします。 .. code-block:: bash id unbound || useradd -r unbound セットアップスクリプトの実行 ---------------------------------- サーバ証明書など、unboundを動作させるために必要なファイルを生成してくれるコマンドが用意されているので実行します。 .. code-block:: bash unbound-control-setup =============== 設定ファイル =============== unbound.conf --------------------- {PREFIX}/etc/unbound/ の配下に作成されています。 インターフェース(ListenするIPとポート)の設定をします。 この設定を行わない場合、デフォルトはlocalhostになるため、他の端末から参照ができなくなります。 .. code-block:: bash # 37行目付近 interface: サーバのIPアドレス 再帰的問い合わせの設定。 この設定を行わない場合、unboundサーバが名前解決できない場合に、親DNSへの問い合わせを行いません。 システム内部のみのスタンドアロンには向きますが、プラスWAN環境への問い合わせにはできません。 したがって再帰的問い合わせをできるようにしておきます。 この際、どこからの問い合わせに対して再帰処理をするのかを指定します。 通常は同一システム内(LAN)であることが多いと思いますので、そこに対して許可を行いますが、適宜設定してください。 .. code-block:: bash # 177行目付近 access-control: 192.168.0.0/16 allow リモート制御の設定。 この設定を行わない場合、unbound-controlからunboundを停止できません。 なぜ起動はできるのに停止ができないのか、よくわかりませんが、unbound-controlからの制御を可能としておきます。 .. code-block:: bash # 541行目付近 control-enable: yes ------ DIFF ------ 上記のとおり反映した場合のdiffを掲載しておきます。 .. code-block:: bash # diff -u unbound.conf.default unbound.conf --- unbound.conf.default 2014-07-30 19:12:05.739999738 +0900 +++ unbound.conf 2014-07-30 21:43:56.436998084 +0900 @@ -38,6 +38,7 @@ # interface: 192.0.2.154 # interface: 192.0.2.154@5003 # interface: 2001:DB8::5 + interface: 192.168.1.2 # enable this feature to copy the source address of queries to reply. # Socket options are not supported on all platforms. experimental. @@ -178,6 +179,7 @@ # access-control: ::0/0 refuse # access-control: ::1 allow # access-control: ::ffff:127.0.0.1 allow + access-control: 192.168.0.0/16 allow # if given, a chroot(2) is done to the given directory. # i.e. you can chroot to the working directory, for example, @@ -539,6 +541,7 @@ # Enable remote control with unbound-control(8) here. # set up the keys and certificates with unbound-control-setup. # control-enable: no + control-enable: yes # what interfaces are listened to for remote control. # give 0.0.0.0 and ::0 to listen to all interfaces. ====== 起動 ====== .. code-block:: bash unbound-control start ====== 停止 ====== .. code-block:: bash unbound-control stop