1.安装DHCP服务组件:
#rpm -ivh dhcp-4.1.1-38.P1.el6.centos.x86_64.rpm 或者yum install dhcp
选项与参数:
-i :install 的意思
-v :察看更细部的安装资讯画面
-h :以安装资讯列显示安装进度
2.列出该软体所有的档案与目录所在完整档名 (list):
#rpm -ql dhcp
选项与参数:
-q:query
-l:list
3.cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
复制示例文档
4.vim /etc/dhcpd.conf
编辑配置文档
subnet 192.168.1.0 netmask 255.255.255.224 {
range 192.168.1.200 192.168.1.220;
option domain-name-servers ns1.internal.example.org;
option domain-name "internal.example.org";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}
host ice {
hardware ethernet 00:E0:40:02:EA:2A;
fixed-address 192.168.1.88;
}
5.启动dhcp
/etc/init.d/dhcpd restart
service dhcpd restart
启动失败说明配置文档有问题
6.检验是否成功
netstat -tlunp
tail -n 30 /var/log/messages
7.注意点:
配置文件有问题:少写分号,子网掩码和子网不是同一网段
主机ip和声明的子网不在同一网段