DHCP服务
DHCP
案例
-
为 InsideCli 客户端网络分配地址,地址池范围: 192.168.0.110-192.168.0.190/24;
-
域名解析服务器:按照实际需求配置 DNS 服务器地址选项;
-
网关:按照实际需求配置网关地址选项;
-
为 InsideCli 分配固定地址为 192.168.0.190/24
配置
安装DHCP
# CentOS
yum -y install dhcp
# Debian
apt -y install isc-dhcp-server
编辑DHCP配置文件
vim /etc/dhcp/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.110 192.168.0.190;
option domain-name-servers 192.168.100.100;
option routers 192.168.0.254;
default-lease-time 600;
max-lease-time 7200;
}
Host Insidecli {
hardware ethernet 00:0c:29:24:50:b8;
fixed-address 192.168.0.190;
}
DHCP RELAY
案例
- 安装 isc-dhcp-server;
- 允许客户端通过中继服务获取网络地址
配置
CentOS
dhcrelay 192.168.100.100 # 一次性配置
# 配置DHCP RELAY服务
# CentOS 安装DHCP服务,自带中继功能
vim /lib/systemd/system/dhcrelay.service
...
[Service]
ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.100.100
cp -rp /lib/systemd/system/dhcrelay.service /etc/systemd/system/system
# 启动dhcp relay
systemctl daemon-reload
systemctl enable --now dhcrelay.service
Debian
# 需要先安装isc-dhcp-relay包
apt -y install isc-dhcp-relay
vim /etc/sysconfig/dhcrelay
SERVERS="192.168.100.100" # dhcp服务器地址
INTERFACES="ens33 ens33:0" # 监听网卡
# 启动dhcp relay服务
systemctl enable --now isc-dhcp-relay
本文来自博客园,作者:未来的你!,转载请注明原文链接:https://www.cnblogs.com/frost-descent/p/16660249.html