Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check dhcpd.conf against syntax error without running dhcpd?

Tags:

I need to make sure there are no syntax errors on dhcpd.conf. If there are errors, I want to get what they are.

I can check for syntax errors with this command:

dhcpd -cf /path/to/dhcpd.conf 

but that prints a lot of information in addition to the error I got. Another thing is that I don't want to run dhcpd, even there is no syntax error. I only want to check for syntax errors and see what they are.


Unfortunately, running dhcpd -tf /path/to/dhcpd.conf also didn't solve my problem.

like image 933
ibrahim Avatar asked Dec 14 '12 12:12

ibrahim


People also ask

Where is the dhcpd configuration file?

The main DHCP configuration file is /etc/dhcp/dhcpd. conf. The file is used to store the network configuration information required by DHCP clients. There is also a sample configuration file at /usr/share/doc/dhcp-[version]/dhcpd.

What is the difference between DHCP and dhcpd?

dhcpd (an abbreviation for "DHCP daemon") is a DHCP server program that operates as a daemon on a server to provide Dynamic Host Configuration Protocol (DHCP) service to a network.

How do I create a dhcpd conf?

To create a dhcpd. conf file, you enter a scope keyword first, followed by a pair of braces ({}) enclosing the parameter and declaration statements that apply within that scope. If there is no preceding scope keyword, the statement applies globally.


1 Answers

The syntax you are looking for is

dhcpd -t -cf /path/to/dhcpd.conf 

The -t option will do a config check:

If the -t flag is specified, the server will simply test the configuration file for correct syntax, but will not attempt to perform any network operations. This can be used to test the new configuration file automatically before installing it.

You do not need to use -cf if you are using the default config file path.

/usr/sbin/dhcpd -t 

The one you tried with -tf /path/to/... is quite different and relates to tracing.

like image 157
John Avatar answered Sep 23 '22 01:09

John