This tutorial explains how to setup a DNS server using Bind9 on Debian or Ubuntu. Throughout the article, substitute\u00a0 Backup current Bind9 settings.<\/p>\n Edit\u00a0 Create the log directory for Bind9.<\/p>\n Edit\u00a0 Create your domain zone file at\u00a0 Restart Bind9:<\/p>\n You’re all set. At this point, you may want to register your DNS server with your domain registrar. After doing that, you can change your existing name server to your own DNS server.<\/p>\n If you come across problems and need to view errors, you may use the following command.<\/p>\nyour-domain-name.com<\/code>\u00a0accordingly. At the end of the tutorial, you will have a functional Ubuntu DNS server.<\/p>\n
Install Bind9<\/h3>\n
apt-get install bind9\r\n<\/code><\/pre>\n
Configuration<\/h3>\n
cp \/etc\/bind\/named.conf.options \/etc\/bind\/named.conf.options.bak\r\n<\/code><\/pre>\n
\/etc\/bind\/named.conf.options<\/code>\u00a0and replace the content to following:<\/p>\n
options {\r\n directory \"\/var\/cache\/bind\";\r\n auth-nxdomain no;\r\n listen-on-v6 { any; };\r\n statistics-file \"\/var\/cache\/bind\/named.stats\";\r\n rrset-order {order cyclic;};\r\n allow-transfer { 127.0.0.1; };\r\n};\r\nlogging {\r\n channel b_query {\r\n file \"\/var\/log\/bind9\/query.log\" versions 2 size 1m;\r\n print-time yes;\r\n severity info;\r\n };\r\n category queries { b_query; };\r\n};\r\n<\/code><\/pre>\n
mkdir \/var\/log\/bind9\r\nchown bind:bind \/var\/log\/bind9\r\n<\/code><\/pre>\n
\/etc\/bind\/named.conf<\/code>\u00a0to configure your domain zone file location. Append the following lines:<\/p>\n
zone \"your-domain-name.com\" {\r\n type master;\r\n file \"\/etc\/bind\/zones\/your-domain-name.com.db\";\r\n};\r\n<\/code><\/pre>\n
\/etc\/bind\/zones\/your-domain-name.com.db<\/code>. Insert your DNS records by following this template:<\/p>\n
$TTL 86400\r\n@ IN SOA ns1.your-domain-name.com. root.your-domain-name.com. (\r\n 2014100801 ; Serial\r\n 43200 ; Refresh\r\n 3600 ; Retry\r\n 1209600 ; Expire\r\n 180 ) ; Minimum TTL\r\n\r\n; Nameservers\r\n IN NS ns1.your-domain-name.com.\r\n IN NS ns2.your-domain-name.com.\r\n IN NS ns3.your-domain-name.com.\r\n\r\n; Root site\r\n IN A 123.456.78.90\r\n\r\n; Hostname records\r\n* IN A 123.456.78.90\r\nsub1 IN A 123.456.78.91\r\nsub2 IN A 123.456.78.92\r\n\r\n; Aliases\r\nwww IN CNAME your-domain-name.com.\r\nwebmail IN CNAME ghs.google.com.\r\n\r\n; MX records\r\n@ IN MX 1 aspmx.l.google.com.\r\n@ IN MX 3 alt1.aspmx.l.google.com.\r\n@ IN MX 3 alt2.aspmx.l.google.com.\r\n@ IN MX 5 aspmx2.googlemail.com.\r\n@ IN MX 5 aspmx3.googlemail.com.\r\n@ IN MX 5 aspmx4.googlemail.com.\r\n@ IN MX 5 aspmx5.googlemail.com.\r\n\r\n; SPF records\r\n@ IN TXT \"v=spf1 ip4:199.195.140.194 include:_spf.google.com ~all\"\r\n<\/code><\/pre>\n
\/etc\/init.d\/bind9 restart\r\n<\/code><\/pre>\n
\/etc\/init.d\/bind9 status<\/code><\/pre>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[233,242,244,247],"manual_kb_tag":[394],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2671"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2671"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2671\/revisions"}],"predecessor-version":[{"id":2672,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2671\/revisions\/2672"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2671"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2671"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}