Configure DNS server for get IP from DHCP.

Issues related to configuring your network
hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/08/30 10:56:02

Hello.
I want to configure my Linux DNS server in CentOS 7, I found below tutorial :

http://www.unixmen.com/setting-dns-server-centos-7/

but in this tutorial, Client have specific IP address and name but I don't know my clients IP and computer name because my clients take IP from DHCP server.
How can I configure my DNS server for DHCP?

Thank you.

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/08/30 11:08:51

I found below tutorial too :

http://www.server-world.info/en/note?os=CentOS_7&p=dns

but I got error :

# systemctl restart named
Job for named.service failed. See 'systemctl status named.service' and 'journalctl -xn' for details.
[root@localhost mohsen]# systemctl status named.service
named.service - Berkeley Internet Name Domain (DNS)
Loaded: loaded (/usr/lib/systemd/system/named.service; disabled)
Active: failed (Result: exit-code) since Sun 2015-08-30 07:05:20 EDT; 2min 34s ago
Process: 4010 ExecStartPre=/usr/sbin/named-checkconf -z /etc/named.conf (code=exited, status=1/FAILURE)

Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: zone 0.in-addr.arpa/IN: loaded serial 0
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: zone linux.dj/IN: loading from master file l...nd
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: zone linux.dj/IN: not loaded due to errors.
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: external/linux.dj/IN: file not found
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: zone 80.0.16.172.in-addr.arpa/IN: loading fr...nd
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: zone 80.0.16.172.in-addr.arpa/IN: not loaded...s.
Aug 30 07:05:20 localhost.localdomain named-checkconf[4010]: external/80.0.16.172.in-addr.arpa/IN: file n...nd
Aug 30 07:05:20 localhost.localdomain systemd[1]: named.service: control process exited, code=exited status=1
Aug 30 07:05:20 localhost.localdomain systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
Aug 30 07:05:20 localhost.localdomain systemd[1]: Unit named.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/08/30 11:12:35

My config is :

Code: Select all

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
	listen-on port 53 { 127.0.0.1; 192.168.72.1; };
#	listen-on-v6 port 53 { none; };
	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     { localhost; 192.168.72.0/24; };

	/* 
	 - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
	 - If you are building a RECURSIVE (caching) DNS server, you need to enable 
	   recursion. 
	 - If your recursive DNS server has a public IP address, you MUST enable access 
	   control to limit queries to your legitimate users. Failing to do so will
	   cause your server to become part of large scale DNS amplification 
	   attacks. Implementing BCP38 within your network would greatly
	   reduce such attack surface 
	*/
	recursion yes;

	dnssec-enable yes;
	dnssec-validation yes;
	dnssec-lookaside auto;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.iscdlv.key";

	managed-keys-directory "/var/named/dynamic";

	pid-file "/run/named/named.pid";
	session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

view "internal" {
        match-clients {
                localhost;
                192.168.72.0/24;
        };
        zone "." IN {
                type hint;
                file "named.ca";
        };
        zone "linux.dj" IN {
                type master;
                file "linux.dj.lan";
                allow-update { none; };
        };
        zone "0.0.10.in-addr.arpa" IN {
                type master;
                file "0.0.10.db";
                allow-update { none; };
        };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
};

view "external" {
        match-clients { any; };
        allow-query { any; };
        recursion no;
        zone "linux.dj" IN {
                type master;
                file "linux.dj.wan";
                allow-update { none; };
        };
        zone "80.0.16.172.in-addr.arpa" IN {
                type master;
                file "80.0.16.172.db";
                allow-update { none; };
        };
};

lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Configure DNS server for get IP from DHCP.

Post by lightman47 » 2015/09/05 11:35:50

Not what you actually asked for, but how about configuring your DHCP server to assign reserved addresses to machines that often connect to your network? This makes them appear 'static' on your network, but acquire addresses correctly elsewhere.

User avatar
InitOrNot
Posts: 122
Joined: 2015/06/10 18:26:51

Re: Configure DNS server for get IP from DHCP.

Post by InitOrNot » 2015/09/05 22:00:00

hack3rcon wrote:How can I configure my DNS server for DHCP?
No special configuration should be needed. Or perhaps you want your DNS server to dynamically update the "DNS zone" with the names of the DHCP clients in the LAN, as they come and go?

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/09/06 07:04:12

I just want to configure a DNS server for local network. Something like Windows DNS server. Can I specific "Internal" and "External" part? I don't know why I must have "Internal" or "External" ?

User avatar
InitOrNot
Posts: 122
Joined: 2015/06/10 18:26:51

Re: Configure DNS server for get IP from DHCP.

Post by InitOrNot » 2015/09/06 08:30:40

hack3rcon wrote:I just want to configure a DNS server for local network. Something like Windows DNS server. Can I specific "Internal" and "External" part? I don't know why I must have "Internal" or "External" ?
If you want the DNS server for your internal LAN to behave like the Windows DNS service does in an Active Directory environment, then I understand that you want is "DNS dynamic updates", and for that you should research how to integrate the DNS service with the DHCP service.

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/09/06 09:00:35

Thank you and It is my problem.
I can't find a good tutorial :(
most of tutorials configure DNS for web server and they have Zone and...
I want to know must I define Internal or External?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Configure DNS server for get IP from DHCP.

Post by TrevorH » 2015/09/06 10:51:30

You only need an external view if you aim to expose your DNS server to external clients (i.e ones that are not part of your LAN)
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

Re: Configure DNS server for get IP from DHCP.

Post by hack3rcon » 2015/09/06 14:22:59

Can you write this configuration for me?
If my local network ip range is "192.168.72.0-255" and other eternal network that I connected to them is "192.167.1.0.-255", Which part of DNS configuration must be changed?

Thank you.

Post Reply