Saturday, May 23, 2009

DHCP and DNS

DHCP

http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/sysadmin-guide/s1-dhcp-configuring-server.html

To configure a DHCP server, modify the configuration file /etc/dhcpd.conf.

DHCP also uses the file /var/lib/dhcp/dhcpd.leases to store the client lease database. Refer to Section 25.2.2 Lease Database for more information.

DNS Bind

Steps to be followed:

Step 1 : Setup /etc/named.conf
Step 2 : Setup named.root
Step 3 : Setup Forward Lookup File
Step 4 : Setup Reverse Lookup File
Step 5 : Setup Loopback File
Step 6 : Setup /etc/nsswitch.conf File
Step 7 : Setup /etc/resolve.conf File
Step 8 : Start BIND & TEST


NOTE : In the following setup Horse is the Machine name and zoo.edu is the Domain name.


Step 1 : Setup /etc/named.conf

options {

DIRECTORY "/var/named";
};
zone "." in {
type hint;
file "named.root";
};

zone "zoo.edu" in {
type master;
file "primary/domain-info";
};

zone "106.3.10.in-addr.arpa" in {
type master;
file "primary/inverse-domain-info";
};

zone "0.0.127.in-addr.arpa" in {
type master;
file "primary/loopback-domain-info";
};

Step 2 : Setup named.root

Copy this file from www.INTERNIC.net to /var/named directory.

[root@horse named]# more named.root
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; temporarily housed at NSI (InterNIC)
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
;
; housed in LINX, operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; temporarily housed at ISI (IANA)
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; housed in Japan, operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File


Step 3 : Setup Forward Lookup File

Create the file called /var/named/primary/domain-info

;Information for the "forward" domain zoo.edu.
;The SOA record must be present and must be first.

@ IN SOA horse.zoo.edu. hostmaster.horse.zoo.edu. (
1 ; Serial number
43200 ; Refresh timer - 12 hours
3600 ; Retry timer - 1 hour
604800 ; Expire timer - 1 week
86400 ; Minimum timer - 1 day
)

; Define name servers for this domain.
IN NS horse.zoo.edu ; primary

; Glue records - needed for secondaries residing in other domains.
; None yet.

; Define name to address mapping for this domain.
horse IN A 10.3.106.118

sweet IN A 10.3.106.200

; CNAME aliases
; None yet.
; Mail exchangers.
; None yet.

; Loopback domain definition (required).
localhost IN A 127.0.0.1

Step 4 : Setup Reverse Lookup File

Create the file called /var/named/primary/inverse-domain-info

; Information for the "inverse' domain 106.3.10.in-addr.arpa.

@ IN SOA horse.zoo.edu. hostmaster.horse.zoo.edu. (
1 ; Serial number
43200 ; Refresh timer - 12 hours
3600 ; Retry timer - 1 hour
604800 ; Expire timer - 1 Week
86400 ; Minimum timer - 1 day
)

; Define name servers for this domain.

IN NS horse.zoo.edu. ; primary

; Define address to name mappings for this domain.

118 IN PTR horse.zoo.edu.
200 IN PTR sweet.zoo.edu.

Step 5 : Setup Loopback File.

Create the file called /var/named/primary/loopback-domain-info

; Information for the loopback domain 127.in-addr.arpa.

@ IN SOA horse.zoo.edu. hostmaster.horse.zoo.edu. (
1 ; Serial number
43200 ; Refresh timer - 12 hours
3600 ; Retry timer - 1 hour
604800 ; Expire timer - 1 week
86400 ; Minimum timer - 1 day
)

; Define name server for this domain.

IN NS horse.zoo.edu.

; Define appropriate mapping for this domain.

1.0.0 IN PTR localhost.zoo.edu.


Step 6 : Setup nsswitch.conf File

Edit /etc/nsswitch.conf and specify in the location

#hosts: db files nisplus nis dns
hosts: files nisplus dns ---- Change it to

hosts: files dns

Step 7 : Setup resolve.conf

/etc/resolve.conf File

search zoo.edu edu
nameserver 10.3.106.118

Step 8 : Start BIND & Test BIND

# service named start

# nslookup
> sweet ( Type the machine name to find out the Internet Address )
Server: 10.3.106.118
Address: 10.3.106.118#53

Name: sweet.zoo.edu
Address: 10.3.106.200

No comments: