(/index.php) Contact us (/contactus) Advertise Here (/advertisehere) Contents [Hide] bind9 nameserver installation (https://linuxconfig.org/linuxd...
9 downloads
32 Views
303KB Size
(/index.php)
Home (/)
Linux Tutorials (/linuxtutorials)
Linux Commands (/linuxcommands)
Contact us (/contactus)
Advertise Here (/advertisehere)
Write For Us (/writeforus)
Linux DNS server BIND configuration
Free Linux eBooks
Contents [Hide] bind9 nameserver installation (https://linuxconfig.org/linuxdnsserverbindconfiguration#h1bind9nameserverinstallation) Creating a DNS zone file (https://linuxconfig.org/linuxdnsserverbindconfiguration#h2creatingadnszonefile) addresstoname mappings (https://linuxconfig.org/linuxdnsserverbindconfiguration#h3addresstonamemappings) Updating a BIND Configuration File (https://linuxconfig.org/linuxdnsserverbindconfiguration#h4updatingabindconfigurationfile) Checking bind's zone files and configuration (https://linuxconfig.org/linuxdnsserverbindconfiguration#h5checkingbindszonefilesandconfiguration) Start / restart bind nameserver (https://linuxconfig.org/linuxdnsserverbindconfiguration#h6startrestartbindnameserver) Testing a bind server configuration (https://linuxconfig.org/linuxdnsserverbindconfiguration#h7testingabindserverconfiguration)
This article is a quick configuration manual of a Linux DNS server using bind. I believe that bind do not need much introduction, but before you proceed with the installation and configuration of bind nameserver make sure that bind DNS server is exactly what you want. Default setup and execution of bind on Debian or Ubuntu may take around 200MB of RAM with no zones added to the config file. Unless you reduce the memory usage of a bind via various bind "options" config settings, be prepared to have some spare RAM available just for this service. This fact is even more important if you pay for your own VPS server.
Search Articles Another DNS nameservers available on a Linux systems are NSD ( Name Server Daemon) or djbdns ( tinydns ). Both are lightweight alternatives to bind9 DNS server and have less RAM requirements. Apparently are even faster. In this article we will not go into details of what Domain Name Service ( DNS ) is nor how DNS works. Rather we simply concentrate in a simple configuration of a custom zone and config file for a given domain / host supporting www, mail services.
search ...
Search
Sample scenario notes to help you ready this DNS bind howto: nameserver IP address 192.168.135.130 sample domain / host: linuxconfig.org authoritative nameservers for a linuxconfig.org zone: ns1.linuxconfig.org ( 192.168.0.10 ) and ns2.linuxconfig.org ( 192.168.0.11 ) www and mail services for linuxconfig.org will point to: 192.168.0.10
Friendly Sites Tuxmachines.org (http://tuxmachines.org/)
1. bind9 nameserver installation Unless you prefer to install bind from a source code the installation is rather simple. On a Debian or Ubuntu Linux server you can install a bind nameserver with a following command:
Latest Configs Configuring the MPD Music Server on
aptget install bind9 dnsutils CentOS or Fedora alternative:
yum install bind dnsutils dnsutils is not compulsory package to run bind webserver, but we will use a dig command which is part of this package as a testing tool of your bind configuration.
Ubuntu Linux (/configuringthempdmusic serveronubuntulinux) Simple Virtualization With Ubuntu 16.04 Linux and KVM (/simplevirtualizationwith ubuntu1604andkvm) How to reset MySQL root password on your Linux server (/howtoresetmysqlroot passwordonyourlinuxserver) Getting The RX 480 Running With
2. Creating a DNS zone file
AMDGPU on Linux (/gettingtherx480
At this stage we will need to create a new zone file for a domain linuxconfig.org. Navigate to /etc/bind/ directory execute following sequence of commands to navigate to zones/master/
How to run X applications without a desktop
runningwithamdgpuonlinux) or a WM (/howtorunxapplicationswithout adesktoporawm)
cd /etc/bind
How to automatically execute shell script at
mkdir p zones/master
startup boot on systemd Linux (/howto
cd zones/master/
automaticallyexecuteshellscriptatstartup bootonsystemdlinux)
/etc/bind/zones/master directory will contain a zone file for a linuxconfig.org domain. If you prefer to use another directory to hold this file you are free to do so. The following zone file db.linuxconfig.org will hold a DNS record to assist a nameserver resolve a fully qualified domain name to an IP address. Create and save db.linuxconfig.org with a following content:
Basic PHP 7 and Nginx Configuration on Ubuntu 16.04 Linux (/basicphp7andnginx configurationonubuntu1604linux) Ruby on Rails Development On Ubuntu 16.04 Linux (/rubyonrailsdevelopmenton ubuntu1604) Fedora 24 Workstation Review: All Work and Very Little Play (/fedora24workstation reviewallworkandverylittleplay) How to setup latest version of Django framework with Python 3 on Debian 8 Jessie Linux (/howtosetuplatestversionof djangoframeworkwithpython3ondebian 8jessielinux) How to reset lost root password on Ubuntu 16.04 Xenial Xerus Linux (/howtoresetlost rootpasswordonubuntu1604xenialxerus linux)
Basic NFS Installation and Configuration on
;
Linux (/basicnfsinstallationand
; BIND data file for linuxconfig.org
configurationonlinux)
; $TTL 3h @ IN SOA ns1.linuxconfig.org. admin.linuxconfig.org. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week
Setting up apt proxy Server Approx on Ubuntu Linux (/settingupaptproxyserver approxonubuntulinux) Linux command line basics for beginners: Part 3 (/linuxcommandlinebasicsfor beginnerspart3)
1h ) ; Negative caching TTL of 1 day
Linux command line basics for beginners:
;
Part 2 (/linuxcommandlinebasicsfor
@ IN NS ns1.linuxconfig.org.
beginnerspart2)
@ IN NS ns2.linuxconfig.org.
Create and Restore manual Logical Volume Snapshots (/createandrestoremanual logicalvolumesnapshots)
linuxconfig.org. IN MX 10 mail.linuxconfig.org.
I2P Anonymity for the Masses (/i2p
linuxconfig.org. IN A 192.168.0.10
anonymityforthemasses)
ns1 IN A 192.168.0.10 ns2 IN A 192.168.0.11 www IN CNAME linuxconfig.org. mail IN A 192.168.0.10 ftp IN CNAME linuxconfig.org. Here is just a quick review of some lines from the above bind DNS zone file: SOA Record: nameserver authoritative for a zone linuxconfig.org is ns1.linuxconfig.org and admin.linuxconfig.org is an email address of
Learning Linux Commands: man (/learning linuxcommandsman) Linux Command Line & Bash Shell Shortcuts (/linuxcommandlinebashshell shortcuts) How to Install Any Linux Distro on a Chromebook (/howtoinstallanylinuxdistro onachromebook)
a person responsible for this DNS zone. NS Records: two nameservers for a linuxconfig.org zone are ns[1,2].linuxconfig.org MX ( Mail Exchange): linuxconfig.org mail exachange record. Number 10 means a preference for discarting a records A : A simply means address inanother words in linuxconfig.org's zone a ns1 would ahve a A ( address ) 192.168.0.10. CNAME Record ( Canonical Name record ): restart the query using the canonical name instead of the original name
3. addresstoname mappings At this stage the bind DNS server can resolve an IP address mapped to a linuxconfig.org host. What we should do now is the teach our nameserver the other way around, which is, to resolve a host from an IP address. For this we are going to need yet another file and that is db.192.168.0 with a following content: PTR
; ; BIND reverse data file for 0.168.192.inaddr.arpa ; $TTL 604800 0.168.192.inaddr.arpa. IN SOA ns1.linuxconfig.org. admin.linuxconfig.org. ( 1 ; Serial 3h ; Refresh after 3 hours 1h ; Retry after 1 hour 1w ; Expire after 1 week 1h ) ; Negative caching TTL of 1 day ; 0.168.192.inaddr.arpa. IN NS ns1.linuxconfig.org. 0.168.192.inaddr.arpa. IN NS ns2.linuxconfig.org. 10.0.168.192.inaddr.arpa. IN PTR linuxconfig.org. PTR: a NDS record used for a mapping of an IP address to a host name.
4. Updating a BIND Configuration File At this point we should have two files ready: /etc/bind/zones/master/db.linuxconfig.org /etc/bind/zones/master/db.192.168.0 All we need to do now is to insert both zone file names into a bind's configuration file named.conf.local. To do that add following lines into this file:
zone "linuxconfig.org" { type master; file "/etc/bind/zones/master/db.linuxconfig.org"; }; zone "0.168.192.inaddr.arpa" { type master; file "/etc/bind/zones/master/db.192.168.0"; }; Last thing before we go ahead to check a configuration is to add and IP address af a stable DNS server to a named.conf.options file. This IP address is used in case that a local DNS server do not know the answer the a name resolution query. In IP address of a DNS server in many cases is provided by your Internet provider. Alternatively if you are google fan use 8.8.8.8 or 8.8.4.4. (flosstechnicalwriterlinuxconfigorg)
(flosstechnicalwriterlinuxconfigorg)
Replace a following blog of text withing a named.conf.options file:
// forwarders {
Go to top
// 0.0.0.0; // }; with new stable DNS server IP address
forwarders { 8.8.4.4; };
5. Checking bind's zone files and configuration Before we attempt to start a bind nameserver with a new zone and configuration here are some tools to check if we have not done some typo or misconfiguration. To check a configuration files run a following command:
namedcheckconf With this namedcheckconf command the rule is: no news are good news. If no output had been produced your config files looks OK. To check a DNS zone files we can use namedcheckzone command:
namedcheckzone linuxconfig.org /etc/bind/zones/master/db.linuxconfig.org zone linuxconfig.org/IN: loaded serial 1 OK reverse zone file check:
namedcheckzone 0.168.192.inaddr.arpa /etc/bind/zones/master/db.192.168.0 zone 0.168.192.inaddr.arpa/IN: loaded serial 2 OK
6. Start / restart bind nameserver At this point nothing can stop us to run bind9 dns server:
/etc/init.d/bind9 start Starting domain name service...: bind9. Alternatively, if your bind server is already running use a following command to to assist you with its restart:
/etc/init.d/bind9 restart Stopping domain name service...: bind9. Starting domain name service...: bind9.
7. Testing a bind server configuration A dig command from dnsutils package will become handy to help us to test a new configuration of bind nameserver. dig command can be used from any PC which has a network access the your DNS server but preferably your should start your testing from a localhost. In our this case the IP address of our name server is 192.168.135.130. First we will test hosttoIP resolution:
(flosstechnicalwriterlinuxconfigorg)
(flosstechnicalwriterlinuxconfigorg)
dig @192.168.135.130 www.linuxconfig.org Go to top
; <<>> DiG 9.6ESVR1 <<>> @192.168.135.130 www.linuxconfig.org ; (1 server found) ;; global options: +cmd ;; Got answer: ;; >>HEADER<< opcode: QUERY, status: NOERROR, id: 60863 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2 ;; QUESTION SECTION: ;www.linuxconfig.org. IN A ;; ANSWER SECTION: www.linuxconfig.org. 10800 IN CNAME linuxconfig.org. linuxconfig.org. 10800 IN A 192.168.0.10 ;; AUTHORITY SECTION: linuxconfig.org. 10800 IN NS ns2.linuxconfig.org. linuxconfig.org. 10800 IN NS ns1.linuxconfig.org. ;; ADDITIONAL SECTION: ns1.linuxconfig.org. 10800 IN A 192.168.0.10 ns2.linuxconfig.org. 10800 IN A 192.168.0.11 ;; Query time: 0 msec ;; SERVER: 192.168.135.130#53(192.168.135.130) ;; WHEN: Thu Aug 5 18:50:48 2010 ;; MSG SIZE rcvd: 135 Next we test IPtohost resolution:
dig @192.168.135.130 x 192.168.0.10 ; <<>> DiG 9.6ESVR1 <<>> @192.168.135.130 x 192.168.0.10 ; (1 server found) ;; global options: +cmd ;; Got answer: ;; >>HEADER<< opcode: QUERY, status: NOERROR, id: 10810 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2 ;; QUESTION SECTION: ;10.0.168.192.inaddr.arpa. IN PTR ;; ANSWER SECTION: 10.0.168.192.inaddr.arpa. 604800 IN PTR linuxconfig.org. ;; AUTHORITY SECTION: 0.168.192.inaddr.arpa. 604800 IN NS ns2.linuxconfig.org. 0.168.192.inaddr.arpa. 604800 IN NS ns1.linuxconfig.org. ;; ADDITIONAL SECTION: ns1.linuxconfig.org. 10800 IN A 192.168.0.10 ns2.linuxconfig.org. 10800 IN A 192.168.0.11 ;; Query time: 0 msec ;; SERVER: 192.168.135.130#53(192.168.135.130) ;; WHEN: Thu Aug 5 18:52:06 2010 ;; MSG SIZE rcvd: 140 Congratulation. You have just created and configured your own DNS zone using bind nameserver.
(flosstechnicalwriterlinuxconfigorg)
0 Comments
1
Linux Config
(flosstechnicalwriterlinuxconfigorg)
Login
Go to top
Recommend
⤤ Share
Sort by Newest
Start the discussion…
Be the first to comment.
ALSO ON LINUX CONFIG
C development on Linux Comparison between C and other programming languages II.
Linux commands to Backup and Restore MySQL database
1 comment • 3 months ago•
1 comment • 4 months ago•
rush essay — It's just a good thing that you have
Harikrishna Guggilla — Backupmysqldump u root
shared in how to perform that kind of programming using that kind of programming language that would …
p singletransaction routines > "path.sql" restoremysql u root p …
How to perform a bare metal installation of CoreOS Linux
ImportError: No module named 'anydbm' on Debian Linux Solution
1 comment • 4 months ago•
1 comment • 4 months ago•
spam me — Is it possible to boot directly into the
Yousof Kakhki — tnx you saved my life
sytem.? /newbie
✉ Subscribe d Add Disqus to your site Add Disqus Add
ὑ Privacy
Contact us (http://www.linuxcareer.com/contactus)
Copyright 2007 2016 LinuxConfig.org. All rights reserved.
(flosstechnicalwriterlinuxconfigorg)