/etc/resolv.conf 檔案
主配置檔案:/etc/dhcp/dhcpd.conf
執行程式:/usr/sbin/dhcpd、/usr/sbin/dhcrelay
服務腳本:/etc/init.d/dhcpd、/etc/init.d/dhcrelay
執行參數配置:/etc/sysconfig/dhcpd
DHCP中繼配置:/etc/sysconfig/dhcrelay
DHCP
/etc/dhcp/dhcpd.conf
全局設定,作用于整個DHCP伺服器
ddns -update-style none;
default-lease-time 21600;
max-lease-time 43200;
option domain-name "domain.org";
option domain-name-servers 202.106.0.20;
Subnet網絡聲明,作用于整個子網段
range參數:設定用于配置設定的ip位址
option subnet-mask 參數: 設定客戶機的子網路遮罩
option routers 參數:設定客戶機的預設網關位址
subnet 192.168.4.0 netmask 255.255.255.0{
range 192.168.4.128 192.168.4.254;
option subnet-mask 255.255.255.0;
option routers 192.168.4.1
}
host主機聲明,作用于單個主機
hardware ethernet 參數:指定對應主機的MAC位址
fixed-address 參數:指定為該主機
host prtsvr{
hardware ethernet 00:v0:77:44;
fixed-address 192.168.4.100
啟動DHCP服務
netstat -anpu | grep :67
檢視租約檔案
/var/lib/dhcpd/dhcpd.leases
使用方式
1、修改網卡配置檔案
2、使用dhclient指令
dhclient -d eth0
ddns-update-style none;
max-lease-time 43200;
subnet 192.168.111.0 netmask 255.255.255.0 {
range 192.168.111.10 192.168.111.253;
option subnet-mask 255.255.255.0;
option routers 192.168.111.1;
# host prtsvr {
# hardware ethernet 00:0C:29:E7:64:E8;
#: fixed-address 192.168.111.100;
# }
--------------baby神