Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

Install DNS server in centOS 5.5

Leer en espanol
Install DNS server in centOS 5.5

Table of contents

It is the name resolution protocol for TCP/IP networks, such as the Internet. A DNS server hosts information that allows client computers to easily resolve alphanumeric DNS names. ===

WHAT IS DNS?

It is the name resolution protocol for TCP/IP networks, such as the Internet. A DNS server hosts information that allows client computers to resolve easy-to-remember alphanumeric DNS names to the IP addresses that computers use to communicate with each other.

DNS domain type

TOP LEVEL DOMAIN: A two- or three-letter name used to indicate a country, region, or the type of organization that uses a name: ( ANDexample: “.com” )

SECOND LEVEL DOMAIN: Variable length registered name that an individual or organization uses and the Internet. These names are always based on an appropriate top-level domain, depending on the type of organization or geographic location where the name is used. (EXAMPLE: “NETWORK-ORBITA.”)

SUBDOMAIN: Additional names that an organization can create derived from the second-level registered domain name. These include names added to develop the DNS name tree into an organization and divide it into departments or geographic locations. (EXAMPLE: “ROKITOH.RED-ORBITA.COM”)


Configure static addressing

To do this, first we are going to configure a static addressing.

The network card configuration files are located in: /etc/sysconfig/network-scripts/

We access the folder:

Bash
[rokitoh@red.orbita.com~] # cd /etc/sysconfig/network-scripts/

we configure the file ifcfg-eth0 which is where the information is found

Bash
[rokitoh@red.orbita.com network-scripts] # nano ifcfg-eth0

y alli lo configuramos:

text
DEVICE=eth0

BOOTPROTO=static #configuración estatica

BROADCAST=192.168.1.255 #dirección de broadcast

HWADDR=05:02:4A:5C:EE:9F # Dirección MAC

IPADDR= 192.168.1.150 # Ip de la interfaz de red

NETMASK= 255.255.255.0 # Máscara de red

NETWORK= 192.168.1.0 # Red en la que se encuentra

ONBOOT=yes # Arranque automático al inicio del sistema
HOSTNAME=dns1.redorbita.local

GATEWAY= 192.168.1.1 # Puerta de enlace

TYPE=Ethernet

Configure the /etc/hosts file

We access the directory

Bash
[rokitoh@red.orbita.com~] nano /etc/hosts

we add the addressing of our IP

text
# Do not remove the following line, or various programas
# that require network functionality will fail.
127.0.0.1             localhost.localdomain                 localhost
192.168.1.150     dns1.redorbita.local                    dns1
::1                         localhost6.localdomain6             localhost6

Configuring the /etc/sysconfig/network file

text
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=dns1.redorbita.local

>Configuring the file /etc/resolv.conf
[rokitoh@red.orbita.com~] nano /etc/resolv.conf

We add our domain and the IP address of the DNS server

search redorbita.com

nameserver 192.168.1.150

We restart the network:

Bash
[rokitoh@red.orbita.com~] # /etc/init.d/network restart

We verify that the changes have been made:

Bash
[rokitoh@red.orbita.com~] # sbin/ifconfig

Install and configure Bind9

Bash
[rokitoh@red.orbita.com~] yum install bind bind-utils bind-libs bind-chroot caching-nameserver
CODE
text

Configure the zone file
We go to the folder
Bash
[rokitoh@red.orbita.com~] cd /var/named/chroot/var/named/
We copy to the file
Bash
[rokitoh@red.orbita.com  named] cp named.zone redorbita.local.zone
We configure the created zone. It should look more or less like this: 
text
$TTL      1W
@             IN      SOA     dns1.redorbita.local.       root.redorbita.local (
2               ; Serial Number
1W            ; Time To Refresh
1D             ; Time To Retry
28D           ; Time To Expire
1W )         ; Negative Cache TTL
@       IN         NS           dns1     #Nombre del servidor DNS
@     IN         A           192.168.1.150      #IP servidor DNS HOST
dns1   IN         A     192.168.1.150
www     IN         A        redorbita.local            #Nombre servidor web
Now let's create the inverse zone
We copy the file
Bash
[rokitoh@red.orbita.com named] cp named.local 1.168.192.in-addr.arpa.zone
We access the file 
Bash
[rokitoh@red.orbita.com named] nano 1.168.192.in-addr.arpa.zone
We configure the file
text
$TTL     1W
@        IN      SOA     dns1.redorbita.local.       root.redorbita.local (
2               ; Serial Number
1W            ; Time To Refresh
1D             ; Time To Retry
28D           ; Time To Expire
1W )         ; Negative Cache TTL
@         IN       NS              dns1,redorbita.local
150       IN       PTR             dns1.redorbita.local
The number «150» corresponds to the last octet of the IP address of our server. In my case the IP address is: 192.168.1.150 
Creation and configuration of the file “named.conf”
We access the folder: 
Bash
[rokitoh@red.orbita.com etc] cd /var/named/chroot/etc

We create the file:

Bash
[rokitoh@red.orbita.com etc] touch named.conf

Once created make sure to add the following owners

Bash
[rokitoh@red.orbita.com etc] chown root:named named.conf

Now we are going to configure the created file "named.conf"

Bash
[rokitoh@red.orbita.com etc] nano named.conf

We add the following:

text
options { directory «/var/named/»; dump-file «/var/named/data/cache_dump.db»; statistics-file «/var/named/data/named_stats.txt»; allow-recursion { 127.0.0.1; 192.168.1.0/24; }; forwarders { 200.33.146.209; 200.33.146.217; }; forward first; }; zone «.» { type hint; file «named.ca»; }; zone «localhost» { type master; file «localhost.zone»; allow-update { none; }; }; zone «redorbita.local» { type master; file «redorbita.local.zone»; allow-update { none; }; }; zone «1.168.192.in-addr.arpa» { type master; file «1.168.192.in-addr.arpa.zone»; allow-update { none; }; };

We restart the service.

text
/etc/init.d/named restart Deteniendo named:  [OK] Iniciando named: [OK]

To verify that bind is loading the zones, we must execute the following command

Bash
[rokitoh@red.orbita.com etc] tail -80 /var/log/messages | grep named

We verify that everything has gone well:

Bash
[rokitoh@red.orbita.com etc] host redorbita.local 192.168.1.150 [rokitoh@red.orbita.com etc] dig @192.168.1.150 redorbita.local [rokitoh@red.orbita.com etc] dig @192.168.1.150 redorbita.local NS
CODE
text

Well, we have already finished the installation and configuration of a DNS server in CentOS 5.5, I hope it has been helpful to you,
CODE
text
CODE
text
Regards, rokitoh 

Comments