Isc-Dhcp
dhcpd.conf ‘遇到配置文件錯誤’
我想設置 isc-dhcp-server,但是 dhcp.conf 文件在測試時會產生錯誤
dhcpd -t
:... /etc/dhcp/dhcpd.conf line 6: expecting a parameter or declaration authoritative; ^ Configuration file errors encountered -- exiting ...
cat /etc/dhcp/dhcpd.conf
:# Configuration file for the ISC-DHCP Server 4.3.3 # Default sample file at /etc/dhcp/dhcpd.sample.conf # global statements: authoritative; interface enp30s0; option routers 192.168.100.1; option domain-name-servers 192.168.178.1, 192.168.100.1; subnet 192.168.100.0 netmask 255.255.255.0{ range 192.168.100.10 192.168.100.110; default-lease-time 600; max-lease-time 7200; } # host declaration host server { hardware ethernet 1c:c1:de:80:76:e8; fixed-address 192.168.100.10; option host-name "server"; } host pc { hardware ethernet 1C:1B:0D:10:44:71; fixed-address 192.168.100.11; option host-name "PC"; }
大部分文件都是從文件中複製和粘貼的,所以我不知道問題出在哪裡……
你的問題似乎在於這
interface enp30s0;
條線。由於您以數字方式引用選項,因此我認為您不需要指定介面。從
dhcpd.conf
手冊頁:選項路由器 204.254.239.1;
請注意,此處的地址是用數字指定的。這不是必需的 - 如果您的路由器上的每個介面都有不同的域名,那麼使用該介面的域名而不是數字地址是完全合法的。但是,在許多情況下,路由器的所有 IP 地址可能只有一個域名,因此此處不適合使用該名稱。
我用範例文件逐行重新創建您
dhcpd.conf
的文件,這就是破壞它的原因。這是我的工作版本:
# cat /usr/share/doc/dhcp*/dhcpd.conf.sample # dhcpd.conf # # Sample configuration file for ISC dhcpd # # option definitions common to all supported networks... option routers 192.168.100.1; option domain-name-servers 192.168.178.1, 192.168.100.1; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. authoritative; # This is a very basic subnet declaration. subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.10 192.168.100.110; default-lease-time 600; max-lease-time 7200; } # Hosts which require special configuration options can be listed in # host statements. If no address is specified, the address will be # allocated dynamically (if possible), but the host-specific information # will still come from the host declaration. host server { hardware ethernet 1c:c1:de:80:76:e8; fixed-address 192.168.100.10; option host-name "server"; } host pc { hardware ethernet 1C:1B:0D:10:44:71; fixed-address 192.168.100.11; option host-name "PC"; }
祝你好運!