Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction and Construction of DHCP in CentOS 7 DHCP Relay Service (Theory + practice)

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Understanding the principle and configuration of DHCP the DHCP service DHCP is designed and developed by the internet task force to automatically assign TCP/IP parameters to computers in the TCP/IP network the benefits of using DHCP to reduce the workload of administrators to avoid IP address conflicts when the network changes the IP address segment, there is no need to reconfigure each user's IP address to improve the utilization of IP addresses to facilitate client configuration DHCP allocation

Automatic allocation

Permanent use after being assigned to an IP address

Manual assignment

The DHCP server administrator specifically specifies the lease process in which the IP address is dynamically assigned and changed to IP for other clients to use.

The project in which the client obtains the IP address from the DHCP server is called the lease process of DHCP

The lease process is divided into four steps

1. The client requests the IP address Discover

When a DHCP client starts, the client does not have an IP address, so the client needs to obtain a legitimate address through DHCP. At this time, the DHCP client broadcasts DHCP Discover discovery information to find the DHCP server.

2. Response Service Offer

When the DHCP server receives information from the client requesting the IP address, it looks in its own IP address pool to see if there is a legitimate IP address provided to the client, if any. The DHCP server marks the IP address and adds it to the DHCP Offer message, and the DHCP server broadcasts a DHCP Offer message

3. The client selects the IP address Request

The DHCP client extracts the IP address from the first DHCP Offer message received, and the DHCP server that issued the IP address retains the address so that the address can no longer be assigned to another DHCP client

4. The server determines the lease ACK

After receiving the DHCP Request message, the DHCP server broadcasts the successful confirmation to the client in the form of a DHCP ACK message containing a valid lease for the IP address and other configurable information

Each time the DHCP client logs back into the network, it does not need to send DHCP Discover information, but directly sends the DHCP Request request information containing the previously assigned IP address

Update lease when the IP address leased by the DHCP server to the client reaches 50%, the client needs to update the lease client to send the DHCP Request packet directly to the server providing the lease, requiring the update of the existing address lease to dynamically configure the host address using DHCP

DHCP service

Automatically assign addresses to a large number of clients and provide centralized management

Reduce management and maintenance costs and improve network configuration efficiency

The address information that can be assigned mainly includes

IP address and subnet mask of the Nic

Corresponding network address and broadcast address

Default gateway address

DNS server address

Install DHCP server [root@localhost ~] # yum install dhcp-y

Master configuration file

/ etc/dhcp/dhcpd.conf view lease file / var/lib/dhcpd/dhcpd.lease uses DHCP client

Modify the network card configuration file

BOOTPROTO=dhcp uses the dhclient command dhclient [- d] [network interface name] to build the DHCP relay service experimental environment: use VMware 15 to download the link license key: UY758-0RXEQ-M81WP-8ZM7Z-Y3HDAc3725 routing image file download link

Use GNS3 1.3.1 download link usage

Win 10 Image download Link win 7 Image download Link CentOS 7 Image download Link Building Service

1. Build the topology diagram of DHCP relay service in GNS3, which is convenient for us to sort out our ideas when building the service. Here I use one win 10 virtual machine, one win 7 virtual machine, one CentOS 7 virtual machine, and two c3725 routing devices. First of all, two routing devices are added, and disk space is added to the routing devices to facilitate us to create vlan and add layer 2 switching interfaces. It is convenient for us to turn routing devices into a layer 3 switching device and a layer 2 switching device. Add three host hosts and rename them to DHC, win 10 and win 7 respectively. At this time, we also need to add two virtual network cards to the VMware 15 virtual machine device, and set the host mode only. At this time, we will return to the GNS3 and use the link cable to connect the device. In this experiment, we will divide into three vlan. Divide the three virtual machines into different vlan (vlan address division: vlan10:192.168.10.1/24, vlan20:192.168.20.1/24, vlan100:192.168.100.1/24, and assign the static IP address 192.168.100.100 to the DHCP server. As shown in the following figure:

2. Open VMware 15, enable win 10, win 7, and CentOS 7 virtual machines, and install DHCP services in CentOS 7 virtual machines. After installation, bind network cards to win 10, win 7, and CentOS 7 virtual machines, respectively, bind VMnet2 network cards to win 10, and bind VMnet1 network cards to VMnet3 network cards in win 7. However, you will go back to CentOS 7 to configure static routes, configure DHCP services, turn on services, turn off firewalls, and close enhanced security files.

[root@localhost ~] # yum install dhcp-y / / install the DHCP service loaded plug-in: fastestmirror Langpacksbase | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | | 3.4 kB 00:00:00 (1amp 4): base/7/x86_64/group_gz | 166kB 00:00:00 (2pm 4): base/7/x86_64/primary_db | | 6.0 MB 00:00:01. / / omit part of the content.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report