码迷,mamicode.com
首页 > 系统相关 > 详细

Linux dhcp服务器配置

时间:2015-07-04 16:59:06      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:dhc服务配置

DHCP服务器配置

    DHCP服务是才用C/S架构的所以需要一个服务器才能提供DHCP服务器

    

    注明:本次DHCP实验的系统为CentOS 6.6   

        


    Linxu DHCP服务安装:

        yum install dhcp

            用以上命令就可以安装dhcp服务了


        安装完之后dhcp服务脚本为dhcpd

        

            服务脚本:/etc/rc.d/init.d


                    dhcp,67/UDP    :服务端,67为端口,工作与UDP

                    dhclient,68/UDP:客户端,68为端口,工作与UDP

            

            配置文件:

                /etc/dhcp/dhcpd.conf

                

    现在开始编辑配置文件,Linux默认配置文件是没有配置的,需要自己编辑或者复制配置文件的样本文件来覆盖掉,否则服务无法启动。

        配置文件的样本文件:/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample

            注意:样本文件中有许多语法错误的,需要删除,否则服务不能正常启动


        配置文件内容:

----------------------------------------------------------------------------------------------------                

配置文件中不是段落结束的都需要在后面加分号;   否则语法错误


# dhcpd.conf

#

# Sample configuration file for ISC dhcpd

#

# option definitions common to all supported networks..

.

option domain-name "example.org";:域名,自己的搜索域


option domain-name-servers ns1.example.org, ns2.example.org;:

        名称服务器地址 多个服务器地址需要, 逗号隔开


default-lease-time 600;:默认租约期限


max-lease-time 7200;:最大租约期限


# Use this to enble / disable dynamic dns updates globally.

#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local

# network, the authoritative directive should be uncommented.

#authoritative;

# Use this to send dhcp log messages to a different log file (you also

# have to hack syslog.conf to complete the redirection).


log-facility local7;:日志设施是什么,存放日志文件在哪里


# No service will be given on this subnet, but declaring it helps the 

# DHCP server to understand the network topology.


重要:subnet服务器工作在哪个网络中,这个网络中配置是什么


subnet 10.254.239.0(工作与哪个网络) netmask 255.255.255.224(子网掩码) {

  range 10.254.239.10 10.254.239.20;:地址池,被分配的IP都存在于此

  option routers(网关)10.254.239.1;

  option domain-name-servers 61.153.177.196;:dns服务器地址

}


-------------------------------------------------------------------------------------------


        配置完成之后:

            

           service dhcpd configtest

                 使用以上命令对配置文件进行语法测试,通过就可以启动服务了

         由于在/etc/rc.d/init.d/下有dhcpd的服务脚本所以可以直接使用service dhcpd start启动服务


        启动服务完成之后使用另一台主机测试即可。


/etc/dhcpd.conf             ........DHCP服务器的主配置文件

/etc/rc.d/init.d/dhcpd      ........DHCP服务启动脚本

/etc/rc.d/init.d/dhcrelay   ........DHCP中继服务启动脚本

/etc/sysconfig/dhcpd        ........DHCP命令参数配置文件

/etc/sysconfig/dhcrelay     ........DHCP中继服务配置文件

 

/usr/sbin/dhcpd             ........DHCP服务器执行程序

/usr/sbin/dhcrelay          ........DHCP中继服务器的执行程序

 

/var/lib/dhcpd/dhcpd.leases ........DHCP服务器租约文件



      

                

            

Linux dhcp服务器配置

标签:dhc服务配置

原文地址:http://kmk0226.blog.51cto.com/5975994/1670796

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!