DHCP configuration commands in Cisco and Huawei equipment (super detailed~~!!)

Table of contents

1. DHCP related configuration commands

1. Cisco device configuration commands

(1) Open the DHCP service

(2) Create a DHCP address pool

(3) Configure the network and mask to be assigned by the DHCP server

(4) Configure the default gateway assigned to the client

(5) Configure the domain name assigned to the client

(6) Configure the WINS server assigned to the client

(7) Configure the DNS server assigned to the client

(8) Configure the TFTP server assigned to the client

(9) Configure IP address lease

(10) Configure DHCP to manually assign IP addresses to fixed hosts

(11) Configure the identifier of the client

(12) Turn off the DHCP conflict log

(13) Formulate the address excluded by DHCP

(14) Configure DHCP relay address

(15) Enable the DHCP snooping function on the switch

(16) Enable DHCP snooping for a specific VLAN

(17) Define DHCP listening trusted port

(18) Restrict attackers from continuously sending DHCP requests to the DHCP server through untrusted ports

(19) Save the DHCP listening binding table in Flash

(20) Specify how many seconds to wait before writing to the file after the DHCO monitoring binding table is updated

(21) After specifying how many seconds after the update of the DHCO monitoring binding table, it will stop trying to write the operation

(22) The switch does not insert the option82 option in the DHCP packet

(23) If the switch receives the DHCP data packet received by the untrusted port with the option 82 option, it also receives the DHCP data packet

(24) Enable DAI on VLAN

(25) To configure DAI, check that the source MAC address, destination MAC address, and source IP address in the ARP packet are consistent with the information in the DHCP Snooping binding table

(26) Configure the DAI trust interface

(27) Configure the interface ARP packet sending rate

2. Huawei device configuration commands

(1) Open the DHCP service

(2) Turn on the automatic rate limit function of DHCP messages

(3) Enable the function of connecting to the DHCP server using the interface address pool

(4) Enable the interface to use the DHCP server function of the global address pool

(5) View the storage information of DHCP data

(6) Turn on the data saving function of the device allocation address

(10) Configure the time interval for saving data. By default, save every n seconds and overwrite the previous data file

(11) Turn on the DHCP data recovery function

(12) Configure the number of conflict detections when the device assigns an IP address, the default is n

(14) Configure the maximum waiting time for each conflict detection when the device allocates an IP address, the default is n milliseconds

(15) Turn on the function of DHCP Server to respond to BOOTP requests

(16) Enable the DHCP server to dynamically assign addresses to BOOTP clients

(17) Create a global address pool and enter the global address pool view

(18) Configure the IP address range that can be dynamically allocated by the global address pool

(19) Configure VPN instances under the address pool, and use the same address pool to assign IP addresses of the same network segment to clients in different VPN networks

(20) Configure the IP address in the address pool that does not participate in automatic allocation

(21) Configure the IP addresses in the address pool that do not participate in automatic allocation

(22) Configure to assign a fixed IP address to the specified DHCP client

(23) Assign a fixed IP address to the specified DHCP client

(24) Configure IP address lease

(25) Configure IP address lease

(26) You can view lease-related information

(27) Configure the gateway address of the DHCP Client

(28) Specify the IP address of the file server to be used in the next step after the client obtains the IP address

(29) Configure the file server address used in the next step after the client automatically obtains the IP address

(30) Specify the IP address of the DNS server for the DHCP client

(31) Configure the DNS domain name suffix assigned to the DHCP client

(32) Configure the IP address of the NetBIOS Server of the DHCP Client

(33) Configure the NetBIOS node type of the DHCP Client

(34) Enable the DHCP relay function of the interface

(35) Configure the IP address of the DHCP server

(36) Configure the polling function of the DHCP relay

(37) Configure the DHCP server group for the interface application

(38) Enable DHCP relay trust Option82 option function

(39) Configure the function of adding the Option82 option in the DHCP message. If the Option82 option is not carried in the DHCP message, the Option82 option is inserted; if the Option82 option is carried, it is judged whether the Option82 option contains remote-id, and if so, then Keep Option82 unchanged, if not included, insert remote-id

(40) Configure the function of adding the Option82 option in the DHCP message. If the Option82 option is not carried in the DHCP message, the Option82 option is inserted; if the Option82 option is carried, the Option82 option is deleted and the configured Option82 option is inserted.

(41) View the DHCP server group or server information configured on the relay interface

(42) View the configuration information of the DHCP server group


1. DHCP related configuration commands

1. Cisco device configuration commands

(1) Open the DHCP service

Router(config)#service dhcp  默认开启

(2) Create a DHCP address pool

Router(config)#ip dhcp pool 地址池名

(3) Configure the network and mask to be assigned by the DHCP server

Router(dhcp-config)#network IP地址 掩码

(4) Configure the default gateway assigned to the client

Router(dhcp-config)#default-router 默认网关IP地址

(5) Configure the domain name assigned to the client

Router(dhcp-config)#domain-name 域名

(6) Configure the WINS server assigned to the client

Router(dhcp-config)#netbios-name-server IP地址

(7) Configure the DNS server assigned to the client

Router(dhcp-config)#dns-server IP地址

(8) Configure the TFTP server assigned to the client

Router(dhcp-config)#option 150 ip 地址

(9) Configure IP address lease

Router(dhcp-config)#lease {天[小时] [分钟]|infinite}

(10) Configure DHCP to manually assign IP addresses to fixed hosts

Router(dhcp-config)#client-identifier 标识符

(11) Configure the identifier of the client

Router(config)#no ip dhcp conflict logging

(12) Turn off the DHCP conflict log

Router(config)#ip dhcp excluded-address 短地址 | 长地址

(13) Formulate the address excluded by DHCP

Router(config-if)#ip helper-address IP地址

(14) Configure DHCP relay address

Switch(config)#ip dhcp snooping

(15) Enable the DHCP snooping function on the switch

Switch(config)#ip dhcp snooping 

(16) Enable DHCP snooping for a specific VLAN

Switch(config-if)#ip dhcp snooping vlan vlanID号

(17) Define DHCP listening trusted port

Switch(config-if)#ip dhcp snooping trust

(18) Restrict attackers from continuously sending DHCP requests to the DHCP server through untrusted ports

Switch(config-if)#ip dhcp snooping limit rate 速率

(19) Save the DHCP listening binding table in Flash

Switch(config)#ip dhcp snooping database flash:文件名

(20) Specify how many seconds to wait before writing to the file after the DHCO monitoring binding table is updated

Switch(config)#ip dhcp snooping database write-delay 秒数

默认为300s,可选范围为15-86 400s

(21) After specifying how many seconds after the update of the DHCO monitoring binding table, it will stop trying to write the operation

Switch(config)#ip dhcp snooping database timeout 秒数

(22) The switch does not insert the option82 option in the DHCP packet

Switch(config)#no ip dhcp snooping information option

(23) If the switch receives the DHCP data packet received by the untrusted port with the option 82 option, it also receives the DHCP data packet

Switch(config)#ip dhcp snooping information option allow-untrusted

(24) Enable DAI on VLAN

Switch(config)#ip arp inspection vlan vlanID 号

(25) To configure DAI, check that the source MAC address, destination MAC address, and source IP address in the ARP packet are consistent with the information in the DHCP Snooping binding table

Switch(config)#ip arp inspection validate src-mac dst-mac ip

(26) Configure the DAI trust interface

Switch(config)#ip arp inspection trust

(27) Configure the interface ARP packet sending rate

Switch(config)#ip arp inspection limit 速率

2. Huawei device configuration commands

(1) Open the DHCP service

[Huawei]dhcp enable

(2) Turn on the automatic rate limit function of DHCP messages

[Huawei]dhcp speed-limit auto 

(3) Enable the DHCP server function of the interface using the interface address pool

[Huawei-GigabitEthernet0/0/1]dhcp select interface 


(4) Enable the interface to use the DHCP server function of the global address pool

[Huawei-GigabitEthernet0/0/1]dhcp select global  

(5) View the storage information of DHCP data

[Huawei]display dhcp server database  

(6) Turn on the data saving function of the device allocation address

[Huawei]dhcp server database enable   

(10) Configure the time interval for saving data. By default, save every n seconds and overwrite the previous data file

[Huawei]dhcp server database write-delay n

(11) Turn on the DHCP data recovery function

[Huawei]dhcp server database recover  

(12) Configure the number of conflict detections when the device assigns an IP address, the default is n

[Huawei]dhcp server ping packet n

(14) Configure the maximum waiting time for each conflict detection when the device allocates an IP address, the default is n milliseconds

[Huawei]dhcp server ping timeout n

(15) Turn on the function of DHCP Server to respond to BOOTP requests

[Huawei]dhcp server bootp  

(16) Enable the DHCP server to dynamically assign addresses to BOOTP clients

[Huawei]dhcp server bootp automatic  

(17) Create a global address pool and enter the global address pool view

[Huawei]ip pool 地址池名

(18) Configure the IP address range that can be dynamically allocated by the global address pool

[Huawei-ip-pool-地址池名]network IP地址 mask 掩码数

(19) Configure VPN instances under the address pool, and use the same address pool to assign IP addresses of the same network segment to clients in different VPN networks

[Huawei-ip-pool-地址池名]vpn-instance IP网段

(20) Configure the IP address in the address pool that does not participate in automatic allocation

[Huawei-GigabitEthernet0/0/1]dhcp server excluded-ip-address IP地址  

(21) Configure the IP addresses in the address pool that do not participate in automatic allocation

[Huawei-ip-pool-a1]excluded-ip-address IP地址

(22) Configure to assign a fixed IP address to the specified DHCP client

[Huawei-GigabitEthernet0/0/1]dhcp server static-bind ip-address IP地址 mac-address MAC地址 

(23) Assign a fixed IP address to the specified DHCP client

[Huawei-ip-pool-a1]static-bind ip-address IP地址 mac-address MAC地址

(24) Configure IP address lease

[Huawei-GigabitEthernet0/0/1]dhcp server lease day 天 hour 小时 minute 分钟

(25) Configure IP address lease

[Huawei-ip-pool-a1]lease day 天 hour 小时 minute 分钟

(26) You can view lease-related information

[Huawei]display ip pool  

(27) Configure the gateway address of the DHCP Client

[Huawei-ip-pool-a1]gateway-list IP地址

(28) Specify the IP address of the file server to be used in the next step after the client obtains the IP address

[Huawei-GigabitEthernet0/0/1]dhcp server next-server IP地址

(29) Configure the file server address used in the next step after the client automatically obtains the IP address

[Huawei-ip-pool-a1]next-server IP地址

(30) Specify the IP address of the DNS server for the DHCP client

[Huawei-GigabitEthernet0/0/1]dhcp server dns-list DNS地址 

(31) Configure the DNS domain name suffix assigned to the DHCP client

[Huawei-GigabitEthernet0/0/1]dhcp server domain-name a1 

[Huawei-ip-pool-a1]dns-list DNS地址

[Huawei-ip-pool-a1]domain-name a1

(32) Configure the IP address of the NetBIOS Server of the DHCP Client

[Huawei-GigabitEthernet0/0/1]dhcp server nbns-list IP地址

(33) Configure the NetBIOS node type of the DHCP Client

[Huawei-GigabitEthernet0/0/1]dhcp server netbios-type b-node

[Huawei-ip-pool-a1]nbns-list 10.1.1.15

[Huawei-ip-pool-a1]netbios-type b-node

(34) Enable the DHCP relay function of the interface

[Huawei-GigabitEthernet0/0/2]dhcp select relay  

(35) Configure the IP address of the DHCP server

[Huawei-GigabitEthernet0/0/2]dhcp relay server-ip 10.1.1.100  

(36) Configure the polling function of the DHCP relay

[Huawei]ip relay address cycle

[Huawei]dhcp server group a1

[Huawei-dhcp-server-group-a1]dhcp-server 10.1.1.100

[Huawei-dhcp-server-group-a1]gateway 10.1.1.10

[Huawei-dhcp-server-group-a1]vpn-instance b1

(37) Configure the DHCP server group for the interface application

[Huawei-GigabitEthernet0/0/2]dhcp relay server-select a1  

(38) Enable DHCP relay trust Option82 option function

[Huawei]dhcp relay trust  option82  

(39) Configure the function of adding the Option82 option in the DHCP message. If the Option82 option is not carried in the DHCP message, the Option82 option is inserted; if the Option82 option is carried, it is judged whether the Option82 option contains remote-id, and if so, then Keep Option82 unchanged, if not included, insert remote-id

[Huawei-GigabitEthernet0/0/2]dhcp option82 insert enable  

(40) Configure the function of adding the Option82 option in the DHCP message. If the Option82 option is not carried in the DHCP message, the Option82 option is inserted; if the Option82 option is carried, the Option82 option is deleted and the configured Option82 option is inserted.

[Huawei-GigabitEthernet0/0/2]dhcp option8 rebuild enable  

[Huawei-vlan10]dhcp option82 insert enable

[Huawei-vlan10]dhcp option82 rebuild enable

(41) View the DHCP server group or server information configured on the relay interface

[Huawei]display dhcp relay all  

(42) View the configuration information of the DHCP server group

[Huawei]display dhcp server group a1

Guess you like

Origin blog.csdn.net/qq_60503432/article/details/128760026