Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-24-2017, 08:38 PM   #1
Registered: Aug 2012
Posts: 789

Rep: Reputation: Disabled
Including file in /etc/dhcpcd.conf

I would like to include a file in my /etc/dhcpcd.conf which will include the following, and another application will edit this file and cause the machine to reboot. Note that this is not really a server, but a raspberry pi running a different application which has a small embedded webserver to change configuration settings. I've tried include "/path/to/my/file.conf"; but upon rebooting, the Pi doesn't have a static IP so uses a dynamic one. But if I include these actual lines in my /etc/dhcpcd.conf file instead of the include statement, it works fine. I suppose I can have my application directly edit /etc/dhcpcd.conf, but thought it would be better with the include file. What should I be doing? Thanks

interface eth0
static ip_address=
static routers=
static domain_name_servers=
Old 04-25-2017, 01:20 AM   #2
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
What are you actually trying to do. It sounds like you're making things more complex than they need to be. If you require a different configuration, kill the dhcpcd process and restart it with the configuration you want.

Then, instead of editing a file and rebooting you can keep the device up and just reconfigure by calling a script that kills the process and starts it again with command line parameters suitable to the new interface configuration.

You might have to run more than one command in the script, but rebooting is such a harsh way to deal with the problem.
Old 04-25-2017, 01:45 AM   #3
Registered: Aug 2012
Posts: 789

Original Poster
Rep: Reputation: Disabled
Thanks AwesomeMachine,

Yeah, rebooting is a bit primitive, but I want the changes to be persistent and as such need to edit the physical file.

EDIT. Changed to restarting network per your recommendations, but still curious whether I put an "include file" in dhcpcd.conf.

Last edited by NotionCommotion; 04-25-2017 at 02:05 AM.


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
Assigning printer a static IP-address with dhcpcd (.conf)? Paraply Linux - Networking 18 12-23-2011 09:25 AM
I don't want dhcpcd to edit/replace /etc/resolv.conf simopal6 Linux - Networking 2 11-09-2009 03:13 PM
Cant find dhcpcd.conf in \etc\. malikowais Linux - Newbie 6 03-22-2005 02:45 AM
resolv.conf ifup dhcpcd not working together andrewguy9 Linux - Wireless Networking 1 03-19-2005 03:43 PM
SUSE 9.1: named.conf works, but including separate conf files doesn't??? registering Linux - Distributions 0 06-09-2004 05:03 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:22 PM.

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