1、首先,我们需要安装服务所需的软件包:

#yum -y install dhcp

2、创建/修改配置文件:

#vim /etc/dhcp/dhcpd.conf

default-lease-time  7200; 

max-lease-time  14400;

subnet 192.168.4.0 netmask 255.255.255.0 {

        option routers                  192.168.4.1;

        option domain-name              "xxxxx.xxxx";

        option domain-name-servers      202.106.0.20,8.8.8.8;

        range 192.168.4.28 192.168.4.54;

        

}

# service dhcpd restart  

#chkconfig dhcpd on

# netstat  -anptu | grep dhcp

3、保留固定IP地址:

#vim /etc/dhcp/dhcpd.conf

host pc205 {

                hardware ethernet MAC address;

                fixed-address IP address;

        }

#service dhcpd restart