DHCP服务器配置

#检查DHCP软件包
rpm -qa | grep dhcp
#清理本地缓存
yum clean all
#安装DHCP软件
yum install dhcp
#编辑默认网卡配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#重启网卡
service network restart    
#查看IP地址
ifconfig

Linux下搭建服务器的过程

  1. 安装相关软件包
  2. 修改配置文件
  3. 重启服务使之生效
cd /usr/share/doc/dhcp-4.1.1/
#复制DHCP示例文件
cp dhcpd.conf.sample /etc/dhcp/dhcp.conf
#打开DHCP配置文件
vi /etc/dhcp/dhcpd.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.200 192.168.1.210;
  option domain-name-servers 114.114.114.114;
  option routers 192.168.1.1;
  option broadcast-address 10.5.5.31;
  default-lease-time 600;
  max-lease-time 7200;
}

host fantasia {
  hardware ethernet 08:00:07:26:c0:a5;
  fixed-address fantasia.fugue.com;
}



#启动DHCP服务器
service dhcpd start
#日志文件
/var/log/message