LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-24-2017, 07:38 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

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

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

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
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, 12:45 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

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 01:05 AM.
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:01 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration