Fully compile and install BIND-9.2.3 on RHAS3

Source: Internet
Author: User
Fully compile and install BIND-9.2.3 on RHAS3 -- Linux Enterprise Application-Linux server application information. The following is a detailed description. Install BIND9:

# Tar zxvf bind-9.2.3.tar.gz
# Cd bind-9.2.3
#./Configure
-- Prefix =/usr/local/named
Disable-ipv6
# Make
# Make install

Create a BIND User:

# Groupadd bind
# Useradd-g bind-d/usr/local/named-s/sbin/nologin bind

Create a configuration file directory:

# Mkdir? P/usr/local/named/etc
# Chown bind: bind/usr/local/named/etc
# Chmod 700/usr/local/named/etc

Create the main configuration file:

# Vi/usr/local/named/etc/named. conf
====================================== Named. conf =

Acl "trust-lan" {127.0.0.1/8; 192.168.0.0/16 ;};
Options {
Directory "/usr/local/named/etc /";
Pid-file "/var/run/named. pid ";
Version "0.0.0 ";
Datasize 40 M;
Allow-transfer {
"Trust-lan ";};
Recursion yes;
Allow-policy {
"Trust-lan ";
};
Allow-recursion {
"Trust-lan ";
};
Auth-nxdomain no;
Forwarders {
202.99.160.68;
202.99.168.8 ;};
};
Logging {
Channel warning
{File "/var/log/named/dns_warnings" versions 3 size 1240 k;
Severity warning;
Print-category yes;
Print-severity yes;
Print-time yes;
};
Channel general_dns
{File "/var/log/named/dns_logs" versions 3 size 1240 k;
Severity info;
Print-category yes;
Print-severity yes;
Print-time yes;
};
Category default {warning ;};
Category queries {general_dns ;};
};
Zone "."{
Type hint;
File "named. root ";
};

Zone "0.0.127.IN-ADDR. ARPA "{
Type master;
File "localhost ";
};

Zone "home.com "{
Type slave;
File "home.com ";
Masters {
192.168.0.1;
};
};

Zone "0.168.192.in-addr. arpa "{
Type slave;
File "0.168.192.in-addr ";
Masters {
192.168.0.1;
};
};
======================================= Named. conf =

# Vi/usr/local/named/etc/home.com

============================== Home.com ============== ====================
$ TTL 86400
$ ORIGIN home.com.
@ In soa redhat.home.com. root.home.com (
2001111601; serial
28800; refresh
14400; retry
3600000; expire
86400; default_ttl
)
In ns redhat.home.com.

; -- Default address-

@ In a 192.168.0.1

; -- Redhat SerVer --

Redhat in a 192.168.0.1
In mx 0 redhat.home.com.
In mx 10 linux.home.com
In hinfo "redhat as 3.0 ".
In txt "The internet gateway ".

; --- WIN2K SerVer ---

Win2k in a 192.168.0.10
In mx 0 win2k.home.com.
In mx 10 redhat.home.com.
In hinfo "windows 2000 server ".

; ------ Cnames ------

Dns in cname redhat
Www in cname redhat
Mail in cname redhat
Ftp in cname redhat
============================== Home.com ============== ====================

# Vi/usr/local/named/etc/0.168.192.in-addr

=======================================0.168.192.in-addr ==================== ==========
$ TTL 86400
@ In soa redhat.home.com. root.home.home.com .(
2001111601; Serial
28800; refresh
14400; retry
3600000; expire
86400); minimum

@ In ns redhat.home.com.
1 in ptr dns.home.com.
1 in ptr www.home.com.
1 in ptr mail.home.com.
1 in ptr ftp.home.com.
10 in ptr win2k.home.com.
=======================================0.168.192.in-addr ==================== ==========

# Vi/usr/local/named/etc/localhost
====================================== Localhost ================== ====================
$ TTL 3600
@ In soa redhat.home.com. root.home.home.com .(
20040526; Serial
3600; Refresh
900; Retry
3600000; Expire
3600); Minimum
In ns redhat.home.com.
1 in ptr localhost.home.com.
====================================== Localhost ================== ====================

Update the root zone file:

# Cd/usr/local/named/etc/
# Wget ftp://ftp.internic.org/domain/named.root

Create a PID and log file:

# Mkdir/var/run/named/
# Chmod 777/var/run/named/
# Chown bind: bind/var/run/named/

# Mkdir/var/log/named/
# Touch/var/log/named/dns_warnings
# Touch/var/log/named/dns_logs
# Chown bind: bind/var/log/named /*

Generate rndc-key:

# Cd/usr/local/named/etc/
# ../Sbin/rndc-confgen> rndc. conf

In rndc. conf:
# Use with the following in named. conf, adjusting the allow list as needed:
Add the following parts to/usr/local/named/etc/named. conf and remove the comments.

Run the test:

#/Usr/local/named/sbin/named-gc/usr/local/named/etc/named. conf &

Status check:

#/Usr/local/named/sbin/rndc status

Create a STARTUP script:

# Vi/etc/init. d/named
================================ Named. sh ==================================
#! /Bin/bash
#
# Named a network name service.
#
#
# Chkconfig: 545 35 75
# Description: a name server
#
If ['id-U'-ne 0]
Then
Echo "ERROR: For bind to port 53, must run as root ."
Exit 1
Fi
Case "$1" in

Start)
If [-x/usr/local/named/sbin/named]; then
/Usr/local/named/sbin/named-u bind-c/usr/local/named/etc/named. conf & echo. & echo 'bind9 server started .'
Fi
;;

Stop)
Kill 'cat/var/run/named/pid' & echo. & echo 'bind9 server stopped .'
;;
Restart)
Echo.
Echo "Restart BIND9 server"
$0 stop
Sleep 10
$0 start
;;
*)
Echo "$0 start | stop | restart"
;;

Esac
================================== Named. sh ==================================

# Chmod 755/etc/init. d/named
# Chown root: root/etc/init. d/named
# Chkconfig -- add named
# Chkconfig named on
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.