在Debian系统上配置DHCP服务器的步骤如下:
sudo apt-get update
sudo apt-get install isc-dhcp-server
安装过程中,系统将会提示您配置isc-dhcp-server的相关选项。您可以使用默认选项,或根据需要进行配置。
/etc/dhcp/dhcpd.conf
文件,该文件包含了DHCP服务器的配置信息。/etc/dhcp/dhcpd.conf
文件:sudo nano /etc/dhcp/dhcpd.conf
option domain-name "example.com";
option domain-name-servers ns1.example.com, ns2.example.com;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
}
host host1 {
hardware ethernet 00:11:22:33:44:55;
fixed-address 192.168.1.50;
}
class "example" {
match pick-first-value (option dhcp-client-identifier, hardware);
deny unknown-clients;
}
您可以根据需要进行配置,并根据注释提供的说明进行修改。
sudo systemctl start isc-dhcp-server
sudo systemctl status isc-dhcp-server
sudo systemctl stop isc-dhcp-server
sudo systemctl restart isc-dhcp-server
sudo systemctl disable isc-dhcp-server
sudo systemctl enable isc-dhcp-server
sudo dhcp-lease-list
ip address show
ipconfig
如果输出显示由DHCP服务器分配的IP地址,说明DHCP服务器设置成功。