gpt4 book ai didi

linux - 如何在不运行 dhcpd 的情况下检查 dhcpd.conf 是否存在语法错误?

转载 作者:IT王子 更新时间:2023-10-29 00:25:11 25 4
gpt4 key购买 nike

我需要确保 dhcpd.conf 没有语法错误。如果有错误,我想知道它们是什么。

我可以用这个命令检查语法错误:

dhcpd -cf /path/to/dhcpd.conf

但是除了我得到的错误之外,它还打印了很多信息。另一件事是我不想运行dhcpd,即使没有语法错误。我只想检查语法错误并查看它们是什么。


不幸的是,运行 dhcpd -tf/path/to/dhcpd.conf 也没有解决我的问题。

最佳答案

你要找的语法是

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

-t 选项将进行配置检查:

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.

如果您使用默认的配置文件路径,则不需要使用 -cf

/usr/sbin/dhcpd -t

您使用 -tf/path/to/... 尝试的那个非常不同并且与跟踪有关。

关于linux - 如何在不运行 dhcpd 的情况下检查 dhcpd.conf 是否存在语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13878706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com