Dnsmasq

dnsmasq 重啟失敗

  • March 14, 2016

每當我想重新啟動dnsmasq服務時,我都會收到此錯誤

root@ipm:/tftpboot# /etc/init.d/dnsmasq restart
[....] Restarting dnsmasq (via systemctl): dnsmasq.serviceJob for
dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
failed!

如錯誤消息中所述,這些命令中沒有有用的資訊。

# systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
  Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
 Drop-In: /run/systemd/generator/dnsmasq.service.d             └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.con 
  Active: failed (Result: exit-code) since  2016-03-4 11:04:42 IRST; 3min 53s ago
 Process: 18806 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=1/FAILURE)

14 11:04:42  systemd[1]: Starting dnsmasq - A lightweight DHCP .....
14 11:04:42  dnsmasq[18806]: dnsmasq: bad dhcp-range at line 4 o...f
14 11:04:42  systemd[1]: dnsmasq.service: Control process exite...=1
14 11:04:42  systemd[1]: Failed to start dnsmasq - A lightweigh...r.
14 11:04:42  systemd[1]: dnsmasq.service: Unit entered failed state.
14 11:04:42  systemd[1]: dnsmasq.service: Failed with result 'e...'.
Hint: Some lines were ellipsized, use -l to show in full.

的內容dnsmasq.conf

# cat /etc/dnsmasq.conf
interface=enp3s0
domain=hpclab
expand-hosts
dhcp-range=192.168.1.1,192.168.1.20,static
dhcp-option=42,0.0.0.0
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot
dhcp-host=00:e0:81:c5:19:64,ws01,192.168.1.1

所以,第 4 行是dhcp-range=192.168.1.1,192.168.1.20,static. 我在 ubuntu-12.04 中使用了相同的內容。

更新:

無論如何,正確的語法是dhcp-range=192.168.1.0,static. 我不知道 12.04 是如何工作的!

4 11:04:42 dnsmasq

$$ 18806 $$: dnsmasq: 第 4 行 o…f 的 dhcp-range 錯誤

這對我來說看起來很有用——你讀過嗎?好像你的配置有問題。

提示:有些線條是橢圓的,使用 -l 來完整顯示。

這也是有用的資訊——當你使用它時會發生什麼?

systemctl status -l dnsmasq.service 

說真的,請閱讀您提供的資訊,我們不是錯誤消息閱讀服務。

引用自:https://serverfault.com/questions/763541