Linux DNS and DHCP Configuration

Source: Internet
Author: User
Tags nameserver

Let's take a look at the linux System DNS and DHCP configurations. I hope this article will be helpful to you.


Install

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

Set the Security enable path

Vi/etc/sysconfig/named

ROOTDIR =/var/named/chroot


Main configuration file

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

Main server path

/Var/named/chroot/var/named/

Secondary server path

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

Complete Set content, can be directly ?? Paste it and make some modifications to use it (below -- for secondary servers)

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

------------------- Main 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.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 53 {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.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. 1;
};
};

Zone "code. 32.163.in-addr. arpa" IN {
Type slave;
File "slave/named. sxhool. rev ";
Masters {
163. 32. Code. 1;
};
};

Include "/etc/rndc. key ";

Restart bKjia. c0m

Service named restart


Check whether there are two files: named. x. rev Reverse Solution and named. x positive solution.

Cd/var/named/chroot/var/named/

The content of the secondary server will be updated with the primary server, and the primary server will be regularly maintained. The secondary server will be in urgent use!

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

$ TTL 86400
@ In soa x.kh.edu.tw. root.x.kh.edu.tw (
2010052730; serial
1 H; refresh
15; retry
14D; expire
12 H; 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 ---------- set the format

$ TTL 86400
@ In soa x.kh.edu.tw. root.x.kh.edu.tw .(
2010052710; serial
1 H; refresh
15; retry
14D; expire
12 H; 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
Installer

Yum-y install dhcp *

Set file note: all network cards must 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 limit 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 at a fixed address fixed host IP

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

}

 

Set the Default GATEWAY

Vi/etc/sysconfig/network

NETWORKING = yes
NETWORKING_IPV6 = yes
HOSTNAME = hostname.kh.edu.tw
GATEWAY = 163.32.x.254

Restart the network

Service network restart

Query server lease files

Vi/var/lib/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.