In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Network construction of small and medium-sized enterprises
I. Foundation of DHCP
1. The background of using DHCP
In today's enterprise networks, there are a large number of hosts or devices that need to obtain network parameters such as IP addresses.
@ if manual configuration is used, the workload is heavy, error-prone and difficult to manage
@ if a user changes it without authorization, it may also cause problems such as IP address conflicts.
-- using dynamic host configuration DHCP protocol to assign network parameters such as IP addresses can reduce the workload of administrators and avoid errors.
2. The definition of DHCP
DHCP (Dynamic Host Configuration Protocol) dynamic host configuration protocol, is a local area network protocol, using the UDP protocol to work
It has two main uses: to automatically assign IP addresses to internal network or network service providers, and to users or internal network administrators as a means of central management of all computers.
DHCP has three ports, of which UDP67 and UDP68 are normal DHCP service ports and serve as DHCP Server and DHCP Client service ports respectively. Port 546 is used for DHCPv6 Client but not for DHCPv4, which is a service for DHCP failover, which needs to be specially enabled. DHCP failover is used as a "dual-computer hot backup".
3. The function of DHCP
-- used to realize dynamic allocation and centralized management of IP addresses of enterprise users
-- avoid tedious manual configuration and quickly adapt to network changes
4. The role of DHCP
-- DHCP client (DHCP Client)
The DHCP client is the user host or other devices that want to get the IP address information assignment through the DHCP server DHCP Server, such as PC, mobile phone, IP phone and so on.
-- DHCP Server (DHCP Server)
The DHCP server is responsible for handling requests for address assignment, address renewal, address release, etc. from DHCP clients or DHCP clients or DHCP relays, assigning IP addresses and other network configuration information to clients.
-- DHCP Relay (DHCP Relay)
If the DHCP server and the DHCP client are within the same network segment, DHCP relay is not required, if the DHCP server and DHCP
If the client is not in the same network segment, the DHCP relay is responsible for forwarding DHCP packets between the DHCP server and the DHCP client. Like this
The deployment of DHCP servers in each network segment can be avoided, which not only saves costs, but also facilitates centralized management.
5. DHCP message
The DHCP service also works in Cramp S (client / server) mode, but the two use different UDP transport ports for message transmission.
The DHCP client uses port 68 UDP to send a request message, and the DHCP server uses port 67 UDP to send a reply message. DHCP customer
The message sent by the side to the DHCP server is called the DHCP request message, while the message sent by the DHCP server to the DHCP client is called the DHCP reply.
Wen.
6. DHCP message type
-- DHCP Discover Discovery message (the location of the DHCP server is not known when the IP address is requested, so it is broadcast within the local network
Send the message to discover the DHCP server in the network, and all the servers that receive the message will respond)
-- DHCP Offer provides messages (every server on which DHCP receives Discover messages will look in the configured address pool
A suitable IP address, plus the corresponding lease term and other configuration information, constructs an Offer message, which is sent to the client in the form of broadcast, informing the client that the server can provide it with an IP address)
-- DHCP Request request message (DHCP client will receive many Offer messages, so you must choose one of these responses and
Send DHCP Request messages to the server in the form of a broadcast)
-- DHCP ACK acknowledgement message (after the DHCP server receives the Request request message, according to the user carried in the Request message
MAC to find out if there is a corresponding lease record, and if so, send an ACK reply message)
-- DHCP NAK reject message (if the DHCP server receives the Request request message, it does not find out whether there is a corresponding lease record
Record, or if the IP address cannot be assigned properly for some reason, send a NAK reply message to the DHCP client)
-- DHCP Release releases the IP address (if the DHCP client does not need to use the assigned IP address, it will proactively contact the DHCP service
The server sends a Release request message, informing the server that the user no longer needs to assign an IP address, and requests the DHCP server to interpret
Put the corresponding IP address)
-- DHCP Decline reject message (after receiving the DHCP server ACK reply message, the DHCP client discovers through address conflict detection that the address assigned by the server conflicts or cannot be used due to other reasons, it will send a Decline request message to the DHCP server, informing the server that the assigned IP address is not available, in order to obtain a new IP address)
-- DHCP Inform request configuration parameter message (if the DHCP client needs to obtain more detailed configuration information from the DHCP server, it will send the Inform request message to the DHCP server; after receiving the message, the DHCP server will find the corresponding configuration information according to the lease and send the ACK reply message to the DHCP client. )
5. The working principle of DHCP
-- the client is looking for a device
-- the server responds to requests
-- client sends request
The server confirms the lease.
6. Basic configuration of DHCP
(1) DHCP service planning
-- Server planning (reasonable planning of VLAN to ensure that there is only one DHCP Server in the same VLAN and can receive customers in this VLAN
The request of the client;)
-- IP address planning
-- DHCP Server the range of IP addresses that can be assigned automatically
-- IP addresses that do not participate in allocation
-- Lease planning
-- reasonably plan the lease term. By default, the lease term for IP addresses is 1 day.
(2) enable DHCP function
Before configuring the DHCP server function, the DHCP function must be enabled in the system view
System-view
[Huawei] dhcp enable
II. Centralized configuration mode of DHCP
1. Global-based DHCP
Step 1: set up an address pool on the router, name it, and configure network segments, gateways, DNS, and leases
System-view enters the system view
[Huawei] sysname + Route name (any name can be set, such as DHCP) Router name
[DHCP] ip pool + address pool name (any name can be set, such as P1) create a new address pool
[DHCP-ip-pool-P1] network 192.168.1.0 mask 255.255.255.0 set a network segment
[DHCP-ip-pool-P1] gateway-list 192.168.1.254 set gateway address (custom)
[DHCP-ip-pool-P1] DNS list 8.8.8.8 set DNS address
[DHCP-ip-pool-P1] lease day + days set DHCP lease time
Step 2: turn on the router DHCP function
[DHCP] enable the router DHCP function under the dhcp enable system view
Step 3: configure the router interface with an address and enable the DHCP function on the interface
[DHCP] interface GigabitEthernet 0Unigram 0 enters the interface view
[DHCP-GigabitEthernet0/0/0] ip address 192.168.1.254 24 interface configures IP address
Note: the interface address should be the same as the gateway address
[DHCP-GigabitEthernet0/0/0] enable global DHCP under the dhcp select global API
2. Interface-based DHCP
Step 1: turn on the router DHCP function
System-view enters the system view
[Huawei] sysname + name, such as DHCP to name a route
Step 2: configure the router interface with an address and enable the DHCP function on the interface
[DHCP] interface GigabitEthernet 0Universe 0 enters the interface view
[DHCP-GigabitEthernet0/0/0] ip address 192.168.1.254 24 configures the interface with an IP address and subnet mask
Note: the gateway address is the interface address.
[DHCP-GigabitEthernet0/0/0] dhcp select interface applies the interface-based DHCP function under the interface
[DHCP-GigabitEthernet0/0/0] dhcp sever dns-list 8.8.8.8 set DNS address
Note: use the address provided by the operator in the real environment
[DHCP-GigabitEthernet0/0/0] dhcp sever lease day + days set DHCP lease time
[DHCP-GigabitEthernet0/0/0] dhcp sever excluded-ip address + address setting reserved address
Third, DHCP relay and its configuration
1. DHCP Relay (dhcp relay) use DHCP when your DHCP client is not on the same network segment as the DHCP server
Relay. DHCP trunking is typically configured on the Gateway Interface of the VLAN where the DHCP client is located.
2. Configuration command
Dhcp enableinterface vlanif 10-> dhcp select relay dhcp relay server-ip 192.168.88.883, the result: the received DHCP message sent by broadcast is converted into a message sent "unicast", and then forwarded to the specified DHCP server.
Lab 1: DHCP Relay
Demand:
PC-1/2/3/4 obtains the IP address of the corresponding network segment through DHCP
PC-1/2/3/4 can communicate with each other by ping.
Configuration ideas:
1. Configure the DHCP client
-double-click the simulator, select "DHCP", and then apply.
2. Configure the transport network between the DHCP client and the DHCP server
-create a VLAN
-configure port mode: access + trunk
-configure SW1 to vlan 10 / 200
-configure connectivity between SW1 and DHCP-Server
SW1/2:
[huawei] vlan batch 10 200 300
Switch 1
[SW1] interface gi0/0/1
[SW1-gi0/0/1] port link-type access
[SW1-gi0/0/1] port default vlan 10
[SW1] interface gi0/0/2
[SW1-gi0/0/2] port link-type access
[SW1-gi0/0/2] port default vlan 200
[SW1] interface gi0/0/24
[SW1-gi0/0/24] port link-type trunk
[SW1-gi0/0/24] port trunk allow-pass vlan all
Switch 2
[SW2] interface gi0/0/3
[SW2-gi0/0/3] port link-type access
[SW2-gi0/0/3] port default vlan 10
[SW2] interface gi0/0/4
[SW2-gi0/0/4] port link-type access
[SW2-gi0/0/4] port default vlan 200
[SW2] interface gi0/0/1
[SW2-gi0/0/24] port link-type trunk
[SW2-gi0/0/24] port trunk allow-pass vlan all
Switch 1
[SW1] interface vlan 10
[SW1-vlan10] ip address 192.168.10.254 255.255.255.0
[SW1] interface vlan 200
[SW1-vlan200] ip address 192.168.200.254 255.255.255.0
[SW1] interface gi0/0/3
[SW1-gi0/0/3] port link-type access
[SW1-gi0/0/3] port default vlan 300
[SW1] interface vlan 300
[SW1-vlan300] ip address 192.168.88.66 255.255.255.0
3. Configure DHCP server
-configure the IP address for DHCP-Server
-configure DHCP address pool (vlan-10 / vlan-200)
-configure the dhcp address pool selection method for the interface that receives DHCP messages
-enable DHCP function
-configure a default route to point to SW1
[DHCP-Server] interface gi0/0/0
[DHCP-Server-gi0/0/0] ip address 192.168.88.88 255.255.255.0
[DHCP-Server] ip pool VLAN-10
[DHCP-Server-pool-vlan-10] network 192.168.10.0 mask 255.255.255.0
[DHCP-Server-pool-vlan-10] gateway-list 192.168.10.254
[DHCP-Server-pool-vlan-10] dns-list 8.8.8.8
[DHCP-Server] ip pool VLAN-200
[DHCP-Server-pool-vlan-200] network 192.168.200.0 mask 255.255.255.0
[DHCP-Server-pool-vlan-200] gateway-list 192.168.200.254
[DHCP-Server-pool-vlan-200] dns-list 8.8.8.8
[DHCP-Server] dhcp enable [DHCP-Server] interface gi0/0/0
[DHCP-Server-gi0/0/0] dhcp select global
4. Configure the gateway of vlan10 and vlan200 to be DHCP relay.
[SW1] dhcp enable
[SW1] interface vlanif10 [SW1-vlanif10] dhcp select relay [SW1-vlanif10] dhcp relay server-ip 192.168.88.88 [SW1] interface vlanif200 [SW1-vlanif200] dhcp select relay [SW1-vlanif200] dhcp relay server-ip 192.168.88.88 5 、 Configure the return route of DHCP-Server [DHCP-Server] ip route-static 0.0.0.0 192.168.88.666, verify and test pc-1/2/3/4: ipconfig PC-1: ping 192.168.10.3 | ping 192.168.200.2Univer 4
Lab 2: DHCP Relay
Requirement: DHCP Client successfully obtained the IP address
Configuration ideas:
1. Configure the DHCP client
2. Configure SW1 to ensure the correct connectivity between the DHCP client and the gateway
3. Configure DHCP server
4. Configure the gateway to be a DHCP relay
5. Verification and testing
Configuration steps:
1. Configure the DHCP client
2. Configure SW1
[SW1] vlan 10
[SW1] interface gi0/0/1
[SW1-gi0/0/1] port link-type access
[SW1-gi0/0/1] port default vlan 10
[SW1] interface gi0/0/2
[SW1-gi0/0/2] port link-type access
[SW1-gi0/0/2] port default vlan 10
Configure the gateway:
[Gateway] interface gi0/0/0
[Gateway-gi0/0/0] ip address 192.168.10.254 255.255.255.0
[Gateway] interface gi0/0/1
[Gateway-gi0/0/1] ip address 192.168.12.1 255.255.255.0
3. Configure DHCP server
[DHCP-Server] interface gi0/0/1
[DHCP-Server-gi0/0/1] ip address 192.168.12.2 255.255.255.0
[DHCP-Server] ip pool VLAN-10
[DHCP-Server-pool-vlan-10] network 192.168.10.0 mask 255.255.255.0
[DHCP-Server-pool-vlan-10] gateway-list 192.168.10.254
[DHCP-Server-pool-vlan-10] dns-list 8.8.8.8
[DHCP-Server] dhcp enable
[DHCP-Server] interface gi0/0/1
[DHCP-Server-gi0/0/1] dhcp select global
[DHCP-Server] ip route-static 0.0.0.0 0.0.0.0 192.168.12.1
4. Configure the gateway to be a DHCP relay
[Gateway] dhcp enable
[Gateway] interface gi0/0/0
[Gateway-gi0/0/0] dhcp select relay
[Gateway-gi0/0/0] dhcp relay server-ip 192.168.12.2
5. Verification and testing
DHCP-Client:
Ipconfig-> you can see the corresponding IP address, and it is successful.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.