DNS (Domain Name Service) server is a server that translate an IP address into a name that will be easy to remember or do the opposite way.

The administrative job is done in Server side. For client side just set the machine to connect the DNS server.

Before we start, I assume that you are connected to Internet already. For, text editor, you can use any program that you are familiar with. In this sample, I use vim.

The installation is as easy as below:

Step 1. Install the bind9

Open Linux Terminal (Applications>Accessories>Terminal), type: sudo apt-get install bind9

Installation finished.

Read the rest of this entry »

FreeBSD known as one of the most rock solid reliable and perfect operating systems, I personally lover of FreeBSD OS, so I want to publish a very nice howto about dns (Bind).

In this tutorial I’ll describe to you that how to set up secure FreeBSD based master/slave DNS server. You can use this tutorial on both 64-bit and 32-bit platforms.

We will use 192.168.0.1 as a Master Server and 192.168.0.2 as Slave Server

Installing and Configuring DNS:

FreeBSD 7.2 will be use for this tutorial. BIND is already installed in FreeBSD installation. You can check installed bind version using this link

1) Update your ports tree, I personally preferred portsnap for ports tree management. After updating ports tree check the version you have in the ports collection.

cat /usr/ports/dns/bind94/Makefile | grep PORTVERSION

If ports version equal your existing installed bind version then we don’t need to installation new bind version otherwise we will install new version.

Installation from Ports: Master/Slave Read the rest of this entry »

Configuring a DNS Server on freebsd   February 7th, 2010

Step 1. Create named.conf file with the following content:

Note: options “directory”, “, “pid-file”, “dump-file”, “statistics-file” might have other values if you configure bind server on Linux. The following values are for FreeBSD.

Note: do not forget to put “;” after every IP, incuding last IP, and to enclose rules between { }.

options {
        directory       "/etc/namedb";
        pid-file        "/var/run/named/pid";
        dump-file       "/var/dump/named_dump.db";
        statistics-file "/var/stats/named.stats";

        forwarders      { 213.157.176.3; 213.157.176.1; };
        allow-recursion { 10.0.0.1/16; 127.0.0.1; };
        allow-transfer  { 213.157.176.3; 213.157.176.1; 192.162.16.0/24; };
        listen-on       { 127.0.0.1; 86.X.Y.Z; };
};

zone "." {
        type hint;
        file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
        type master;
        file "master/localhost.rev";
};


zone "Z.Y.X.86.in-addr.arpa" {
        type master;
        file "master/Z.Y.X.86.in-addr.arpa";
};

zone "example.com" in {
        type master;
        file "/etc/namedb/example.com";
};

Few explanations regarding following variables: Read the rest of this entry »

Bind is a well known Unix name server, it is a powerfull piece of software which is used by the majority of nameservers.
This article will go though setting up a local area network that can be used at home or inside a small company.

In this article, we suppose that we are going to set a DNS zone for the domain: debuntu.foo, this is a fictionnal zone which is going to be used as a local network domain such as an intranet.

The name server is not accessible from the outside and only has 1 private LAN adress network interface.

All other computer in the LAN are going to use 192.168.1.5 as a nameserver, this can be set manually by setting statically:

nameserver 192.168.1.5

in their /etc/resolv.conf files, or via a DHCP server (beyond the scope of this article).

In the end, the nameserver is going to provide name resolution as well as reverse name resolution for our local network. For the rest of the domain name, it will query other DNS server and cache the result, behaving as a resolving, caching name server.

In the first part we are going to deal with name resolution and then in the second part, we are going to set up the reverse name resolution.

Requirements:

This how-to has been made using bind9, first of all, you need to install this package:

sudo apt-get install bind9

Now, we are going to set up debuntu.foo domain name.

Setting up Domain name resolution:

edit the local configuration file:

sudo vi /etc/bind/named.conf.local

and at the following entry:

zone “debuntu.foo” {
type master;
file “debuntu.foo.db”;
notify no;
};

As I don’t use any slave server in that example, I turn the value of notify to no.

What we say here, is that we are the master server for debuntu.foo, and the configuration file of that zone will be located at: /var/cache/bind/debuntu.foo.db.

Notice: the directory value (/var/cache/bind/) might vary depending on your distribution. Check its value in  /etc/bind/named.conf.options .On a Ubuntu Dapper, the default value is:

options {
directory “/var/cache/bind”;
….
….

Now, we are going to fill up the required values to define the domain debuntu.foo.

Create and edit /var/cache/bind/debuntu.foo.db, and add:

;
; Zone file for debuntu.foo
;
; The full zone file
;
$TTL 3D
@       IN      SOA     ns.debuntu.foo. chantra.debuntu.foo. (
200608081       ; serial, todays date + todays serial #
8H              ; refresh, seconds
2H              ; retry, seconds
4W              ; expire, seconds
1D )            ; minimum, seconds
;
NS      ns              ; Inet Address of name server
MX      10 mail         ; Primary Mail Exchanger
MX      20 mail2        ; Secondary Mail Exchanger
;
ns              A       192.168.1.5
www             CNAME   www.debuntu.org.
ftp             CNAME   ns
gw              A       192.168.1.1
TXT     “Network gateway”
mail            A       192.168.1.2
mail2           CNAME   otherbox
otherbox         A      192.168.1.3
TXT     “Otherbox”

In this file, we define:

  1. the adress of the name server; 192.168.1.5,
  2. an alias from www.debuntu.foo to www.debuntu.org,
    (mind the dot .” at the end of an external name),
  3. another alias from ftp.debuntu.foo to ns.debuntu.foo,
  4. An adresse for the local network gateway with a description

From now on, any machine from your local network, using this name server, will be able to access the others using the domain names we defined above instead of IP adresses.

Setting up Reverse Name Resolution:

In order to be able to get the name of the machine located at IP 192.168.1.X, we need to set up a reverse name zone which is going to be call, in this example 1.168.192.in-addr.arpa,

edit /etc/bind/named.conf.local and add:

zone “1.168.192.in-addr.arpa” {
type master;
notify no;
file “reverse/192.168.1″;
};

This time, wa are going to write the information for reverse dns in a specific directory (“reverse”). Create that directory and edit the zone file:

mkdir /var/cache/bind/reverse
vi  /var/cache/bind/reverse/192.168.1

and copy the following lines:

$TTL 3D
@       IN      SOA     ns.debuntu.foo. chantra.debuntu.foo (
200608051 ; Serial, todays date + todays serial
8H      ; Refresh
2H      ; Retry
4W      ; Expire
1D)     ; Minimum TTL
NS      ns.debuntu.foo

1               PTR     gw.debuntu.foo.
2               PTR     mail.debuntu.foo.
3               PTR     otherbox.debuntu.foo.
5               PTR     ns.debuntu.foo.

now, doing a nslookup on 192.168.1.2 will return mail.debuntu.foo.

Thanks to Author, orignal link http://www.debuntu.org/2006/08/05/85-how-to-setting-up-a-dns-zone-with-bind9