LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-09-2019, 09:46 AM   #1
blo0old
LQ Newbie
 
Registered: Feb 2019
Posts: 2

Rep: Reputation: Disabled
Including external config files to dhcpd config


I am setting up a dhcp server on RHEL where some of the entries in the file are generated at a later stage and may be regenerated often. I was looking at the dhcpd config guide and the include <filename>; guideline seems to be the best approach for this.

But looks like dhcp server doesn't load the external file at all.

Here's me dhcpd.conf:

Code:
default-lease-time   86400;               # 24 hours in seconds
max-lease-time       604800;              # 7 days in seconds
authoritative;

include "/opt/demo/deploy/extdhcp.conf"; #EXTERNAL FILE

subnet 192.200.1.0 netmask 255.255.255.0 {
    option routers             192.200.1.1;  
    option subnet-mask         255.255.255.0;
    option broadcast-address   192.200.1.255;

    host ANSIBLE-01 {
        hardware ethernet 00:50:56:8c:5e:47;
        fixed-address 192.200.1.10;
    }
}
Here's the external config file:

Code:
subnet 10.64.0.0 netmask 255.255.255.0 {
         range 10.64.0.1 10.64.0.100;
         option routers          10.64.0.254;
         option subnet-mask      255.255.255.0;
         option broadcast-address        10.64.0.255;

    host ILO-1 {
         hardware ethernet 00:50:56:8c:0e:fd;
         fixed-address 10.64.0.55;
    }
}
This is what I see in the logs, that tells me that the external file hasn't been loaded in dhcpd.

Code:
2019-02-09T15:19:07.493576+00:00 dhcp-01.erewhon.com <daemon.err> dhcpd: DHCPDISCOVER from 00:50:56:8c:0e:fd via eth0: network 192.200.1.0/24: no free leases
2019-02-09T15:19:19.671670+00:00 dhcp-01.erewhon.com <daemon.err> dhcpd: message repeated 3 times: [ DHCPDISCOVER from 00:50:56:8c:0e:fd via eth0: network 192.200.1.0/24: no free leases]
2019-02-09T15:19:26.657147+00:00 dhcp-01.erewhon.com <daemon.err> dhcpd: DHCPDISCOVER from 00:50:56:8c:0e:fd via eth0: network 192.200.1.0/24: no free leases
2019-02-09T15:21:04.257982+00:00 dhcp-01.erewhon.com <daemon.err> dhcpd: message repeated 7 times: [ DHCPDISCOVER from 00:50:56:8c:0e:fd via eth0: network 192.200.1.0/24: no free leases]
2019-02-09T15:21:18.419381+00:00 dhcp-01.erewhon.com <daemon.err> dhcpd: DHCPDISCOVER from 00:50:56:8c:0e:fd via eth0: network 192.200.1.0/24: no free leases
As you see from the logs, the dhcp seems to connect the MAC to the network defined in dhcpd.conf and not the external file.

Any help would be appreciated to make dhcp include the external config file.
 
Old 02-10-2019, 04:12 AM   #2
berndbausch
LQ Guru
 
Registered: Nov 2013
Location: Tokyo
Distribution: A few
Posts: 5,520

Rep: Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654Reputation: 1654
I don't consider myself an expert in dhcpd.conf syntax, but have you tried moving the include statement to the end of the file?

Just to ensure not even the obvious is forgotten: You did restart the dhcpd after modifying the include file, right?

Last edited by berndbausch; 02-10-2019 at 04:15 AM.
 
Old 02-10-2019, 08:35 AM   #3
blo0old
LQ Newbie
 
Registered: Feb 2019
Posts: 2

Original Poster
Rep: Reputation: Disabled
Yes. I did both. I also removed the include statement and pasted itís contents directly in dhcpd.conf to validate the config and it worked.
 
Old 02-11-2019, 10:06 AM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,758

Rep: Reputation: 132Reputation: 132
I would think the idea is to test changes to your dhcp setup. Once done the daemon will be restarted manually after the edit. If so why not edit a duplicate file copy the old to a backup file the new to the dhcp config file restart the daemon to check it if worked. Everything but the editing can be done with a shell script that does the backup, copy and restart of the daemon in one command. If you wanted to automate the procedure running a cron job to run the script file will work for that.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Including external data (network/external drive) in website directory thealmightyos Linux - Server 2 08-19-2014 12:14 PM
[SOLVED] Is it ok to sync all files including config files from one PC to another PC? linustalman Linux - Networking 15 07-28-2014 03:03 PM
dhcpd subnet declaration problems in dhcpd.conf vcrispo Linux - Networking 6 07-15-2005 10:32 AM
DHCPD startup failure, mdk 9.2, dhcpd v3.0.1rc11 fuzzyworm Linux - Networking 1 02-14-2004 03:58 AM
dhcpd.master or dhcpd.conf rickg Linux - Networking 0 04-11-2002 03:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration