Linux system DNS and DHCP configuration detailed

Source: Internet
Author: User
Tags nameserver


Installation

Yum install bind bind-chroot bind-libs bind-utils caching-nameserver

Set security enabled Path

Vi/etc/sysconfig/named

Rootdir=/var/named/chroot


Main set File

Vi/var/named/chroot/etc/named.conf

Primary server Path

/var/named/chroot/var/named/

Secondary server path

/var/named/chroot/var/named/slave

Complete set content, can direct?? posted, and slightly modified to use (hereinafter--secondary server)

Vi/var/named/chroot/etc/named.conf

-------------------Primary Server-----

Options {
        directory       "/var/ Named ";
        dump-file       "/var/named/data/ Cache_dump.db ";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        allow-query     {any;};
        recursion yes;

Forwarders {
163.28.136.14;
163.28.136.2;
163.28.136.10;
};

Allow-transfer {
163.28.136.14;
163.28.136.2;
163.28.136.10;
};

};

Controls {
inet 127.0.0.1 allow {localhost;} keys {rndckey;};
};

Logging {
Channel Default_debug {
File "Data/named.run";
Severity dynamic;
};
};

Zone "." in {
Type hint;
File "named.ca";
};


Zone "Localdomain" in {
Type master;
File "Localdomain.zone";
allow-update {none;};
};


Zone "localhost" in {
Type master;
File "Localhost.zone";
allow-update {none;};
};


Zone "0.0.127.in-addr.arpa" in {
Type master;
File "Named.local";
allow-update {none;};
};


Zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
Type master;
File "Named.ip6.local";
allow-update {none;};
};

Zone "255.in-addr.arpa" in {
Type master;
File "Named.broadcast";
allow-update {none;};
};


Zone "0.in-addr.arpa" in {
Type master;
File "Named.zero";
allow-update {none;};
};

Zone "school.kh.edu.tw" in {
Type master;
File "Named.school";
allow-update {none;};
};

Zone "X.32.163.in-addr.arpa" in {
Type master;
File "Named.school.rev";
allow-update {none;};
};

Include "/etc/rndc.key";

-------------------Secondary Server-----

Options {
listen-on port {any;};
Listen-on-v6 Port 53 {:: 1;};
Directory "/var/named";
Dump-file "/var/named/data/cache_dump.db";
Statistics-file "/var/named/data/named_stats.txt";
Memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query {any;};
recursion Yes;

Forwarders {
163.28.136.14;
163.28.136.2;
163.28.136.10;
};

};

Controls {
inet 127.0.0.1 allow {localhost;} keys {rndckey;};
};

Logging {
Channel Default_debug {
File "Data/named.run";
Severity dynamic;
};
};

Zone "." in {
Type hint;
File "named.ca";
};

Zone "Localdomain" in {
Type master;
File "Localdomain.zone";
allow-update {none;};
};


Zone "localhost" in {
Type master;
File "Localhost.zone";
allow-update {none;};
};


Zone "0.0.127.in-addr.arpa" in {
Type master;
File "Named.local";
allow-update {none;};
};


Zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" in {
Type master;
File "Named.ip6.local";
allow-update {none;};
};

Zone "255.in-addr.arpa" in {
Type master;
File "Named.broadcast";
allow-update {none;};
};


Zone "0.in-addr.arpa" in {
Type master;
File "Named.zero";
allow-update {none;};
};

Zone "school.kh.edu.tw" in {
Type slave;
File "Slave/named.x.rev";
masters{
163.32. Code number. 1;
};
};

Zone "code. 32.163.in-addr.arpa" in {
Type slave;
File "Slave/named.sxhool.rev";
masters{
163.32. Code number. 1;
};
};

Include "/etc/rndc.key";

Reboot 111cn.net

Service named restart


Check for Named.x.rev and named.x solutions two files

cd/var/named/chroot/var/named/

The contents of the secondary server are updated with the main server, maintaining the primary server on a regular basis, and the secondary server for emergency use!

----------Named.shsps----------

$TTL 86400
@ in SOA x.kh.edu.tw. ROOT.X.KH.EDU.TW (
2010052730; Serial
1H; Refresh
15; Retry
14D; Expire
12H; Minimum 111cn.net
)


@ in MX 1 mail.x.kh.edu.t
@ in NS x.kh.edu.tw.
@ in NS dns.x.kh.edu.tw.
@ in A 163.32.x.1
DNS in A 163.32.x.1
FTP in A 163.32.x.2

www in CNAME ftp.x.kh.edu.tw.

----------Named.shsps.rev----------Format

$TTL 86400
@ in SOA x.kh.edu.tw. root.x.kh.edu.tw. (
2010052710; Serial
1H; Refresh
15; Retry
14D; Expire
12H; Minimum
)
@ in NS x.kh.edu.tw.
@ in NS dns.x.kh.edu.tw.
1 in PTR x.kh.edu.tw.
2 in PTR www.x.kh.edu.tw.

DHCP server
Setup program

Yum-y Install dhcp*

Set the file, and the network card has to be set.

Vi/etc/dhcpd.conf

Ddns-update-style Interim;
Ignore client-updates;

Subnet 163.32.x.0 netmask 255.255.255.0 {
}


Subnet 192.168.1.0 netmask 255.255.255.0 {
}


Subnet 192.168.2.0 netmask 255.255.255.0 {

#---Default gateway
Option routers 192.168.1.1;
Option Subnet-mask 255.255.255.0;
Option broadcast-address 192.168.1.255;

Option Domain-name "dns.xxx.kh.edu.tw";
Option Domain-name-servers 163.32.x.1,140.117.11.1,168.95.1.1;
Option Netbios-name-servers 163.32.x.1;
Option time-offset-18000; # Eastern Standard Time
Option Netbios-node-type 8;
Range DYNAMIC-BOOTP 192.168.1.11 192.168.1.239;
Default-lease-time 216000;
Max-lease-time 432000;

# We want the nameserver to appear in a fixed host IP

Host shsps00001{
Hardware Ethernet 00:13:d4:9c:3d:6a;
Fixed-address 163.32.x.10;
}

}

Set Preset Gateway

Vi/etc/sysconfig/network

Networking=yes
Networking_ipv6=yes
hostname=hostname.kh.edu.tw
gateway=163.32.x.254

Restart Network

Service Network restart

Check server lease file

Vi/var/lib/dhcpd/dhcpd.leases

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.