我正在尝试在 12.04 上设置 DHCP 服务器。我安装了:
sudo apt-get install isc-dhcp-server
我的配置文件如下所示:
/etc/default/isc-dhcp 服务器
INTERFACES="eth0"
/etc/网络/接口
auto lo
iface lo inet loopback
/etc/dhcp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.235 192.168.1.240;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
default-lease-time 100000;
max-lease-time 100000;
}
当我跑步时sudo service isc-dhcp-server restart
我得到:
stop: Unknown instance:
isc-dhcp-server start/running, process 15384
此后如果我运行sudo service isc-dhcp-server status
它它会显示它已停止:
isc-dhcp-server stop/waiting
我在这里做错了什么?
答案1
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
你的服务器必须有一个静态 IP。该 IP 不能在你的 dhcp IP 范围内。重新启动网络守护进程并重新启动 dhcp
sudo /etc/init.d/networking restart
sudo /etc/init.d/isc-dhcp-server restart