Debian 10 + Bind9 9.16.3 編譯安裝

本文阅读 1 分钟
首页 Debian,Linux 正文

先安裝相關所需套件

  1. apt install build-essential pkg-config libuv1-dev pytho3-ply python3-ply libssl-dev libcap-dev default-libmysqlclient-dev libtool libtool-bin libnghttp2-dev

建立使用者、群組

  1. groupadd -r named
  2. useradd -s /sbin/nologin -M -r -g named named

下載 Bind9 9.16.3

  1. https://downloads.isc.org/isc/bind9/9.16.3/bind-9.16.3.tar.xz

解壓縮後,開始編譯與安裝

  1. ./configure --enable-largefile --prefix=/usr/local/bind --with-openssl
  2. make
  3. make install

配置 Bind9

  1. cd /usr/local/bind/etc
  2. ../sbin/rndc-confgen >rndc.conf
  3. tail -n10 rndc.conf | head -n9 | sed -e 's/# //g' > named.conf
  4. wget https://www.internic.net/domain/named.root
  5. mkdir /usr/local/bind/log/
  6. mkdir /usr/local/bind/db/

將以下內容附加於 named.conf

  1. zone "." IN {
  2. type hint;
  3. file "/usr/local/bind/etc/named.root";
  4. };
  5. options {
  6. listen-on-v6 { any; };
  7. tcp-clients 50000;
  8. directory "/usr/local/bind/var";
  9. pid-file "/usr/local/bind/var/bind.pid";
  10. dump-file "/usr/local/bind/var/bind_dump.db";
  11. statistics-file "/usr/local/bind/var/bind.stats";
  12. rate-limit {
  13. nxdomains-per-second 3;
  14. window 1;
  15. };
  16. notify yes;
  17. recursion no;
  18. version "ooxx-bind:1.0.24";
  19. allow-notify { none; };
  20. allow-recursion { any; };
  21. allow-transfer { none; };
  22. allow-query { any; };
  23. additional-from-cache no;
  24. };
  25. logging {
  26. channel bind_log {
  27. file "/usr/local/bind/log/bind.log" versions 3 size 20m;
  28. severity info;
  29. print-time yes;
  30. print-severity yes;
  31. print-category yes;
  32. };
  33. category default {
  34. bind_log;
  35. };
  36. };
  37. zone "csie.online" in {
  38. type master;
  39. file "/usr/local/bind/db/csie.online/csie.online.db";
  40. };

編輯 /usr/local/bind/db/csie.online/csie.online.db 內容

  1. $TTL 60
  2. $ORIGIN csie.online.
  3. @ IN SOA csie.online. admin.csie.online. (
  4. 2019111200 ; Serial
  5. 300 ; Refresh
  6. 300 ; Retry
  7. 300 ; Expire
  8. 60 ) ; Negative Cache TTL
  9. @ IN NS ns1.csie.online.
  10. @ IN NS ns2.csie.online.
  11. @ IN A 999.444.555.34
  12. @ IN AAAA XXXX:1688:1688:1688::1688
  13. @ IN MX 10 mail.server.
  14. * IN A 999.444.555.34
  15. * IN AAAA XXXX:1688:1688:1688::1688

將 bind 目錄賦予給 named 權限

  1. chown named:named /usr/local/bind/ -R

建立開機啟動

  1. vi /usr/lib/systemd/system/named.service

貼上以下內容

  1. [Unit]
  2. Description=Internet domain name server
  3. After=network.target
  4. [Service]
  5. ExecStart=/usr/local/bind/sbin/named -f -u named
  6. ExecReload=/usr/local/bind/sbin/rndc reload
  7. ExecStop=/usr/local/bind/sbin/rndc stop
  8. [Install]
  9. WantedBy=multi-user.target
  10. Alias=bind.service

設定開機啟動

  1. systemctl enable named
  2. systemctl start named
本文来自投稿,不代表本站立场,如若转载,请注明出处:
什麼是原生 IP?
« 上一篇 05-27
Debian 使用 Google Authenticator 登入 SSH
下一篇 » 01-12