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

Linux DHCP服务器简单配置示例

时间:2015-05-20 02:14:37      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:linux dhcp dhclient

1、DHCP安装及配置

yum install dhcp

cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf


vim /etc/dhcp/dhcpd.conf

option domain-name "redhat.com";

option domain-name-servers 202.96.128.166, 114.114.114.114;        # 设置DNS

default-lease-time 3600;        # 默认租约时间,单位秒

max-lease-time 7200;            # 最大租约时间,单位秒

log-facility local7;                    # 日志级别

subnet 192.168.101.0 netmask 255.255.255.0 {

        range 192.168.101.150 192.168.101.180;        # DHCP可获取的IP地址范围

        option routers          192.168.101.254;                # 网关

        option subnet-mask      255.255.255.0;                # 子网掩码


        host test {

                hardware ethernet 00:0C:29:6F:38:E4;        # 绑定主机的MAC地址

                fixed-address 192.168.101.208;                    # 绑定的IP

        }

}


2、启动DHCP服务

service dhcpd restart


3、查看DHCP客户端状态

cat /var/lib/dhcpd/dhcpd.leases

cat /var/lib/dhcpd/dhcpd.leases~



dhclient:获取地址

-d:在前台运行并显示获取过程

-r:释放地址


Linux DHCP服务器简单配置示例

标签:linux dhcp dhclient

原文地址:http://yuyucat.blog.51cto.com/9627004/1652941

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