配置DHCP服务器

配置DHCP服务器

一.前提条件:

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

2.为DHCP服务器固定IP

[root@localhost~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

[root@localhost~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

#Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=static

ONBOOT=yes

HWADDR=00:0c:29:5d:ed:a4

IPADDR=192.168.50.253

NETMASK=255.255.255.0

[root@localhost~]# service network restart

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

关闭环回接口:                                             [确定]

弹出环回接口:                                             [确定]

弹出界面 eth0:                                            [确定]

[root@localhost~]# chkconfig network on

[root@localhost~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 00:0C:29:5D:ED:A4 

          inet addr:192.168.50.253  Bcast:192.168.50.255  Mask:255.255.255.0

          inet6 addr:fe80::20c:29ff:fe5d:eda4/64 Scope:Link

          RX packets:68 errors:0 dropped:0overruns:0 frame:0

          TX packets:97 errors:0 dropped:0overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          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

[root@localhost~]# cd /misc

[root@localhost misc]# ls

[root@localhost misc]# cd cd

[root@localhost cd]# cd Server/

[root@localhost Server]# rpm -ivh dhcp-3.0.5-31.el5_8.1.x86_64.rpm

warning:dhcp-3.0.5-31.el5_8.1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID37017186

Preparing...               ########################################### [100%]

   1:dhcp                  ########################################### [100%]

2.DHCP服务器的配置

[root@localhost~]# cat /etc/dhcpd.conf

ddns-update-style interim;

subnet192.168.50.0 netmask 255.255.255.0 {

        option routers                  192.168.50.254;

        option subnet-mask              255.255.255.0;

        option domain-name              "tarena.com";

        option domain-name-servers      202.106.0.20;

        range dynamic-bootp 192.168.50.40 192.168.50.50;

        default-lease-time 21600;

        max-lease-time 43200;

        host ns {

                hardware ethernet12:34:56:78:AB:CD;

                fixed-address 207.175.42.254;

        }

}

3.启动服务

[root@localhost~]# rpm -ql dhcp | grep init.d

/etc/rc.d/init.d/dhcpd

/etc/rc.d/init.d/dhcrelay

[root@localhost ~]# service dhcpd restart

关闭 dhcpd:                                               [确定]

启动 dhcpd:                                              [确定]

[root@localhost~]# chkconfig --list dhcpd

dhcpd           0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

[root@localhost~]# chkconfig dhcpd on

dhcpd           0:关闭  1:开启  2:开启  3:开启  4:开启  5:开启  6:开启



你可能感兴趣的:(配置dhcp服务器)