RouteSrv+AppSrv DHCP中继+DHCP配置
DHCP:
为InsideCli客户端网络分配地址,地址池范围:192.168.0.110-192.168.0.190/24; 域名解析服务器:按照实际需求配置DNS服务器地址选项; 网关:按照实际需求配置网关地址选项; 为InsideCli分配固定地址为192.168.0.190/24;
DHCP RELAY
配置DHCP 允许客户端通过中继服务获取网络地址
一、关闭Selinux和防火墙
[root@appsrv ~]# setenforce 0 [root@appsrv ~]# systemctl stop firewalld
二、安装dhcp
[root@appsrv ~]# yum install dhcp -y
三、编辑和配置dhcp
[root@appsrv ~]# vim /etc/dhcp/dhcpd.conf
default-lease-time 43200; //默认租约时间 max-lease-time 259200; //最大租约时间 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 domain-name "chinaskills.cn"; option routers 192.168.0.254; } subnet 192.168.100.0 netmask 255.255.255.0 { } host insidecli{ hardware ethernet 08:00:07:26:c0:a5; fixed-address 192.168.0.190; }
四、启动dhcp服务
[root@appsrv ~]# systemctl start dhcpd
五、开启路由转发
[root@routersrv ~]# vim/etc/sysctl.conf net.ipv4.ip_forward=1
[root@routersrv ~]# yum install dhcp -y [root@routersrv ~]# dhcrelay 192.168.100.100
七、客户端测试
[root@insidecli ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 BOOTPROTO=dhcp ONBOOT=yes 重启网卡 [root@insidecli ~]# systemctl restart network