Showing posts with label DNS Server. Show all posts

Implementation of a DNS Server running Windows Server 2008 Or 2008 R2



  Implementation of a DNS Server running Windows Server 2008 Or 2008 R2

 ________________________________________

Follow us on Facebook

Follow us on Google+

________________________________________

 Introduction :


At the heart of this post, I invite you to see the implementation of a DNS server running Windows Server 2008 or 2008 R2. In fact in 2008 or 2008 R2 manipulations are relatively the same.

Firstly and as an introduction I suggest you see or review the solutions offered by Windows Server for name resolution. Many of you already have the DNS word to mouth. But not only offers Windows DNS solution as there are three distinct solutions!

The first solution is LLMNR is Link Local Multicast Name Resolution. This solution has two weaknesses pale DNS (Domain Name System). The first weakness is that for name resolution via DNS, you have a DNS infrastructure (server and client (s)). Or in a local network, in business, it can be interesting to be able to connect to a machine via a UNC (Universal Naming Convention) rather than its IP address. LLMNR proposes that, by activating the iPv6 and "Network Discovery" (can be enabled in the network center eet sharing). So once its IPv6 and Network Discovery enabled LLMNR can do name resolution. To connect to a machine named PC-Lolokai just type "\ \ PC-Lolokai" (This is the UNC machine).


The second solution is NetBios, which has the same purpose but LLMNR works with IPv4 addresses, and especially with machines running XP or even earlier. NetBios is a service name and a protocol that will be used for compatibility with older Windows network services. LLMNR as it works locally allows for hostname resolution in IPv4 address, it can also "ping" a machine via its UNC. NetBios is enabled by default on a Windows machine.

The last solution is the most common DNS: Domain Name System. DNS resolves names him and supports Internet Services Active Directory domains. This solution is fundamental in a corporate network more or less consistent. That is why we will see step by step how to set up a DNS server. For this post we will start a Member Server standalone ie not install it on our DNS Server Active Directory domain controller.

In writing this post I had some little trouble at VmWare. So I used the machine in the cloud and thank you for this great invention that is the cloud! : D Do not be shocked if you see the screenshots in this post shows a system in English. So I use a machine running Windows Server 2008 R2 in a Workgroup named insert lolokai.local and the machine is called ServeurDNS.


 Installation :



First we must add the role "DNS Server" to our server. For this Start -> All Programs -> Administrative Tools -> Server Manager. You "Add a role" and select DNS Server:
 



Now the role is installed you just need to configure it.

 






 

First we check on how our listening interface DNS server. By default, it listens on all IP addresses associated with the local computer. It is important for you to change: Start -> All Programs -> Administrative Tools -> DNS -> Right click on your DNS server -> Properties -> tab interface.








Then we check if there are root servers, because if our DNS server has not identified the root server, it can only resolve addresses of their network or subnet. For this tab "indicator root."












Then you need to configure a redirection, ie if our DNS server can respond to the request it redirects the request to another DNS server. So we must learn the IP address of the DNS forwarder. Go to the tab "Redirector".

  






We will go to one of the most important steps the creation area. Indeed, the DNS server works with zones, you create a zone or a namespace where you inform the DNS addresses that should be able to solve.

For this Start -> All Programs -> Administrative Tools -> DNS -> Right click on your DNS server -> New Zone.



Then you will get a window to select what type of area you want to create. It is therefore important to know what areas exist and why?

There are 3 zones: primary, secondary and area stub area.

     The primary zone: when you set a primary zone in DNS server, it is said that in this area he is the "master DNS" zone. This means that this area is what DNS server that has the master zone file ("file example"). The DNS server has full authority over the zone file it is he who edits it and he can read to answer the query.
     The secondary zone: this is when information on our DNS zone already created. He indicates the zone and the zone file master he has the right to read only to meet the request. Only having to create DNS zone as the primary write access. Using this procedé to alleviate traffic when there is a area where a lot of DNS query.
     The stub zone: This zone is very similar to the second zone, the only difference is that it only keeps a copy of the zone file. It does not name resolution, its purpose is just to have a copy of the updated file.

Be chosen for example to create a primary zone and disable recording in the Active Directory as my machine is not connected to any AD.





Once the zone type selected, we are asked to choose whether you want a 'lookup zone "or a" reverse lookup zone. "

     Forward Lookup Zone: The DNS server maps the fully qualified domain name (FQDN) to an IP address.
     Reverse lookup zone: the DNS server matches the IP address FQDN, it must be reversed for the first 3 octets of the IP address and add "in-addr.arpa." Eg to create a reverse zone on the subnet 192.168.1.0/24 is actually a reverse zone whose address will 1.168.192.in-addr.arpa.

For good name resolution in an area are strongly advised to make an area and its reverse zone. So we decided to start lookup zone.


Then we are asked to choose the name of the zone, you may notice that your machine follows the domain name name of our area. Example is in my machine is integrated so there is no field to succeed ". Dns".

Then the utility allows you to create a zone file or use an existing file. In our case we ask to learn and create a file that will edit later.


Once the file is created, we arrive at a window that invites us to make up-to-date. In fact, it is to make up-to-date our zone file. Can allow dynamic updates are allowed machines to be members of the Active Directory and only them to transmit up-to-day zone file. Either we allow all machines to do so. Or otherwise asked not to update to update the zone file this is what we do in the example.

Now our area is created, but it is essential in an area to have two types of registration SOA (Start of Authority) and NS (Name Server).

  • SOA: Defines the basic properties of our zone. Indeed when a zone is created, you must also create its property: ID, main server ...
  • NS: Defines the name servers authoritative for the zone, a secondary server, root server ...
 To access the recording, right-click on the zone in the DNS Manager -> Properties. In the window You can modify the default settings manually or add SOA nameserver.


/!\ ATTENTION: 

the serial number in the SOA can not be invented! It is incremented every time a resource record (mail server, name server ..). It is essential not to touch it because this ID will allow secondary servers whether they have the correct zone file. If the serial numbers do not provide the DNS zone file "master" (where the DNS zone is configured as primary) is sent to the secondary servers.
 



Now that you have changed your SOA and NS you can add your different machines you have in your network. For this you have 3 options of resource record, a host A or AAAA, CNAME alias or a mail exchanger MX.
  • A or AAAA host: lets just resolve the name of a machine via its IP address. A just means we're talking about an IPv4 address and an IPv6 address AAAA.
  • CNAME alias: as its name suggests it allows you to create aliases. Indeed it can be called a resource alias eg retrieve ftp "ftp1.lolokai.com" to "ftp.lolokai.com."
  • MX Mail Exchanger: simply allows to determine a mail server.
To do this you simply right click on the area and to add or CNAME or MX host.


We implemented a DNS primary zone file. You should be able to do it again with your machines, your IP, your recordings. Last warning we have a zone file but it is only half the work! To make the DNS resolution IP -> FQDN and FQDN -> IP it is essential to create a reverse zone! For this as indicated at the beginning it will be the same records by reversing the first 3 bytes and add "in-addr.arpa."


Conclusion :


We have seen this post through the implementation of a DNS server in Windows Server 2008, as well as different records that we may link.

Installing a DNS server Linux + Video

 ________________________________________

Follow us on Facebook

Follow us on Google+

________________________________________

Présentation:


 DNS (Domain Name System) is used to make the correspondence between the IP address and machine name, it is called name resolution (to resolve into English). More concretely without DNS you would have to directly type the IP addresses of machines on which you want to access (web, ftp, telnet and others). If you are connected to an internet service provider (ISP) intermittently by PPP, ADSL or other, it's usually your ISP's DNS servers that provide name resolution, they usually go in pairs, one finds a primary DNS server and a secondary that is there in case of failure of the first.Now why configuring a DNS server on an isolated post, even on a small network of machines, because it can be used to solve a number of very annoying problems mostly found in off-line mode (not connected to the ISP ) including:- Launch of endless netscape or blocking at boot (for a period of 3min)- Sending mails in the folder waiting for sendmail that lasts more than a minute.But also if you have enabled ipmasquerade to share your Internet connection for your client, a DNS server allows them to surf and use the network tools (telnet, ftp, ...). Assume that your Linux machine, is called myhost and has IP address 192.168.13.10 (your private domain and not assigned by ISP) and your privacy mondomaine.fr. Trees presented (especially in the autostart) are those of a Mandrake (a priori as a RedHat).I will not go into details of the configuration files that you have the DNS-HOWTO (linux section and HOW-TO) which is a good introduction. This page is not intended to substitute for that document, it produces a summary to install a DNS server quickly, for detailed explanations see the HOWTO. It is primarily intended to an isolated post or even a small network connected in a non-permanent Internet.Note: If you do not know the IP addresses of DNS servers of your ISP, if automatic assignment of these addresses, for example, just log in and read the addresses at the nameserver lines.



Installing and configuring the server :


has set up a DNS server requires the installation of two tools bind and named. It concerns a Mandrake packages bind, caching-nameserver and bind-utils.
Linux for a client it will only benefit from the latest package for the host or dig commands. The installation created a file
/ etc / named.conf which is as follows: // generated by named-bootconf.pl

// secret must be the same as in /etc/rndc.conf
key "key" {
        algorithm       hmac-md5;
        secret
"c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
};
controls {
    inet 127.0.0.1 allow { any; } keys { "key"; };
};

options {
        pid-file "/var/run/named/named.pid";
        directory "/var/named";
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        // query-source address * port 53;
};
//
// a caching only nameserver config
//
zone "." {
        type hint;
        file "named.ca";
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "named.local";
};
On va le modifier pour lire:
// secret must be the same as in /etc/rndc.conf
key "key" {
        algorithm       hmac-md5;
        secret
"c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
};
controls {
    inet 127.0.0.1 allow { any; } keys { "key"; };
};
options {
        pid-file "/var/run/named/named.pid";
        directory "/var/named";
        /*
         * If there is a firewall between you and nameservers you want
         * to talk to, you might need to uncomment the query-source
         * directive below.  Previous versions of BIND always asked
         * questions using port 53, but BIND 8.1 uses an unprivileged
         * port by default.
         */
        // query-source address * port 53;
        // on va mettre ici l'adresses IP des serveurs DNS de vos FAI, votre serveur relaiera les requêtes à ceux-ci
        // s'il n'est pas capable de les résoudre
        forward first;
        forwarders {
                194.149.160.9;
                194.149.160.1;
        };
};
//
// a caching only nameserver config
//
zone "." {
        type hint;
        file "named.ca";
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "named.local";
};
zone "mondomaine.fr" {
        type master;
        file "mondomaine.fr";
};
 The installation created a directory / var / named containing named.local
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      localhost.
1       IN      PTR     localhost.
On le modifiera pour lire:
@       IN      SOA     mamachine.mondomaine.fr. root.mamachine.mondomaine.fr.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      mamachine.mondomaine.fr.
1       IN      PTR     localhost.
On créera sous /var/named un fichier mondomaine.fr contenant:
@       IN      SOA     mamachine.mondomaine.fr. root.mondomaine.fr.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
                                TXT             "mondomaine.fr mon ch'tit domaine"
                NS      mamachine
                                NS              mamachine.mondomaine.fr.
                                MX              10 mamachine
                                MX              20 mamachine.mondomaine.fr.

localhost               A               127.0.0.1
mamachine            A               192.168.13.10
Give this file named group named
chown named:named mondomaine.fr
FYI MX thus corresponds to the SMTP server to your machine if you are running sendmail.
Now in the / etc / nsswitch.conf must have it to the hosts line:

hosts: files dns
The DNS-HOWTO request the creation of a file / etc / host.conf containing
order hosts,bind
multi on

I do not know if it is absolutely necessary, it seems redundant with nsswitch.conf, but just in case.
To complete the / etc / resolv.conf:

search mondomaine.fr
nameserver 127.0.0.1
nameserver 194.149.160.9
nameserver 194.149.160.1
The last two IP addresses are obviously those of your favorite ISP. Note that in the case of an intermittent connection with ppp with automatic assignment of IP addresses of DNS servers, you can not change the last two lines, they are automatically populated when the connection.

Autostart of named

For a server installation on Mandrake, the configuration of the DNS server start automatic installation, you can skip this chapter. The default install of bind and named automatically generates startup files, just in case here are the details. You will find in / etc / rc.d / init.d named file has the following contents:
#!/bin/sh
#
# named           This shell script takes care of starting and stopping
#                 named (BIND DNS server).
#
# chkconfig: 345 55 45
# description: named (BIND) is a Domain Name Server (DNS) \
# that is used to resolve host names to IP addresses.
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/named ] || exit 0
[ -f /etc/named.conf ] || exit 0
# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting named: "
        daemon named
        echo
        touch /var/lock/subsys/named
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down named: "
        killproc named
        rm -f /var/lock/subsys/named
        echo
        ;;
  status)
        /usr/sbin/ndc status
        exit $?
        ;;
  restart)
        /usr/sbin/ndc restart
        exit $?
        ;;
 reload)
        /usr/sbin/ndc reload
        exit $?
        ;;
  probe)
        # named knows how to reload intelligently; we don't want linuxconf
        # to offer to restart every time
        /usr/sbin/ndc reload >/dev/null 2>&1 || echo start
        exit 0
        ;;
  *)
        echo "Usage: named {start|stop|status|restart}"
        exit 1
esac
exit 0
The DNS server is automatically started at power-on state 3, 4 and 5. It will still run after the installation by typing

/etc/rc.d/init.d/named start

To restart named (after a file change), you would type:
/ etc / rc.d / init.d / named restart
The other arguments are start, stop, restart and status.

Client Configuration:


Linux for a client, just create an / etc / resolv.conf containing

domain mondomaine.fr
nameserver 192.168.13.10


You replace it by the address of your server.

Do the same for windows clients, at the Panel and then Network icon.



Function tests:

From a Linux client or server host type the command in a shell, controls typing appear in italics: host -a mamachine
Trying "mamachine.mondomaine.fr"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33741
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;mamachine.mondomaine.fr.             IN      ANY
;; ANSWER SECTION:
mamachine.mondomaine.fr.      86400   IN      A       192.168.25.75
;; AUTHORITY SECTION:
mondomaine.fr.              86400   IN      NS      mamachine.mondomaine.fr.
Received 65 bytes from 127.0.0.1#53 in 15 ms
Then type:
host -a mondomaine.fr
Trying "mondomaine.fr"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47095
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;mondomaine.fr.                     IN      ANY
;; ANSWER SECTION:
mondomaine.fr.              86400   IN      SOA     mamachine.mondomaine.fr. root.mondomaine.fr. 1997022700 28800 14400 3600000 86400
mondomaine.fr.              86400   IN      TXT     "mondomaine.fr mon ch'tit domaine"
mondomaine.fr.              86400   IN      NS      mamachine.mondomaine.fr.
mondomaine.fr.              86400   IN      MX      10 mamachine.mondomaine.fr.
mondomaine.fr.              86400   IN      MX      20 mamachine.mondomaine.fr.
;; ADDITIONAL SECTION:
mamachine.mondomaine.fr.      86400   IN      A       192.168.25.75
Received 179 bytes from 127.0.0.1#53 in 21 ms
Once connected, a client or server type
host -a www.shom.fr
Trying "www.shom.fr."
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12287
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3
;; QUESTION SECTION:
;www.shom.fr.                   IN      ANY
;; ANSWER SECTION:
www.shom.fr.            217813  IN      CNAME   cyclone.shom.fr.
;; AUTHORITY SECTION:
shom.fr.                330241  IN      NS      neree.shom.fr.
shom.fr.                330241  IN      NS      resone.univ-rennes1.fr.
shom.fr.                330241  IN      NS      dns.univ-lyon1.fr.
;; ADDITIONAL SECTION:
dns.univ-lyon1.fr.      317766  IN      A       134.214.100.6
neree.shom.fr.          330241  IN      A       194.57.228.65
resone.univ-rennes1.fr. 300271  IN      A       129.20.254.1
Received 182 bytes from 192.168.25.75#53 in 157 ms

Le ping should work also.

From a position of windows to test your server in a Windows command prompt type
nslookup
At the prompt, type the name of machine under test

>www.shom.fr
Serveur: Unknown
Address: 192.168.26.75
Réponse de source secondaire :
Nom: cyclone.shom.fr
Address: 194.57.228.1
Aliases: www.shom.fr
Type CTRL + C to exit promptly at t

Create virtual hosts

You can create virtual hosts with your DNS server, in other words, your server may be identiifé by several names, it is particularly interesting for apache. With a different name that points to the same machine, however, we can point to different locations.
Suppose we want to create virtual hosts
www.idefix.mondomaine.fr et www.asterix.mondomaine.fr, on rajoutera à la fin du fichier /var/named/mondomaine.fr, the following lines:www.asterix    A    192.168.13.11
www.idefix      A    192.168.13.11
Restart the server by typing:
/etc/rc.d/init.d/named restart
To test a customer type in a shell:
ping www.asterix.mondomaine.fr
It should work.