码迷,mamicode.com
首页 > 其他好文 > 详细

DHCP服务部署流程

时间:2019-02-22 22:59:29      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:一个   局域网   sha   --   dhcp服务器   ethernet   hardware   list   测试   

为某一局域网部署DHCP

[root@dhcp ~]# yum install -y dhcp
[root@dhcp ~]# rpm -ql dhcp
/usr/sbin/dhcpd:dhcp服务进程
/usr/lib/systemd/system/dhcpd.service → /etc/dhcp/dhcpd.conf → /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example(配置模板)
/usr/lib/systemd/system/dhcpd6.service → /etc/dhcp/dhcpd6.conf → /usr/share/doc/dhcp-4.2.5/dhcpd6.conf.example(配置模板)
/usr/sbin/dhcrelay:dhcp中继进程
/usr/lib/systemd/system/dhcrelay.service → /etc/dhcp/dhcpd.conf、/etc/dhcp/dhcpd6.conf
/etc/sysconfig/dhcpd
# 注意:同时只能运行一个dhcp进程
[root@dhcp ~]# cat /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
[root@dhcp ~]# cat /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example > /etc/dhcp/dhcpd.conf
[root@dhcp ~]# vim /etc/dhcp/dhcpd.conf
log-facility local7;
subnet 192.168.30.0 netmask 255.255.255.0 {
range 192.168.30.10 192.168.30.50;
option domain-name-servers 8.8.8.8;
default-lease-time 86400;
max-lease-time 86400;
}
[root@dhcp ~]# dhcpd # 语法检测
Listening on LPF/eth0/00:0c:29:b2:e4:ec/192.168.30.0/24
Sending on LPF/eth0/00:0c:29:b2:e4:ec/192.168.30.0/24
Sending on Socket/fallback/fallback-net
[root@dhcp ~]# systemctl start dhcpd.service
[root@dhcp ~]# systemctl enable dhcpd.service
[root@dhcp ~]# systemctl status dhcpd.service
Jul 04 02:26:32 dhcp.example.com systemd[1]: Started DHCPv4 Server Daemon.
[root@dhcp ~]# netstat -lntup|grep dhcpd

[root@dhcp ~]# ps -ef|grep dhcpd


测试

[root@client ~]# ip addr
127.0.0.1/8
192.168.30.137/24
[root@client ~]# dhclient -d -s 192.168.30.129 # -d:前台运行,-s:指定DHCP服务器
bound to 192.168.30.10 -- renewal in 41153 seconds.
[root@client ~]# ip addr
127.0.0.1/8
192.168.30.137/24
192.168.30.10/24
[root@dhcp ~]# cat /var/lib/dhcpd/dhcpd.leases # 查看租约文件
lease 192.168.30.10 {
starts 2 2018/07/03 18:36:28;
ends 3 2018/07/04 18:36:28;
cltt 2 2018/07/03 18:36:28;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 00:0c:29:a4:f4:35;
}

DHCP服务部署流程

标签:一个   局域网   sha   --   dhcp服务器   ethernet   hardware   list   测试   

原文地址:https://www.cnblogs.com/liming-linux-python/p/10421155.html

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