Advertisement
hjaltiatlason

Setup Bind9 DNS server

Feb 4th, 2021 (edited)
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.46 KB | None | 0 0
  1. ##########################################################################################################
  2. #Useful information
  3. #DNS Privacy Public Resolvers : https://dnsprivacy.org/wiki/display/DP/DNS+Privacy+Public+Resolvers
  4. # Comparison of policy and privacy statements 2019: #https://dnsprivacy.org/wiki/display/DP/Comparison+of+policy+and+privacy+statements+2019
  5. ##########################################################################################################
  6.  
  7. #################################################
  8. #How to Setup Bind9 DNS server step-by-step guide
  9. #################################################
  10.  
  11.  
  12. #update system
  13. apt update && apt full-upgrade -y
  14. #Install Bind packages
  15. apt install bind9 bind9utils bind9-doc
  16. #Check Bind9 status
  17. systemctl status bind9
  18.  
  19. #add info to /etc/default/named
  20. vim /etc/default/named
  21. #Add -4 for ipv4 to this line in /etc/default/named  #startup option
  22. OPTIONS="-u bind -4"
  23. #reload bind9
  24. systemctl reload-or-restart bind9
  25.  
  26.  
  27.  
  28. #Optional - To show you the primary configuration file for the BIND DNS server named
  29. cat /etc/bind/named.conf
  30.  
  31. #Add dns forwarders to this file /etc/bind/named.conf.options
  32. vim /etc/bind/named.conf.options
  33.  
  34.         forwarders {
  35.         8.8.8.8;
  36.         8.8.4.4;
  37. };
  38. };
  39.  
  40. #reload bind9
  41. systemctl reload-or-restart bind9
  42.  
  43. #add info to the end of the file in /etc/bind/named.conf.local
  44. vim /etc/bind/named.conf.local
  45.  
  46. zone "hjalti.me" {
  47.         type master;
  48.         file "/etc/bind/db.hjalti.me";
  49. };
  50.  
  51. #copy empty example file and create a Zone file called /etc/bind/db.hjalti.me
  52. cp /etc/bind/db.empty /etc/bind/db.hjalti.me
  53.  
  54. #Add info to file /etc/bind/db.hjalti.me
  55. vim /etc/bind/db.hjalti.me
  56.  
  57. ; BIND reverse data file for empty rfc1918 zone
  58. ;
  59. ; DO NOT EDIT THIS FILE - it is used for multiple zones.
  60. ; Instead, copy it, edit named.conf, and use that copy.
  61. ;
  62. $TTL    86400
  63. @       IN      SOA     ns1.hjalti.me. root.localhost. (
  64.                               1         ; Serial
  65.                          604800         ; Refresh
  66.                           86400         ; Retry
  67.                         2419200         ; Expire
  68.                           86400 )       ; Negative Cache TTL
  69. ;
  70. @       IN      NS      ns1.hjalti.me.
  71.  
  72.  
  73. @       IN      NS      ns1.hjalti.me.
  74. ;@      IN      NS      ns2.hjalti.me.
  75. ns1     IN      A       192.168.144.4
  76. hjalti.me.      IN     A     192.168.144.4
  77. www     IN      A       192.168.144.4
  78. vhost1  IN      A       192.168.144.50
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement