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服务器已经配置完成了。