Connexite

Connexite

Did You Know?

SQL schemes can be validated with ConnexOne database application control

Configuring DHCP Server

Estimated reading: 7 minutes 1 views

Summary: Networking › Switching › Edge › Synapse

Overview of DHCP Server

DHCP (Dynamic Host Configuration Protocol) is a local area network network protocol that works using the UDP protocol and is widely used to dynamically allocate reusable network resources such as IP addresses. DHCP is based on the Client/Server working mode. The DHCP client obtains the IP address from the DHCP server by sending a request message, and other configuration information. When the DHCP client and server are not on the same subnet, there must be a DHCP relay agent (DHCP Relay) to forward DHCP request and reply messages. Protocol Standard: RFC2132 DHCP Options and BOOTP Vendor Extensions. S. Alexander, R. Droms. March 1997. (Format: TXT, HTML) (Obsoletes RFC1533) (Updated by RFC3442, RFC3942, RFC4361, RFC4833, RFC5494) (Status: DRAFT STANDARD) (DOI: 10.17487/RFC2132)

Configuring

Global Configuration Commands

  • Enabling/disabling DHCP Server Globally
SWITCH(config)# ip dhcp-server enable
SWITCH(config)#no ip dhcp-server enable

Enable and disable the DHCP server globally.

SWITCH(config)# ip dhcp-server parameter NAME VALUE
SWITCH(config)# ip dhcp-server parameter (authoritative (on|off) | server-name NAME | server-identifier IDENTIFY | default-lease-time <1-2147483648> | max-lease-time <1-2147483648> | ping-timeout-ms <1-65535> | ping-timeout <1-65535>)
SWITCH(config)# no ip dhcp-server parameter NAME
SWITCH(config)# no ip dhcp-server parameter (authoritative | server-name | server-identifier | default-lease-time | max-lease-time | ping-timeout-ms | ping-timeout)

Global parameter configuration. When parameter values conflict, global parameters take precedence over parameters for subnets and address pools with more precise ranges. Default lease time: 43200s/12h. Optional.

SWITCH(config)# ip dhcp-server option NAME VALUE
SWITCH(config)# ip dhcp-server option (routers A.B.C.D | domain-name NAME | domain-name-servers A.B.C.D | capwap-ac-v4 A.B.C.D)
SWITCH(config)# no ip dhcp-server option NAME
SWITCH(config)# no ip dhcp-server option (routers | domain-name | domain-name-servers | capwap-ac-v4)

Global option configuration. When option values conflict, global options take precedence over options for subnets and address pools with more precise ranges. Optional.

SWITCH(config)# ip dhcp-server custom-space NAME [code width <1-4>] [length width <1-4>] [hash size <1-65535>]
SWITCH(config)#no ip dhcp-server custom-space NAME

Configure custom domain information fields. Optional.

SWITCH(config)# ip dhcp-server custom-option NAME code <1-255> (boolean|integer|ip-address|text|string|encapsulate)
SWITCH(config)#no ip dhcp-server custom-option NAME

Configure custom options fields. The configured custom option code value cannot conflict with the configured common options. Optional.

SWITCH(config)# ip dhcp-server force-option <1-255>
SWITCH(config)#no ip dhcp-server force-option <1-255>

Configure mandatory options fields. Optional.

SWITCH(config)# ip dhcp-server static-lease NAME XX:XX:XX:XX:XX:XX A.B.C.D
SWITCH(config)#no ip dhcp-server static-lease NAME

Configure static address binding. Optional.

SWITCH(config)# ip dhcp-server whitelist NAME XX:XX:XX:XX:XX:XX
SWITCH(config)#no ip dhcp-server whitelist NAME

Configure the whitelist. Optional.

SWITCH(config)# ip dhcp-server blacklist NAME XX:XX:XX:XX:XX:XX
SWITCH(config)#no ip dhcp-server blacklist NAME

Configure the blacklist. Optional.

SWITCH(config)# ip dhcp-server class NAME match EXP
SWITCH(config)#no ip dhcp-server class NAME

Configure custom classification. For professional usage, please configure it under the guidance of technicians. Example: ip dhcp-server class win_pc match " substring (option vendor-class-identifier,0,4)=MSFT " Optional.

Subnet Configuration Command

  • Configuring Subnet Information
SWITCH(config)# ip dhcp-server subnet A.B.C.D/M
SWITCH(config)#no ip dhcp-server subnet A.B.C.D/M

Configure subnet information and enter subnet configuration mode. At least one correct subnet configuration is required for the server to start normally.

SWITCH(config-dhcp-subnet)# range A.B.C.D A.B.C.D
SWITCH(config-dhcp-subnet)#no range A.B.C.D

Configure the address range of the subnet. The server needs at least one assignable address range to start normally, which can be configured in the address pool below. Can be configured multiple times, with different ranges.

SWITCH(config-dhcp-subnet)# parameter NAME VALUE
SWITCH(config-dhcp-subnet)# parameter (authoritative (on|off) | server-name NAME | server-identifier IDENTIFY | default-lease-time <1-2147483648> | max-lease-time <1-2147483648> | ping-timeout-ms <1-65535> | ping-timeout <1-65535>)
SWITCH(config-dhcp-subnet)#no parameter NAME
SWITCH(config-dhcp-subnet)#no parameter (authoritative | server-name | server-identifier | default-lease-time | max-lease-time | ping-timeout-ms | ping-timeout)

Configuration parameter information. Optional.

SWITCH(config-dhcp-subnet)# option NAME VALUE
SWITCH(config-dhcp-subnet)# option (routers A.B.C.D | domain-name NAME | domain-name-servers A.B.C.D | capwap-ac-v4 A.B.C.D)
SWITCH(config-dhcp-subnet)#no option NAME
SWITCH(config-dhcp-subnet)#no option (routers | domain-name | domain-name-servers | capwap-ac-v4)

Configuration option information. It is usually necessary to configure the gateway routing address and DNS server address of the subnet. Optional.

Address Pool Configuration Command

  • Configuring Address Pool Information
SWITCH(config-dhcp-subnet)# pool NAME
SWITCH(config-dhcp-subnet)#no pool NAME

Configure the address pool in subnet mode. Subnets can be further divided through the address pool and used on demand. Optional.

SWITCH(config-dhcp-pool)# range A.B.C.D A.B.C.D
SWITCH(config-dhcp-pool)#no range A.B.C.D

Configure the address range of the address pool. The server needs at least one assignable address range to start normally, which can be configured in the above subnet. Can be configured multiple times, with different ranges.

SWITCH(config-dhcp-pool)# parameter NAME VALUE
SWITCH(config-dhcp-pool)# parameter (authoritative (on|off) | server-name NAME | server-identifier IDENTIFY | default-lease-time <1-2147483648> | max-lease-time <1-2147483648> | ping-timeout-ms <1-65535> | ping-timeout <1-65535>)
SWITCH(config-dhcp-pool)#no parameter NAME
SWITCH(config-dhcp-pool)#no parameter (authoritative | server-name | server-identifier | default-lease-time | max-lease-time | ping-timeout-ms | ping-timeout)

Configuration parameter information. Optional.

SWITCH(config-dhcp-pool)# option NAME VALUE
SWITCH(config-dhcp-pool)# option (routers A.B.C.D | domain-name NAME | domain-name-servers A.B.C.D | capwap-ac-v4 A.B.C.D)
SWITCH(config-dhcp-pool)#no option NAME
SWITCH(config-dhcp-pool)#no option (routers | domain-name | domain-name-servers | capwap-ac-v4)

Configuration option information. It is usually necessary to configure the gateway routing address and DNS server address of the address pool. Optional.

SWITCH(config-dhcp-pool)# (allow|deny|ignore) CLASSNAME
SWITCH(config-dhcp-pool)# (allow|deny|ignore) (known-clients|unknown-clients|bootp|duplicates|declines)
SWITCH(config-dhcp-pool)# no (allow|deny|ignore) (CLASSNAME|known-clients|unknown-clients|bootp|duplicates|declines)

Configure the address pool filter conditions. Custom CLASSNAME refer to the Configuring Custom Classifications section in the global configuration. Optional.

Examples

General DHCP Server Address Assignment Scenario

‏ • Requirement See the description of the network diagram. ‏ • Network Diagram Figure281 DHCP server typical network diagram Description: The MAC address of PC3 during the test is 00:0E:C6:C1:38:41 ‏ • Typical Configuration Example S1:

SWITCH(config)# ip dhcp-server subnet 192.168.100.0/24
SWITCH(config-dhcp-subnet)#range 192.168.100.2 192.168.100.254
SWITCH(config-dhcp-subnet)#option routers 192.168.100.1
SWITCH(config-dhcp-subnet)#exit
SWITCH(config)# ip dhcp-server subnet 192.168.200.0/24
SWITCH(config-dhcp-subnet)#range 192.168.200.2 192.168.200.254
SWITCH(config-dhcp-subnet)#option routers 192.168.200.1
SWITCH(config-dhcp-subnet)#exit
SWITCH(config)# ip dhcp-server static-lease pc3 00:0E:C6:C1:38:41 192.168.200.2
SWITCH(config)#ip dhcp-server option domain-name-servers 114.114.114.114
SWITCH(config)#ip dhcp-server enable

S2/S3: Empty configuration transparent transmission. ‏ • Requirement See the description of the network diagram. ‏ • Network Diagram Figure 282 DHCP server typical network diagram ‏ • Typical Configuration Example S1:

SWITCH(config)# ip dhcp-server custom-space dkwl code width 1 length width 1
SWITCH(config)# ip dhcp-server custom-option dkwl.name code 1 string
SWITCH(config)# ip dhcp-server custom-option dkwl.ip code 2 ip-address
SWITCH(config)# ip dhcp-server custom-option vendor_dkwl code 43 encapsulate dkwl
SWITCH(config)# ip dhcp-server option dkwl.ip 1.1.1.1
SWITCH(config)# ip dhcp-server option dkwl.name "dockeer"
SWITCH(config)# ip dhcp-server subnet 192.168.100.0/24
SWITCH(config-dhcp-subnet)#range 192.168.100.2 192.168.100.254
SWITCH(config-dhcp-subnet)#option routers 192.168.100.1
SWITCH(config-dhcp-subnet)#exit
SWITCH(config)#ip dhcp-server option domain-name-servers 114.114.114.114
SWITCH(config)#ip dhcp-server enable

A DHCP Server Address Assignment Scenario that Supports Guest Separation

‏ • Requirement

  • See the description of the network diagram.
  • Normal user allocation addresses 192.168.100.2-192.168.100.100 and 192.168.200.2-192.168.200.100.
  • Guest assigned address 192.168.100.200-192.168.100.254.

‏ • Network Diagram Figure 283 DHCP server typical network diagram ‏ • Typical Configuration Example S1:

SWITCH(config)# ip dhcp-server subnet 192.168.100.0/24
SWITCH(config-dhcp-subnet)#range 192.168.100.2 192.168.100.100
SWITCH(config-dhcp-subnet)#option routers 192.168.100.1
SWITCH(config-dhcp-subnet)#exit
SWITCH(config)# ip dhcp-server subnet 192.168.200.0/24
SWITCH(config-dhcp-subnet)#pool employee
SWITCH(config-dhcp-pool)#range 192.168.200.2 192.168.200.100
SWITCH(config-dhcp-pool)#deny unknown-clients
SWITCH(config-dhcp-pool)#pool guest
SWITCH(config-dhcp-pool)#range 192.168.200.200 192.168.200.254
SWITCH(config-dhcp-pool)#allow unknown-clients
SWITCH(config-dhcp-pool)#exit
SWITCH(config-dhcp-subnet)#option routers 192.168.200.1
SWITCH(config-dhcp-subnet)#exit
SWITCH(config)#ip dhcp-server option domain-name-servers 114.114.114.114
SWITCH(config)#ip dhcp-server enable

S2/S3: Empty configuration transparent transmission.

Display Information

  • Display DHCP Server Status Information
SWITCH#show ip dhcp-server status

DHCP Server: Enable (conf.Enable)

SWITCH#show ip dhcp-server leases

Name MAC IP Begin End Manufacturer

——————– ——————– — —————– ——————– ————- ——- ——————– liulang-work 00:0e:c6:c1:38:4a 3.3.3.254 1970-01-01 00:00:36 1970-01-01 00:10:36 ASIX ELECTRONICS CORP.

Share this Doc

Configuring DHCP Server

Or copy link