A-A+

配置DHCP服务器的前提条件和步骤

2015年11月27日 站长资讯 暂无评论

一.前提条件:

1.环境准备(机器设置,网络设置都为Vmnet8)

2.为DHCP服务器固定IP

  1. [root@localhost~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0  
  2. [root@localhost~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0  
  3. #Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)  
  4. DEVICE=eth0  
  5. BOOTPROTO=static  
  6. ONBOOT=yes  
  7. HWADDR=00:0c:29:5d:ed:a4  
  8. IPADDR=192.168.50.253  
  9. NETMASK=255.255.255.0  
  10. [root@localhost~]# service network restart  

正在关闭接口 eth0:[确定]

关闭环回接口:[确定]

弹出环回接口: [确定]

弹出界面 eth0:[确定]

  1. [root@localhost~]# chkconfig network on  
  2. [root@localhost~]# ifconfig eth0  
  3. eth0      Link encap:Ethernet  HWaddr 00:0C:29:5D:ED:A4   
  4.           inet addr:192.168.50.253  Bcast:192.168.50.255  Mask:255.255.255.0  
  5.           inet6 addr:fe80::20c:29ff:fe5d:eda4/64 Scope:Link  
  6.           RX packets:68 errors:0 dropped:0overruns:0 frame:0  
  7.           TX packets:97 errors:0 dropped:0overruns:0 carrier:0  
  8.           collisions:0 txqueuelen:1000  
  9.           RX bytes:9557 (9.3 KiB)  TX bytes:17042 (16.6 KiB)  

二.配置服务器

1.安装dhcp软件包

[root@localhost~]# rpm -q dhcp

packagedhcp is not installed

放入5.9 dvd iso

  1. [root@localhost~]# cd /misc  
  2. [root@localhost misc]# ls  
  3. [root@localhost misc]# cd cd  
  4. [root@localhost cd]# cd Server/  
  5. [root@localhost Server]# rpm -ivh dhcp-3.0.5-31.el5_8.1.x86_64.rpm  
  6. warning:dhcp-3.0.5-31.el5_8.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID37017186  
  7. Preparing...               ########################################### [100%]  
  8.    1:dhcp                  ########################################### [100%]  

2.DHCP服务器的配置

  1. [root@localhost~]# cat /etc/dhcpd.conf  
  2. ddns-update-style interim;  
  3. subnet192.168.50.0 netmask 255.255.255.0 {  
  4.         option routers                  192.168.50.254;  
  5.         option subnet-mask              255.255.255.0;  
  6.         option domain-name              "tarena.com";  
  7.         option domain-name-servers      202.106.0.20;  
  8.         range dynamic-bootp 192.168.50.40 192.168.50.50;  
  9.         default-lease-time 21600;  
  10.         max-lease-time 43200;  
  11.         host ns {  
  12.                 hardware ethernet12:34:56:78:AB:CD;  
  13.                 fixed-address 207.175.42.254;  
  14.         }  
  15. }  

3.启动服务

  1. [root@localhost~]# rpm -ql dhcp | grep init.d  
  2. /etc/rc.d/init.d/dhcpd  
  3. /etc/rc.d/init.d/dhcrelay  
  4. [root@localhost ~]# service dhcpd restart  
  5. 关闭 dhcpd:[确定]  
  6. 启动 dhcpd:[确定]  
  7. [root@localhost~]# chkconfig --list dhcpd  
  8. dhcpd           0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭  
  9. [root@localhost~]# chkconfig dhcpd on  
  10. dhcpd           0:关闭  1:开启  2:开启  3:开启  4:开启  5:开启  6:开启  
标签:

给我留言