1、安裝DHCP rpm包
查看dhcp是否安裝
# rpm -qa dhcp
# yum install dhcp
2、查看dhcp安裝後的配置文件
# rpm -ql dhcp
3、配置/etc/dhcpd.conf
安裝dhcp後的配置文件在/etc/dhcpd.conf中,但是裏邊是空的,什麼內容都沒有。
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
將/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample 的dhcp的配置文件模板copy覆蓋/etc/dhcpd.conf
# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
# vim /etc/dhcpd.conf
其內容爲:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 { #將
# --- default gateway
option routers 192.168.0.1; #路由網關
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org"; #改爲域名
option domain-name-servers 192.168.1.1; #改爲DNS服務器地址
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.254; #動態獲取IP的範圍
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address #給予某個特定的MAC地址固定的IP地址,主機尋找IP時會優先尋找固定IP
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
至此,DHCP服務器已經配置完成了。