Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure dhcp and dns in rhel6

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to configure dhcp and dns in rhel6. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Dhcp configuration

Case

/ etc/dhcp/dhcpd.conf

Subnet 192.168.10.0 netmask 255.255.255.0 {

Range 192.168.10.20 192.168.10.30

Option routers 192.168.10.1

Default-lease-time 600

Max-lease-time 7200

}

Service dhcpd start

Chkconfig dhcpd on

Dns configuration

Case

The company's internal domain name is blog.com, and you need to establish DNS to resolve the hosts in the blog.com domain.

Configuration process:

1. Install the DNS software under RadHad 6

2. Check whether BIND is installed

Rpm-qa | grep bind # query whether bind software is installed

3. If not, use YUM to install

Yum-y install bind*

Will pack three bags.

Bind-utils-9.8.2-0.10.rc1.el6.x86_64

Bind-chroot-9.8.2-0.10.rc1.el6.x86_64

Bind-9.8.2-0.10.rc1.el6.x86_64

After installation, a named user will be generated

4. Modify the master file

/ etc/named.conf

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 {192.168.10.0 Universe 24;}

Recursion yes

The last two sentences of the document

Include "/ etc/named.rfc1912.zones"

Include "/ etc/named.root.key"

Add:

Recursion yes; # search for rotation training

Forward first; / / forward instructs the user to set the working mode of DNS forwarding. You can set "first" or "only". The "first" setting gives priority to using the forwardersDNS server for domain name resolution, and if the query cannot be found, the local DNS server is used for domain name resolution. The "only" setting only uses the forwardersDNS server for domain name resolution. If the query cannot be found, the DNS client query fails. Don't usually write this better.

Forwarders {202.96.128.166 * * 202.96.128.86;}

}

Next, modify

/ etc/named.rfc1912.zones

Zone "localhost.localdomain" IN {# full name resolution of local host

Type master; # type is the primary domain

File "named.localhost"; # Domain configuration files (files are stored in the / var/named directory)

Allow-update {none;}; # client updates are not allowed

}

Make changes to this

Zone "blog.com" IN {

Type master

File "blog.com.zone"

Allow-update {none;}

}

Zone "localhost" IN {# Local Host name Resolution

Type master

File "named.localhost"

Allow-update {none;}

}

Zone "1.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 {# ipv6 local address reverse resolution

Type master

File "named.loopback"

Allow-update {none;}

}

Zone "1.0.0.127.in-addr.arpa" IN {# local address reverse resolution

Type master

File "named.loopback"

Allow-update {none;}

}

Modify this

Zone "10.168.192.in-addr.arpa" IN {

Type master

File "192.168.10.arpa"

Allow-update {none;}

}

Zone "0.in-addr.arpa" IN {# local network-wide address reverse resolution (and / domain update)

Type master

File "named.empty"

Allow-update {none;}

}

/ var/named/named.localhost file analysis

$TTL 1D # updated to a maximum of 1 day

@ (domain name of domain) IN SOA (authoritative DNS server) @ (name of authoritative DNS server) rname.invalid. (email from rname@invalid) (

0; serial # domain version number, the primary domain version number must be larger than the secondary domain version number before the secondary domain will be synchronized.

1D; refresh # secondary domain name server refresh time

1H; retry # secondary domain name server redetection time

1W; expire # secondary domain name server abandons detection time

3H); minimum # valid minimum lifetime # these five parameters are used to control the communication between the secondary domain name service and the primary domain name service

NS (Domain name Server) @ (Domain name Server name)

A (forward parsing) 127.0.0.1 (forward parsing ip)

AAAA (ipv6 forward parsing):: 1 (ip of ipv6 forward parsing)

Cd / var/named

Cp-p named.localhost blog.com.zone

Cp-p named.localhost 192.168.10.arpa

Then modify the blog.com.zone

[root@test1 named] # cat blog.com.zone

$TTL 1D

@ IN SOA @ rname.invalid. (

0; serial

1D; refresh

1H; retry

1W; expire

3H); minimum

NS @

A 127.0.0.1

AAAA:: 1

Test1 A 192.168.10.119

DNS1 CNAME test1

Ftp A 192.168.10.119

Mail A 192.168.10.119

Test2 A 192.168.10.27

@ MX 5 mail.blog.com.

$GENERATE 10-50 test$ A 192.168.10.$

2. Restart the named service

Service named restart

Chkconfig named on

Netstat-anpl | grep: 53

3. The client does the test.

The client does not need to configure / etc/hosts

Just configure / etc/resolv.conf

# cat / etc/resolv.conf

; generated by / sbin/dhclient-script

Search blog.com

Nameserver 192.168.10.119

Forward analysis

Do intra-domain host resolution of blog.com

1 、 nslookup

# nslookup

> test1.blog.com

Server: 192.168.10.119

Address: 192.168.10.119#53

Name: test1.blog.com

Address: 192.168.10.119

> test2.blog.com

Server: 192.168.10.119

Address: 192.168.10.119#53

Name: test2.blog.com

Address: 192.168.10.27

2 、 dig

# dig test2.blog.com

; DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 test2.blog.com

;; global options: + cmd

;; Got answer:

;;-> > HEADER

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report