我正在使用 Ubuntu Server 16.10 作为热点,并安装桌面以使用应用程序,但这样做会导致 isc-dhcp-server 停止工作。这是我从它获取状态时的响应:
Nov 23 13:49:26 user sh[2394]: Not configured to listen on any interfaces!
Nov 23 13:49:26 user sh[2394]: If you think you have received this message due to a bug rather
Nov 23 13:49:26 user sh[2394]: than a configuration issue please read the section on submitting
Nov 23 13:49:26 user sh[2394]: bugs on either our web page at www.isc.org or in the README file
Nov 23 13:49:26 user sh[2394]: before submitting a bug. These pages explain the proper
Nov 23 13:49:26 user sh[2394]: process and the information we find helpful for debugging..
Nov 23 13:49:26 user sh[2394]: exiting.
Nov 23 13:49:26 user systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status
Nov 23 13:49:26 user systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Nov 23 13:49:26 user systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
我知道它说它没有配置为监听接口,但是在 dhcpd.conf 中它是。
ddns-update-style none;
authoritative;
INTERFACES="wlp2s0";
subnet 10.255.0.0 netmask 255.255.0.0 {
option routers 10.255.0.1;
option subnet-mask 255.255.0.0;
option broadcast-address 10.255.255.255;
option domain-name-servers 10.255.0.1;
range 10.255.0.25 10.255.255.240;
default-lease-time 150;
max-lease-time 1800;
}
无线接口是 wlp2s0,它仍然说它没有配置为监听接口。我还将它包含在 /etc/default/isc-dhcp-server 中
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wlp2s0"
有人能告诉我为什么安装 ubuntu-desktop 会导致这种情况以及如何修复它吗?谢谢
编辑:
我运行了这个:
sudo dhcpd -4 wlp2s0
在出现的信息中,它写道:
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
Can't open /var/lib/dhcp/dhcpd.leases for append.
如果这是它不起作用的原因,我该如何解决它?
我还发现,尽管网络接口正确,但 wlp2s0 没有被分配 IP
auto wlp2s0
iface wlp2s0 inet static
address 10.255.0.1
netmask 255.255.0.0
答案1
我在使用 Mint 18.3 (Ubuntu 16.04) 时也遇到了同样的问题。以下两点有助于解决我的问题:
删除文件 /etc/network/interface 、 /etc/dhcp/dhcpd.conf 和 /etc/default/isc-dhcp-server 末尾的所有空行和空格
手动将 IP 添加到您的无线接口:ifconfig wlp2s0:0 10.255.0.1 netmask 255.255.0.0 up
使用 ifconfig 检查 ip 是否已正确添加到您的设备。然后重新启动网络管理器和 isc-dhcp-server 并查看一切是否正常。重新启动并检查设备的 ip 是否仍处于设置状态。
注意:如果您在完成所有操作后使用 hostapd 并收到类似以下错误:
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
wlp2s0 (o el que sea): interface state UNITIALIZED - DISABLED
wlp2s0: AP-DISABLED
hostapd_free_hapd_data: Interface wlp2s0 wasn't started
您必须编辑 /etc/NetworkManager/NetworkManager.conf 添加以下条目,其中 x 替换为您的 WiFi MAC 地址,保存,然后重新启动:
[keyfile]
unmanaged-devices=mac:xx:xx:xx:xx:xx:xx
资料来源: 设置静态IP Ubuntu 16.04