配置DHCP服务器 1.查询是否安装dhcp了. [root@rhel ~]# rpm -qa | grep dhcp 2.挂载系统光盘,准备安装。 [root@rhel ~]# mount /dev/cdrom /mnt/ mount: block device /dev/sr0 is write-protected, mounting read-only 3.显示安装目录中有多少以dhcp开头的文件。 [root@rhel ~]# rpm -qa |grep dhcp* dhclient-4.1.1-34.P1.el6.i686 dhcp-common-4.1.1-34.P1.el6.i686 4.安装dhcp的主程序文件。 [root@rhel ~]# rpm -ivh /mnt/Packages/dhcp-4.1.1-34.P1.el6.i686.rpm warning: /mnt/Packages/dhcp-4.1.1-34.P1.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:dhcp ########################################### [100%] 5.再次查看是否有dhcp主程序文件 [root@rhel ~]# rpm -qa | grep dhcp dhcp-4.1.1-34.P1.el6.i686 dhcp-common-4.1.1-34.P1.el6.i686 6配置dhcp主程序文件 A.注意dhcpd的配置文件名称为dhcpd.conf。安装完后在/etc/dhcp/下并没有需要我们手动建立,这个配置文件时空的。所以我们可以从案例文件中复制一份。 [root@rhel ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf B.然后打开dhcp主程序文件 [root@rhel ~]# vi /etc/dhcp/dhcpd.conf ddns-update-style none; option domain-name "benet.com"; option domain-name-servers 202.106.0.20,202.106.148.1; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.4.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.4.128 192.168.4.254; option subnet-mask 255.255.255.0; option routers 192.168.4.1; host prtsvr { hardware ethernet 0:0:c0:5d:bd:95; fixed-address 192.168.4.100; } } 7.启动dhcpd服务。 [root@rhel ~]/usr/sbin/dhcpd eth0 检查dhcp配置文件的是否有错误的地方 [root@rhel ~]service dhcpd start 启动 8.客户端测试! 9.查看租约文件/var/lib/dhcpd/dhcpd.lease
|