Three DHCP configuration methods

DHCP configuration

dhcp request: The broadcast message sent by the user to the server, the purpose is to notify other servers whether to use the ip address assigned by the server. At the same time, the message has the effect of renewing the lease.
dhcp lease term: The purpose is to use ip address reasonably and effectively. The ip addresses assigned to the client have a lease period. When half of the lease period is reached, the client will automatically trigger a lease renewal message (dhcp request message).

DHCP protocol message:
DHCPDISCOVER: broadcast by the client to find the available server
DHCP OFFER: the server responds to the DHCP DISCOVER message of the client and specifies the corresponding configuration parameters.
DHCP REQUEST: Sent by the client to the server to request configuration parameters or request configuration confirmation or lease renewal.
DHCP ACK: From server to client, including configuration parameters including IP address.

DHCP advanced message:
DHCP DECLINE: When the client finds that the address has been used, it is used to notify the server.
DHCP INFORM: When the client already has an IP address, it is used to request other configuration parameters from the server.
DHCP NAK: Sent by the server to the client to indicate that the client's address request is incorrect or the lease has expired.
DHCP RELEASE: Used to notify the server when the client wants to release the address.

DHCP configuration
Insert picture description here
global establishment of address pool

[Huawei]ip pool xiaoguo
[Huawei-ip-pool-xiaoguo]gateway-list 192.168.1.1
[Huawei-ip-pool-xiaoguo]network 192.168.1.0 mask 24
[Huawei-ip-pool-xiaoguo]dns-list 8.8.8.8
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]dhcp select global

Modify the lease term (optional)

[Huawei]ip pool xiaoguo
[Huawei-ip-pool-xiaoguo]lease day 0 hour 20

Bind fixed mac corresponding IP (optional)

[Huawei]ip pool xiaoguo
[Huawei-ip-pool-xiaoguo]static-bind ip-address 192.168.1.254 mac-address 5489-98E4-199F

Exclude address segment (optional)

[Huawei]ip pool xiaoguo
[Huawei-ip-pool-xiaoguo]excluded-ip-address 192.168.1.200 192.168.1.250

Debug command: display the usage of the assigned ip address

[Huawei]display ip pool name xiaoguo used

Reset allocation record

<Huawei>reset ip pool name xiaoguo used 

2. Interface-based dhcp (simple and convenient)

[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[Huawei-GigabitEthernet0/0/0]dhcp select interface
[Huawei-GigabitEthernet0/0/0]dhcp server dns-list 8.8.8.8

3.dhcp relay (dhcp relay)
Insert picture description here

sw1:
	<Huawei>system-view 
	[Huawei]sysname sw1	
	[sw1]undo info-center enable 
	[sw1]vlan batch 10 20 800
	[sw1]dhcp enable 
	[sw1]interface Vlanif 800
	[sw1-Vlanif800]ip add 192.168.254.1 24
	[sw1]interface Vlanif 10
	[sw1-Vlanif10]ip add 192.168.10.1 24
	[sw1-Vlanif10]dhcp select relay 
	[sw1-Vlanif10]dhcp relay server-ip 192.168.254.2
	[sw1]interface Vlanif 20
	[sw1-Vlanif20]ip add 192.168.20.1 24
	[sw1-Vlanif20]dhcp select relay
	[sw1-Vlanif20]dhcp relay server-ip 192.168.254.2
	[sw1]interface GigabitEthernet 0/0/1	
	[sw1-GigabitEthernet0/0/1]port link-type access 
	[sw1-GigabitEthernet0/0/1]port default vlan 800
	[sw1-GigabitEthernet0/0/1]int g0/0/2	
	[sw1-GigabitEthernet0/0/2]port link-type trunk 
	[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
	[sw1-GigabitEthernet0/0/2]int g0/0/3	
	[sw1-GigabitEthernet0/0/3]port link-type trunk 	
	[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 20
	
sw2:
	<Huawei>system-view 
	[Huawei]sysname sw2
	[sw2]vlan 10
	[sw2]interface e0/0/1
	[sw2-Ethernet0/0/1]port link-type trunk	
	[sw2-Ethernet0/0/1]port trunk allow-pass vlan 10
	[sw2-Ethernet0/0/1]int e0/0/2
	[sw2-Ethernet0/0/2]port default vlan 10
	
sw3:
	<Huawei>system-view 
	[Huawei]sysname sw3
	[sw3]vlan 20
	[sw3]int e0/0/1
	[sw3-Ethernet0/0/1]port link-type trunk
	[sw3-Ethernet0/0/1]port trunk allow-pass vlan 20
	[sw3-Ethernet0/0/1]int e0/0/2
	[sw3-Ethernet0/0/2]port link-type access
	[sw3-Ethernet0/0/2]port default vlan 20
	
R1:
	[Huawei]sysname R1-DHCP
	[R1-DHCP]int g0/0/0
	[R1-DHCP-GigabitEthernet0/0/0]dhcp select global 
	[R1-DHCP-GigabitEthernet0/0/0]ip add 192.168.254.2 24
	[R1-DHCP]ip route-static 0.0.0.0 0 192.168.254.1
	[R1-DHCP]ip pool vlan10
	[R1-DHCP-ip-pool-vlan10]network 192.168.10.0 mask 24
	[R1-DHCP-ip-pool-vlan10]gateway-list 192.168.10.1
	[R1-DHCP-ip-pool-vlan10]dns-list 8.8.8.8
	[R1-DHCP]ip pool vlan20
	[R1-DHCP-ip-pool-vlan20]network 192.168.20.0 mask 24
	[R1-DHCP-ip-pool-vlan20]gateway-list 192.168.20.1
	[R1-DHCP-ip-pool-vlan20]dns-list 8.8.8.8

Guess you like

Origin blog.csdn.net/Lovely_Xiaoguo/article/details/108654647