dhcp服务搭建

Dhcp服务
动态主机设置协议(Dynamic Host Configuration Protocol, DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址给用户给内部网络管理员作为对所有计算机作中央管理的手段。

给局域网内自动分配地址
1、查看Dhcp服务其配置
[root@localhost ~]# yum install dhcp -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
–> Running transaction check
—> Package dhcp.x86_64 12:4.2.5-58.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================
**Package Arch Version Repository Size
=========================================================================================**
Installing:
dhcp x86_64 12:4.2.5-58.el7 base 513 k

**Transaction Summary
=========================================================================================**
Install 1 Package

Total download size: 513 k
Installed size: 1.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 12:dhcp-4.2.5-58.el7.x86_64 1/1
Verifying : 12:dhcp-4.2.5-58.el7.x86_64 1/1

Installed:
dhcp.x86_64 12:4.2.5-58.el7

Complete!
2、查看配置文件
[root@localhost ~]# rpm -ql dhcp
/etc/NetworkManager
/etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/12-dhcpd
/etc/dhcp/dhcpd.conf
/etc/dhcp/dhcpd6.conf
/etc/dhcp/scripts
/etc/dhcp/scripts/README.scripts
/etc/openldap/schema/dhcp.schema
/etc/sysconfig/dhcpd
/usr/bin/omshell
/usr/lib/systemd/system/dhcpd.service
/usr/lib/systemd/system/dhcpd6.service
/usr/lib/systemd/system/dhcrelay.service
/usr/sbin/dhcpd
/usr/sbin/dhcrelay
/usr/share/doc/dhcp-4.2.5
/usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
/usr/share/doc/dhcp-4.2.5/dhcpd6.conf.example
/usr/share/doc/dhcp-4.2.5/ldap
/usr/share/doc/dhcp-4.2.5/ldap/README.ldap
/usr/share/doc/dhcp-4.2.5/ldap/dhcp.schema
/usr/share/doc/dhcp-4.2.5/ldap/dhcpd-conf-to-ldap
/usr/share/man/man1/omshell.1.gz
/usr/share/man/man5/dhcpd.conf.5.gz
/usr/share/man/man5/dhcpd.leases.5.gz
/usr/share/man/man8/dhcpd.8.gz
/usr/share/man/man8/dhcrelay.8.gz
/usr/share/systemtap/tapset/dhcpd.stp
/var/lib/dhcpd
/var/lib/dhcpd/dhcpd.leases
/var/lib/dhcpd/dhcpd6.leases
这里写图片描述
3、单网段配置:
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page

ddns-update-style interim; ###定义所支持的DNS动态更新类型,表示DNS互动更新模式
ignore client-updates; #####忽略客户机的DNS更新记录

subnet 172.16.50.0 netmask 255.255.255.0 {
option routers 172.16.50.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 114.114.114.114;
range dynamic-bootp 172.16.50.100 172.16.50.254;
default-lease-time 60;
max-lease-time 60;
}
这里写图片描述
这里写图片描述

结果如图:                

这里写图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值