Linux configuration and management DHCP server

Training purpose

Insert picture description here

Project Background

Insert picture description here
Insert picture description here
Insert picture description here

DHCP service

Insert picture description here

DHCP server software

Insert picture description here
Start

Install dhcp

[root@localhost ~]# yum install -y dhcp
[root@localhost ~]# vim /etc/dhcp/dhcp.conf

Copy the things inside.
Insert picture description here
Insert picture description here
After the copy is entered again,
Insert picture description here
you can keep the parameters you need to use.
Insert picture description here
Insert picture description here
Comment out the following things here, and the following are all comments
Insert picture description here

ddns-update-style none:参数设置为none,不设置动态更新
sbunet:作用域的声明
rang:地址范围 
option domain-name-servers :DNS服务器地址
option domain-name:域名,这里实验给删除了,
option routers:客户端分配的对应的网
option broadcast-address:广播地址,,删除掉,这里的项目没有要求,
default-lease-time 600:默认租约时间,DHCP将IP地址分配给客户端的时间,不是永久使用的,需要继续使用客户端需要申请
max-lease-time 7200:最大租约时间

After configuring as required
Insert picture description here

Change a Redhat to enter the configuration, select VMnet1 network card host only mode,
view the Mac address,
Insert picture description here
return to the first host for configuration

The host name of the host can be defined by yourselfInsert picture description here

service dhcpd start 启动服务
chkconfig dhcpd on

Confirm firewall
Insert picture description here

Linux configuration client

Enter the second child Redhat to
automatically obtain and enable the network card.
Insert picture description here
Restart the network (here both virtual machines are VMnet1 network cards) and send out dhcp requests.
Insert picture description here
Insert picture description here
Check the gateway
Insert picture description here
Check the dns server
Insert picture description here

The monitoring log can be viewed on the server
Insert picture description here

Windows configuration client

使用网卡VMnet1
cmd进入网络连接模式:ncpa.cpl
将IP和DNS设置为自动获取
将网落禁用重启一下
查看一下获取的IP信息
-

Super scope

Back to the server,
increase shared-network test {}
increase the scope and change the IP
Insert picture description here

Add virtual network card sub-interface,
Insert picture description here
delete UID and
Insert picture description here

Restart the network service and check the network card information
Insert picture description here
Restart the dhcp service
Insert picture description here
Enter the Linux client to restart the network service and check the fixed IP
Insert picture description here

Back to the server configuration file

Insert picture description here
Check that the fixedly assigned IP address is indeed 192.168.1.100, indicating no problem

Enter Windows to disable the network restart so that it can restart to obtain an IP address (the IP address is still 192.168.1.3, because the IP address of the first scope has not been used up and is still within the lease time)

DHCP relay agent (across the gateway host to assign an IP address to another host, which means cross-network allocation)

**服务器VMnet1网卡
网关主机配置VMnet1和VMnet2网卡
Windows xp配置VMnet2网卡(作为客户端使用)
中继:Windows客户端会发送IP地址分配请求给中继转给DHCP服务器来获取动态IP地址**

Enter DHCP server configuration

Modify the DHCP server

vim  /etc/dhcp/dhcp.conf

Insert picture description here
Remove the super function (here, if you configure the relay separately in the future, you should pay attention to the configuration and declare two network segments, here because the above experiment has been declared. 192.168.1.1 is the DHCP network segment, and 192.168.0.0 is the gateway host and client network segment)
Insert picture description here
start
Insert picture description here
configure the relay server
to assign a static IP address
address to check out the DHCP server
Insert picture description here
continues configured on the relay server (this time can no longer use the address assigned by DHCP)
close networking tools
Insert picture description here
into the catalog
Insert picture description here
card configuration (DHCP is connected)
Insert picture description here
Insert picture description here
to increase card After adding the configuration file,
Insert picture description here
delete the UID and MAC address and configure the IP (the IP address here is the gateway in the dhcp.conf file in the DHCP server).
Insert picture description here
Restart the network service
Insert picture description here
test
Insert picture description here

DHCP server configuration gateway

Enter the DHCP server.
View the gateway.
Insert picture description here
First stop deleting the previously configured sub-interface.
Insert picture description here
Insert picture description here
View the route.
Insert picture description here
Add a static route (via refers to the next hop) and
Insert picture description here
Insert picture description here
return to the relay server.
Modify the kernel
Insert picture description here

Insert picture description here
Change to 1 to
Insert picture description here
enable
Insert picture description here

yum install dhcp -y  安装dhcp

View dhcp-related configuration files
Insert picture description here
Modify configuration files
Insert picture description here
Insert picture description here
Provide DHCP relay service for eth0 and eth1, DHCP server is 192.168.1.1
Insert picture description here
Start service dhcrelay
Insert picture description here
Insert picture description here
enters Windows client test,
restart the network card, it will automatically obtain an IP,
Insert picture description here
Insert picture description here
you can view the log on the DHCP server
Insert picture description here

Two experiments
complete configuration

ended

Guess you like

Origin blog.csdn.net/weixin_45849066/article/details/113094097