< Home

Example for Configuring a DHCP Server to Allocate Different Network Parameters from a Global Address Pool to Dynamic and Static Clients

Networking Requirements

In Figure 1, the IP phone and PCs described represent typical in an office. To uniformly manage these devices and reduce manual configuration costs, the administrator needs to configure hosts to dynamically obtain IP addresses using DHCP.

PCs are fixed terminals in the duty room and need to be always online and use domain names to access network devices. PCs also require the unlimited IP address lease time and need to obtain information about the DNS server.

The IP phone (MAC address dcd2-fc96-e4c0) needs a fixed IP address 10.1.1.4/24 and needs to dynamically obtain its startup configuration file configuration.ini from the FTP server. There are reachable routes between the FTP server and IP phone. The gateway address of the PCs and IP phone is 10.1.1.1/24.

Figure 1 Networking diagram for configuring a DHCP server to allocate different network parameters to dynamic and static clients

Configuration Roadmap

  1. Create a DHCP Option template on SwitchA.
    1. In the DHCP Option template view, configure the startup configuration file for the static client IP phone.
    2. Specify the FTP server IP address for the IP phone.
  2. Create a global address pool on SwitchA.
    1. In the global address pool view, configure an IP address lease and DNS server information for the dynamic client PCs.
    2. Bind an IP address and the DHCP Option template to the MAC address of the static client IP phone.

Procedure

  1. Create a VLAN and configure an IP address for the VLANIF interface connecting SwitchA to SwitchB.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan 10
    [SwitchA-vlan10] quit
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type hybrid
    [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 10
    [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 10
    [SwitchA-GigabitEthernet0/0/1] quit
    [SwitchA] interface vlanif 10
    [SwitchA-Vlanif10] ip address 10.1.1.1 255.255.255.0
    [SwitchA-Vlanif10] quit
    

  2. Enable DHCP.

    [SwitchA] dhcp enable

  3. Create a DHCP Option template.

    In the DHCP Option template view, configure the startup configuration file for the static client IP phone and specify the IP address of the file server for the IP phone to obtain the startup configuration file.

    [SwitchA] dhcp option template template1
    [SwitchA-dhcp-option-template-template1] gateway-list 10.1.1.1
    [SwitchA-dhcp-option-template-template1] bootfile configuration.ini 
    [SwitchA-dhcp-option-template-template1] next-server 10.1.1.3
    [SwitchA-dhcp-option-template-template1] quit

  4. Create an IP address pool.

    In the IP address pool view, configure the gateway address, IP address lease, and DNS server IP address for the PCs. Allocate a fixed IP address to the IP phone and configure the startup configuration file.

    [SwitchA] ip pool pool1
    [SwitchA-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.0
    [SwitchA-ip-pool-pool1] dns-list 10.1.1.2
    [SwitchA-ip-pool-pool1] gateway-list 10.1.1.1
    [SwitchA-ip-pool-pool1] excluded-ip-address 10.1.1.2 10.1.1.3
    [SwitchA-ip-pool-pool1] lease unlimited
    [SwitchA-ip-pool-pool1] static-bind ip-address 10.1.1.4 mac-address dcd2-fc96-e4c0 option-template template1 
    [SwitchA-ip-pool-pool1] quit

  5. Enable the DHCP server function on the VLANIF 10 interface.

    [SwitchA] interface vlanif 10
    [SwitchA-Vlanif10] dhcp select global
    [SwitchA-Vlanif10] quit

  6. Enable the device to save DHCP data to the storage device. If a fault occurs on the device, you can run the dhcp server database recover command after the system restarts to restore DHCP data from files on the storage device.

    [SwitchA] dhcp server database enable

  7. Verify the configuration.

    # Run the display ip pool name pool1 command on SwitchA to view the address pool configuration.

    [SwitchA] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : unlimited
      Domain-name      : -
      DNS-server0      : 10.1.1.2
      NBNS-server0     : -
      Netbios-type     : -
      Position         : Local
      Status           : Unlocked
      Gateway-0        : 10.1.1.1
      Network          : 10.1.1.0
      Mask             : 255.255.255.0
      VPN instance     : --
      Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :253       Used        :4                      
                         Idle        :247       Expired     :0                      
                         Conflict    :0         Disabled     :2                      
                                                                                    
     -------------------------------------------------------------------------------
      Network section
             Start           End       Total    Used Idle(Expired) Conflict Disabled
     -------------------------------------------------------------------------------
            10.1.1.1      10.1.1.254     253       4        247(0)       0     2   
     -------------------------------------------------------------------------------

    # Run the display dhcp option template name template1 command on SwitchA to view the DHCP Option template configuration.

    [SwitchA] display dhcp option template name template1
     -------------------------------------------------------------------------------
      Template-Name  : template1                                                    
      Template-No    : 0                                                            
      Next-server    : 10.1.1.3                                                     
      Domain-name    : -                                                            
      DNS-server0    : -                                                            
      NBNS-server0   : -                                                            
      Netbios-type   : -                                                            
      Gateway-0      : 10.1.1.1                                                     
      Bootfile       : configuration.ini                                            

Configuration Files

SwitchA configuration file

#
sysname SwitchA
#
vlan batch 10
#
dhcp enable
#
dhcp server database enable                                                     
#                                                                               
dhcp option template template1                                                  
 gateway-list 10.1.1.1                                                          
 next-server 10.1.1.3                                                           
 bootfile configuration.ini  
#
ip pool pool1
 gateway-list 10.1.1.1                                                          
 network 10.1.1.0 mask 255.255.255.0                                            
 excluded-ip-address 10.1.1.2 10.1.1.3                                          
 static-bind ip-address 10.1.1.4 mac-address dcd2-fc96-e4c0 option-template template1                                                                          
 lease unlimited                                                                
 dns-list 10.1.1.2        
#
interface Vlanif10
 ip address 10.1.1.1 255.255.255.0
 dhcp select global  
#
interface GigabitEthernet0/0/1
 port link-type hybrid
 port hybrid pvid vlan 10
 port hybrid untagged vlan 10 
#
return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >