{"id":78519,"date":"2025-09-28T23:47:40","date_gmt":"2025-09-28T23:47:40","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=78519"},"modified":"2025-09-28T23:47:41","modified_gmt":"2025-09-28T23:47:41","slug":"step-by-step-dns-server-installation-in-ubuntu-in-a-fresh-vm","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=78519","title":{"rendered":"Step by step DNS Server installation in ubuntu in a fresh VM"},"content":{"rendered":"\n<p>&#8220;Nice \u2014 below is a <strong>complete, step-by-step, blog-ready guide<\/strong> to install and configure a simple <strong>authoritative + optional recursive BIND9 DNS server<\/strong> on a fresh Ubuntu VM. It\u2019s copyright-free and ready to paste into your notes or blog.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Notes before you begin<br>\u2022 This guide assumes Ubuntu 22.04 \/ 24.04 (netplan-based).<br>\u2022 Replace <code>example.test<\/code> and IPs with your real domain and network. (<code>.test<\/code> is safe for labs.)<br>\u2022 Use <code>sudo<\/code> for commands or run as root.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">1 \u2014 Prepare the VM &amp; network<\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Update packages:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; sudo apt upgrade -y\n<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>(Optional but recommended) Give the VM a stable IP. Find your interface name:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>ip addr show\n<\/code><\/pre>\n\n\n\n<p>Create a netplan file <code>\/etc\/netplan\/01-netcfg.yaml<\/code> (example for static IP <code>192.168.56.10\/24<\/code>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>network:\n  version: 2\n  renderer: networkd\n  ethernets:\n    ens33:\n      dhcp4: no\n      addresses: &#91;192.168.56.10\/24]\n      gateway4: 192.168.56.1\n      nameservers:\n        addresses: &#91;8.8.8.8,1.1.1.1]\n<\/code><\/pre>\n\n\n\n<p>Apply it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo netplan apply\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">2 \u2014 Install BIND9<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install bind9 bind9utils bind9-doc dnsutils -y\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">3 \u2014 Basic BIND options<\/h1>\n\n\n\n<p>Edit <code>\/etc\/bind\/named.conf.options<\/code>. Minimal example (authoritative + allow recursion to localnets):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/bind\/named.conf.options\n<\/code><\/pre>\n\n\n\n<p>Inside:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>options {\n    directory \"\/var\/cache\/bind\";\n    recursion yes;                 # set to no if this server MUST be authoritative-only\n    allow-recursion { localnets; 127.0.0.1; };\n    allow-query { any; };\n    forwarders { 8.8.8.8; 1.1.1.1; };  # for recursive queries; remove for pure-authoritative\n    dnssec-validation auto;\n    auth-nxdomain no;    # conform to RFC1035\n};\n<\/code><\/pre>\n\n\n\n<p>Save and exit.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">4 \u2014 Define your zones<\/h1>\n\n\n\n<p>Edit <code>\/etc\/bind\/named.conf.local<\/code> and add forward and reverse zones:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/bind\/named.conf.local\n<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zone \"example.test\" {\n    type master;\n    file \"\/etc\/bind\/db.example.test\";\n    allow-transfer { none; };   # restrict AXFRs; configure TSIG if you need slaves\n};\n\nzone \"56.168.192.in-addr.arpa\" {\n    type master;\n    file \"\/etc\/bind\/db.192.168.56\";\n    allow-transfer { none; };\n};\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Reverse zone name depends on your network (for <code>192.168.56.0\/24<\/code> reverse is <code>56.168.192.in-addr.arpa<\/code>).<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">5 \u2014 Create forward zone file<\/h1>\n\n\n\n<p>Create <code>\/etc\/bind\/db.example.test<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/etc\/bind\/db.local \/etc\/bind\/db.example.test\nsudo nano \/etc\/bind\/db.example.test\n<\/code><\/pre>\n\n\n\n<p>Example content (edit serial and IPs):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$TTL 604800\n@   IN  SOA ns1.example.test. admin.example.test. (\n        2025092801 ; serial (YYYYMMDDnn)\n        604800     ; refresh\n        86400      ; retry\n        2419200    ; expire\n        604800 )   ; negative cache TTL\n;\n@       IN  NS      ns1.example.test.\nns1     IN  A       192.168.56.10\nwww     IN  A       192.168.56.11\nmail    IN  A       192.168.56.12\n@       IN  MX 10   mail.example.test.\n<\/code><\/pre>\n\n\n\n<p><strong>Important:<\/strong> Always update the serial when changing the file (format <code>YYYYMMDDnn<\/code> is convenient).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">6 \u2014 Create reverse zone file<\/h1>\n\n\n\n<p>Create <code>\/etc\/bind\/db.192.168.56<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp \/etc\/bind\/db.127 \/etc\/bind\/db.192.168.56\nsudo nano \/etc\/bind\/db.192.168.56\n<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$TTL 604800\n@   IN  SOA ns1.example.test. admin.example.test. (\n        2025092801 ; serial\n        604800\n        86400\n        2419200\n        604800 )\n;\n@       IN  NS  ns1.example.test.\n10      IN  PTR ns1.example.test.      ; 192.168.56.10 -&gt; ns1\n11      IN  PTR www.example.test.      ; 192.168.56.11 -&gt; www\n12      IN  PTR mail.example.test.     ; 192.168.56.12 -&gt; mail\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">7 \u2014 Syntax check &amp; load zones<\/h1>\n\n\n\n<p>Check config &amp; zones:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo named-checkconf                 # checks named.conf syntax\nsudo named-checkzone example.test \/etc\/bind\/db.example.test\nsudo named-checkzone 56.168.192.in-addr.arpa \/etc\/bind\/db.192.168.56\n<\/code><\/pre>\n\n\n\n<p>Fix any errors the commands print.<\/p>\n\n\n\n<p>Restart BIND:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart bind9\nsudo systemctl enable bind9\nsudo systemctl status bind9\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">8 \u2014 Firewall (allow DNS)<\/h1>\n\n\n\n<p>Allow DNS ports (adjust to your security policy):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 53\/tcp\nsudo ufw allow 53\/udp\n# Or restrict to a management net:\n# sudo ufw allow from 192.168.56.0\/24 to any port 53 proto udp\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">9 \u2014 Test your DNS server<\/h1>\n\n\n\n<p>From the server itself:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dig @127.0.0.1 example.test A +short    # should return 192.168.56.11 if configured\ndig @127.0.0.1 ns1.example.test A +short # should return 192.168.56.10\ndig -x 192.168.56.11 @127.0.0.1 +short   # reverse lookup -&gt; www.example.test.\n<\/code><\/pre>\n\n\n\n<p>From a remote machine (replace with server IP):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dig @192.168.56.10 www.example.test A +short\nnslookup www.example.test 192.168.56.10\n<\/code><\/pre>\n\n\n\n<p>If you enabled recursion and forwarders, test recursive queries:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dig @192.168.56.10 www.google.com A +short\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">10 \u2014 Make it authoritative-only (optional)<\/h1>\n\n\n\n<p>If you plan to host a public authoritative server and <strong>must not<\/strong> recursively resolve for the public, edit <code>named.conf.options<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>recursion no;\nallow-query { any; };\nforwarders { };   # remove forwarders\n<\/code><\/pre>\n\n\n\n<p>Restart BIND. Authoritative-only servers should <strong>never<\/strong> allow open recursion.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">11 \u2014 Slave server configuration (optional)<\/h1>\n\n\n\n<p>If you want a slave:<br>In the slave <code>\/etc\/bind\/named.conf.local<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zone \"example.test\" {\n    type slave;\n    file \"\/var\/cache\/bind\/db.example.test\";\n    masters { 198.51.100.5; };   # master IP\n};\n<\/code><\/pre>\n\n\n\n<p>On master, allow transfer to slave IP or use TSIG keys for secure zone transfers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">12 \u2014 Troubleshooting &amp; logs<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check systemd journal:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo journalctl -u bind9 -f\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check syslog for named messages:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -f \/var\/log\/syslog | grep named\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If BIND can\u2019t read files, AppArmor may block it; check <code>sudo aa-status<\/code> and <code>\/var\/log\/syslog<\/code> for AppArmor denials.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">13 \u2014 Operational tips &amp; security<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Increment the SOA serial<\/strong> on every zone change. Use <code>YYYYMMDDnn<\/code> format.<\/li>\n\n\n\n<li><strong>Restrict zone transfers<\/strong>: <code>allow-transfer { &lt;slave-ip>; };<\/code> or <code>none;<\/code> and use TSIG where needed.<\/li>\n\n\n\n<li><strong>Limit recursion<\/strong> to trusted networks to avoid being used in DNS amplification attacks.<\/li>\n\n\n\n<li><strong>Enable DNSSEC<\/strong> if you publish publicly and need tamper protection (optional, advanced).<\/li>\n\n\n\n<li><strong>Back up<\/strong> <code>\/etc\/bind<\/code> regularly.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Quick one-line summary (for your blog)<\/h2>\n\n\n\n<p>Install BIND9, define forward\/reverse zones in <code>named.conf.local<\/code>, create zone files <code>\/etc\/bind\/db.*<\/code> with SOA\/NS\/A\/PTR records, validate with <code>named-checkzone<\/code>, open UDP\/TCP 53, restart <code>bind9<\/code>, and test with <code>dig @your-server domain<\/code>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>&#8220;<\/p>\n\n\n\n<p>REF: AI Tools\/Open AI\/ChatGPT<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;Nice \u2014 below is a complete, step-by-step, blog-ready guide to install and configure a simple authoritative + optional recursive BIND9 DNS server on a fresh Ubuntu VM. It\u2019s copyright-free and ready to paste into your notes or blog. Notes before you begin\u2022 This guide assumes Ubuntu 22.04 \/ 24.04 (netplan-based).\u2022 Replace example.test and IPs with &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=78519\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1978],"tags":[],"class_list":["post-78519","post","type-post","status-publish","format-standard","hentry","category-computer-networks","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":78627,"url":"http:\/\/bangla.sitestree.com\/?p=78627","url_meta":{"origin":78519,"position":0},"title":"How to Run the GNS3 VM Inside Oracle VirtualBox","author":"Author-Check- Article-or-Video","date":"November 26, 2025","format":false,"excerpt":"How to Run the GNS3 VM Inside Oracle VirtualBox Here is a clean, fully rewritten, plagiarism-free, blog-ready version that covers both the step-by-step tutorial and the architecture diagram explanation, merged into one smooth article. You can publish this as-is. How to Run the GNS3 VM Inside Oracle VirtualBox A Complete\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78621,"url":"http:\/\/bangla.sitestree.com\/?p=78621","url_meta":{"origin":78519,"position":1},"title":"Some Details on Network Adapter Settings for GNS VM in VirtualBox","author":"Author-Check- Article-or-Video","date":"November 26, 2025","format":false,"excerpt":"Here is a polished, blog-ready rewrite \u2014 copyright-free, plagiarism-free, and integrity-safe. How to Configure Network Adapters for the GNS3 VM in VirtualBox When running the GNS3 VM inside VirtualBox, proper network adapter configuration is essential. The GNS3 GUI on your host system relies on these adapters to communicate with the\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78445,"url":"http:\/\/bangla.sitestree.com\/?p=78445","url_meta":{"origin":78519,"position":2},"title":"Why Do We Need the GNS3 VM?","author":"Sayed","date":"September 1, 2025","format":false,"excerpt":"Perfect \ud83d\udc4d I\u2019ll rewrite that into a fresh, copyright-free and plagiarism-free version while keeping all the important details intact. You can safely post this on your FB\/blog. \ud83d\ude80 Why Do We Need the GNS3 VM? When working with GNS3, you\u2019ll often hear about the GNS3 VM. Many beginners wonder: \u201cCan\u2019t\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78623,"url":"http:\/\/bangla.sitestree.com\/?p=78623","url_meta":{"origin":78519,"position":3},"title":"How to Configure VirtualBox Network Adapters for the GNS3 VM (with GNS3 GUI)","author":"Author-Check- Article-or-Video","date":"November 26, 2025","format":false,"excerpt":"Here is a polished, blog-ready version \u2014 fully rewritten, original, plagiarism-free, and safe for publishing. How to Configure VirtualBox Network Adapters for the GNS3 VM (with GNS3 GUI) Setting up the GNS3 VM correctly inside VirtualBox is essential if you want the GNS3 GUI on your computer to communicate smoothly\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78377,"url":"http:\/\/bangla.sitestree.com\/?p=78377","url_meta":{"origin":78519,"position":4},"title":"Download Network Application Software","author":"Sayed","date":"August 22, 2025","format":false,"excerpt":"Download GNS https:\/\/www.gns3.com\/software\/download GNS VM https:\/\/www.gns3.com\/software\/download-vm Ubuntu Desktop https:\/\/ubuntu.com\/download\/desktop Download WireShark https:\/\/www.wireshark.org\/download.html","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-4.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-4.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-4.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/08\/image-4.png?resize=700%2C400 2x"},"classes":[]},{"id":78337,"url":"http:\/\/bangla.sitestree.com\/?p=78337","url_meta":{"origin":78519,"position":5},"title":"Check Your Linux Knowledge","author":"Sayed","date":"July 27, 2025","format":false,"excerpt":"Linux Installation: Pre Assessment What do you need handy before installing Ubuntu in a Virtual Box 0 points Check all that apply. \u00a0Oracle Virtualbox Installed \u00a0ISO Image of the Linux \u00a0ISO Image in USB Drive What is usually the best place to download\/take a software to install? * 1 point\u2026","rel":"","context":"In &quot;Anything Linux&quot;","block_context":{"text":"Anything Linux","link":"http:\/\/bangla.sitestree.com\/?cat=1976"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/07\/image-8.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/07\/image-8.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/07\/image-8.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78519"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78519\/revisions"}],"predecessor-version":[{"id":78520,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78519\/revisions\/78520"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78519"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}