Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »


Introduction

Dynamic Host Configuration Protocol (DHCP) is a protocol that dynamically configures and centrally manages the network parameters of the hosts based on TCP / IP protocol, which can be used to:

  • Dynamically assign IP addresses to network hosts. Assign an IP address to a host via DHCP with an expiration time (often called a lease time). The default lease time is one hour.
  • Provide other network parameters for network hosts, such as the IP address of the DNS server, domain name information and default gateway address.

Configuration Notes

Pay attention to the following points when configuring DHCP server:

  • The current DHCP implementation requires the DHCP client and the server to be in the same subnet, but doesn’t support the case where the clients communicate with the DHCP server from a different network segment through DHCP relay agent.
  • The network segment of the IP address pool is required to be on the same network segment as the VLAN interface connected to the DHCP client.
  • Enabling DHCP client, DHCP relay or DHCP server functions in block VLAN is not supported.
  • Enabling DHCP client, DHCP snooping/relay and DHCP server functions in the same VLAN is not supported. Where DHCP snooping and DHCP relay don’t have this limitation, they can be enabled in the same VLAN.
  • Enabling both DHCP relay and DHCP server functions in the same VRF is supported.
  • If both DHCP server and DHCP relay are deployed on the same switch, don’t use the VLAN interface enabled with DHCP server to connect to the remote DHCP server.
  • DHCP server feature supports only IPv4, and doesn’t support IPv6.
  • DHCP server supports VRF by binding the address pool and the VLAN interface (which is connected to the DHCP client) to the same VRF.
  • One VRF will run a DHCP server instance. So different VRFs will have different DHCP server instances.
  • In each VRF, at most 1000 DHCP clients are allowed. 
  • Multiple address pools can be configured in the same VRF, but there cannot be address overlap between individual pools. However, address pools in different VRFs do not have this restriction.
  • When multiple address ranges are configured under one address pool, there should be no address overlap between these ranges.
  • The default router is the default gateway of the DHCP client, which is required to be on the same network segment as the address pool.
  • In a VRRP topology, if the DHCP server function is enabled, the address pool configured on the master cannot overlap with that configured on the backup switch.
  • Adding, deleting and modifying any parameter in the DHCP address pool will result in the deletion of DHCP server binding table in this VRF.

Configuring DHCP Server

Procedure

Step 1       Create an address pool and specify the IPv4 network segment that can be dynamically allocated to the DHCP clients.

                 set protocols dhcp server pool <pool-name> network <IPv4Net>

Step 2       Configure the VLAN interface connected to the DHCP client.

 set vlans vlan-id <vlan-id>

 set vlans vlan-id <vlan-id> l3-interface <interface-name>

 set l3-interface  vlan-interface <interface-name> address <ip-address> prefix-length <number>

Step 3       (Optional) Associate the VLAN interface with a VRF.

  If you want to configure the DHCP server for a user-defined VRF, you need to configure this step.

  set l3-interface vlan-interface <interface-name> vrf <vrf-name>

Step 4       (Optional) Configure the lower and upper boundaries of an address range in the address  

          set protocols dhcp server pool <pool-name> range <range-name> low <ipv4-address>

          set protocols dhcp server pool <pool-name> range <range-name> high <ipv4-address>

NOTE:

  • The address range is optional. If not configured, it means that all the IP addresses in the address pool are available for address assignment. However, if configured, only addresses in the range can be used for address assignment.
  • When multiple address ranges are configured under an address pool, there should be no address overlap between different ranges.

Step 5       (Optional) Configure a lease time for the IP addresses in an address pool.

  set protocols dhcp server pool <pool-name> lease-time <lease-time>

  By default, the lease time is 60 minutes.

Step 6       (Optional) Configure the IP address of the DNS server and domain name for the DHCP

  a) Configure the IP address of the DNS server.

  set protocols dhcp server pool <pool-name> dns-server <dns-server-ip>

NOTE:

  • By default, no DNS server IP address is configured in a DHCP address pool.
  • Each address pool can be configured with a maximum of eight DNS server IP addresses.

  b) Configure a domain name for the DHCP clients.

  set protocols dhcp server pool <pool-name> domain-name <domain-name>

Step 7       (Optional) Configure a default gateway address for the DHCP clients.

  set protocols dhcp server pool <pool-name> default-router <router-ip address>

Step 8       (Optional) Assign a DHCP address pool to a VRF.

                 set protocols dhcp server pool <pool-name> vrf <vrf-name>

 By default, no VRF is configured for an address pool, the address pool belongs to the default VRF.

Configuration Example

Networking Requirements

Figure 1 DHCP Server Configuration Example

As shown in Figure 1, an enterprise has planned two network segments for the office terminals. PCs in the network segment 10.1.10.0/24 are the fixed terminals, and the network segment 10.2.10.0/24 is used for temporary users accessing to the network. To facilitate unified administration, the enterprise terminals can automatically obtain IP address and DNS server address from the DHCP server.

By configuring DHCP server on Pica8 switch, IP address and DNS server address can be dynamically assigned to the terminals in the two separate network segments of the enterprise. Among them, the PCs in network segment 10.1.10.0/24 are the fixed office terminal, and the IP lease time is 30 days; the network segment 10.2.10.0/24 provides temporary accesses to the network for business travelers, and the IP lease time is 2 days.

Procedure

Step 1       Configure the VLAN interface connected to the DHCP client.

admin@Xorplus# set vlans vlan-id 100
admin@Xorplus# set vlans vlan-id 200
admin@Xorplus# set interface gigabit-ethernet ge-1/1/1 family ethernet-switching native-vlan-id 100
admin@Xorplus# set interface gigabit-ethernet ge-1/1/2 family ethernet-switching native-vlan-id 200
admin@Xorplus# set vlans vlan-id 100 l3-interface vlan100
admin@Xorplus# set vlans vlan-id 200 l3-interface vlan200
admin@Xorplus# set l3-interface vlan-interface vlan100 address 10.1.10.11 prefix-length 24
admin@Xorplus# set l3-interface vlan-interface vlan200 address 10.2.10.11 prefix-length 24

Step 2       Create two address pools and specify the IPv4 network segment that can be dynamically allocated to the DHCP clients.

admin@Xorplus# set protocols dhcp server pool pool1 network 10.1.10.0/24
admin@Xorplus# set protocols dhcp server pool pool2 network 10.2.10.0/24

Step 3       Configure the lease time for the IP addresses in the address pool.

admin@Xorplus# set protocols dhcp server pool pool1 lease-time 43200
admin@Xorplus# set protocols dhcp server pool pool2 lease-time 2880

                  By default, the IP address lease is one hour.

Step 4       Configure the IP address of the DNS server and domain name for the DHCP clients.

  a) Configure the IP address of the DNS server for each address pool.

admin@Xorplus# set protocols dhcp server pool pool1 dns-server 10.3.10.1
admin@Xorplus# set protocols dhcp server pool pool2 dns-server 10.3.10.1

                  By default, no DNS server is configured in an address pool.

  b) Configure domain name for the DHCP clients.

admin@Xorplus# set protocols dhcp server pool pool1 domain-name company.com

Verify the Configuration

  • The IP address and DNS server address of the 10.1.10.0/24 network segment can be obtained from the DHCP server by the PCs in the zone of DHCP client A, and the IP address and DNS server address of the 10.2.10.0/24 network segment can be obtained from the DHCP server by the PCs in the zone of DHCP client B.
  • Run the command run show dhcp server binding on the switch to view the allocated IP address binding information.
admin@Xorplus# run show dhcp server binding
2 bound clients
            
IP address       MAC address          Server        Interface
10.1.10.89       00:0a:12:00:12:12    10.1.10.11    vlan100
10.2.10.88       00:0a:12:00:12:34    10.2.10.11    vlan200

admin@Xorplus# run show dhcp server binding interface vlan100
Client Interface: vlan100
    MAC address:          00:0a:12:00:12:12
    Client IP Address:      10.1.10.89

    DHCP Options :    
    Name: dhcp-lease-time, Value: 43200 minutes      
    Name: name-server, Value: [10.3.10.1]
    Name: server-identifier, Value: 10.1.10.11
    Name: router, Value: [ 10.1.10.11 ]
    Name: domain-name, Value: company.com
  • No labels