Linux-Mint

DNSMASQ 拒絕以“未知介面錯誤”啟動,即使介面已啟動

  • January 22, 2022

一個我在網際網路上其他任何地方都沒有發現的奇怪問題,暗示可能是我搞砸了,但是什麼?

嘗試啟動dnsmasq.service,無論是在啟動時還是在所有網路服務可用且正常工作時從使用者會話開始,都會失敗並unknown interface enp2s0出現錯誤……除了整個系統的其餘部分聲稱它已經啟動。

andrzej@andrzej-PC ~ $ sudo systemctl start dnsmasq
Job for dnsmasq.service failed because the control process exited with 
error code. See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
andrzej@andrzej-PC ~ $ systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
  Loaded: loaded (/lib/systemd/system/dnsmasq.service; disabled; vendor preset:
 Drop-In: /run/systemd/generator/dnsmasq.service.d
          └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
  Active: failed (Result: exit-code) since Mon 2017-07-10 02:09:41 CEST; 3s ago
 Process: 5551 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=
 Process: 5548 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUC

Jul 10 02:09:41 andrzej-PC systemd[1]: Starting dnsmasq - A lightweight DHCP and
Jul 10 02:09:41 andrzej-PC dnsmasq[5548]: dnsmasq: syntax check OK.
Jul 10 02:09:41 andrzej-PC dnsmasq[5551]: dnsmasq: unknown interface enp2s0
Jul 10 02:09:41 andrzej-PC systemd[1]: dnsmasq.service: Control process exited, 
Jul 10 02:09:41 andrzej-PC systemd[1]: Failed to start dnsmasq - A lightweight D
Jul 10 02:09:41 andrzej-PC systemd[1]: dnsmasq.service: Unit entered failed stat
Jul 10 02:09:41 andrzej-PC systemd[1]: dnsmasq.service: Failed with result 'exit

對,除了:

andrzej@andrzej-PC ~ $ ifconfig
enp2s0    Link encap:Ethernet  HWaddr /*correct address*/  
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:921 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:0 (0.0 B)  TX bytes:147421 (147.4 KB)

和同樣的ip addr

2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
   link/ether /*same*/ brd ff:ff:ff:ff:ff:ff

最後:

andrzej@andrzej-PC ~ $ cat /sys/class/net/enp2s0/operstate
up

什麼?哦,我的配置文件如下所示:

port=0
interface=enp2s0
dhcp-range=192.168.0.50,192.168.0.150,12h
dhcp-boot=/install/netboot/pxelinux.0
dhcp-option-force=209,install/netboot/pxelinux.cfg
dhcp-option-force=210,/
dhcp-option-force=66,192.168.0.1
enable-tftp
tftp-root=/mnt

我有同樣的情況 - dnsmasq 拒絕在用於 PXE 的輔助 eth 介面上啟動,背靠背(無開關)連接到另一台電腦。

一旦我建立了連結(一些網路流量,NIC 燈亮了),dnsmasq 就開始正常了。

我知道這不是很科學,但它對我有用(Ubuntu 20.04)

系統重啟有幫助 - dnsmasq 啟動時沒有問題。配置為與 dnsmasq 一起使用的介面的設備配置可能尚未生效

引用自:https://unix.stackexchange.com/questions/377381