DHCP service dhcp relay service configuration profiles and detailed process

Introduction and configure the DHCP service Detailed

1, DHCP Service Introduction

DHCP (Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol) is a network protocol LAN, using the UDP protocol works, there are two main purposes: to automatically assign IP addresses to the internal network or Internet service provider to the user or an internal network administrator as a means for central management of all computers


2, DHCP service role

(1) a large number of clients to automatically assign addresses, providing centralized management

(2) reduce the management and maintenance costs and improve the efficiency of network configuration

 

3, DHCP service can be assigned to the main address information

IP address (1), subnet mask

(2) a corresponding network address, broadcast address

(3) the default gateway address

(4) DNS server address

(5) boot file, TFTP server address

 

4, DHCP principle

(1) the client requests the IP homing device ×××

(2) server provides address information

(3) receive and broadcast (the client chooses IP)

(4) server confirms the lease (the DHCPACK)   

(If the DHCP client can not find a DHCP server from TCP / IP Class B segment 169.254.0.0,16 in a selection of IP as its own IP address, every five minutes, continue to attempt to communicate with the DHCP server)

5.DHCP client renewal:

       DHCP client in the last 50% of the time the lease, provided directly to the IP address for DHCP server sends DHCPREQUEST packet. If the client receives the server response DHCPPACK message packet, the client update their configuration according to the new lease and other that have been updated TCP / IP parameters provided in the package, IP lease renewal is completed. If you do not receive a reply to the server, the client continues to use the existing ip address, because the current lease another 50%.

      If the last 50% of the time did not update the lease, the DHCP client lease 87.5% of the time over the last contact again to provide the IP address of the DHCP server, if not successful, to lease 100% of the time, DHCP the client must give up the IP address, re-apply. At this time, if no DHCP server is available, DHCP client using a random address in the 169.254.0.0/16, and try again every 5 minutes.

 

6, DHCP-related configuration files

主配置文件:/etc/dhcp/dhcpd.conf

模板文件:/usr/share/doc/dhcp-4.2.5.example

查看租约文件:/var/lib/dhcpd/dhcpd.lease

很多网络服务的排错日志:/var/log/messages



dhcp服务中继配置

实验环境

host对应vlan10

host2对应vlan20

host3对应vlan100

服务器地址192.168.100.100


1.打开GNS3,准备2个路由器设备,3个用户设备

一个路由设备改成交换机,起名sw1

一个路由设备改成三层交换,起名sw2

其中一个用户改成服务器

image.png


2.在sw1中创建vlan10 vlan20 vlan100,并分别将f1/1 f1/2 f1/3划分到vlan中

image.png


3.关闭sw1路由功能

image.png


4.将f1/4接口设为trunk

image.png


5.进入sw2,创建vlan10,20,100   ,将f1/4设为trunk,并分别给vlan10,20,100设置网关地址及子网掩码

image.png



6.设置中继

image.png



7.开启虚拟机centos7,用yum install dhcp -y 安装dhcp服务

image.png



8.将网卡连到vmnet8 ,并设为仅主机模式,关闭dhcp自动获取ip功能

image.png



image.png



9.设置静态ip 192.168.100.100

image.png



10.重启服务使ip生效

image.png



11.复制dhcp服务配置文件模板

image.png




12.修改dhcp服务配置文件

image.png



13.启动dhcp服务

image.png



14.开启2台win10,分别连到vmnet1,vmnet2,进行验证

image.png


image.png


2台win10都被自动分配了ip地址,实现了dhcp中继服务

Guess you like

Origin blog.51cto.com/14469918/2434449