Example for Configuring the DHCP Server to Allocate Different Network Parameters to Dynamic Clients and Static Clients in the Global Address Pool
Networking Requirements
As shown in Figure 3-13, the router functions as the enterprise egress gateway. The IP phone and PCs are devices in an office area. To uniformly manage devices and reduce manual configuration costs, the administrator needs to configure hosts to dynamically obtain IP addresses through DHCP. The PCs are the fixed terminal in the duty room. It should always be online and use domain names to access network devices. Besides obtaining an IP address dynamically, the PCs require an unlimited IP address lease and obtain information about the DNS server. The IP phone uses a fixed IP address 10.1.1.4/24 and its MAC address is 00e0-fc96-e4c0. Besides obtaining an IP address, the IP phone needs to dynamically obtain the startup configuration file. The startup configuration file named configuration.ini is saved on the FTP file server. There are reachable routes between the IP phone and the FTP file server. The gateway address of the PCs and IP phone is 10.1.1.1/24.
Configuration Roadmap
- Create a DHCP Option template on the router. In the DHCP Option template view, configure the startup configuration file for the static client IP phone, and configure an IP address for the network server that provides the startup configuration file.
- Create a global address pool on the router. In the global address pool view, configure the IP address lease and information about the DNS server for the dynamic client PCs. Bind an IP address to the MAC address of the static client IP phone and bind a DHCP Option template. In this way, the DHCP server can allocate different network parameters to dynamic and static clients.
Procedure
- Configure an IP address for the interface.
<Huawei> system-view [Huawei] sysname Router [Router] interface gigabitethernet 1/0/0 [Router-GigabitEthernet1/0/0] ip address 10.1.1.1 24 [Router-GigabitEthernet1/0/0] quit
- Enable DHCP.
[Router] dhcp enable
- Create a DHCP Option template. In the DHCP Option template view, configure the startup configuration file for the static client IP phone, and configure an IP address for the network server that provides the startup configuration file.
[Router] dhcp option template template1 [Router-dhcp-option-template-template1] gateway-list 10.1.1.1 [Router-dhcp-option-template-template1] bootfile configuration.ini [Router-dhcp-option-template-template1] next-server 10.1.1.3 [Router-dhcp-option-template-template1] quit
- Create an IP address pool. In the IP address pool view, configure the gateway address, IP address lease, and IP address of the DNS server for the PCs. Allocate a fixed IP address to the IP phone and configure the startup configuration file.
[Router] ip pool pool1 [Router-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.0 [Router-ip-pool-pool1] dns-list 10.1.1.2 [Router-ip-pool-pool1] gateway-list 10.1.1.1 [Router-ip-pool-pool1] excluded-ip-address 10.1.1.2 10.1.1.3 [Router-ip-pool-pool1] lease unlimited [Router-ip-pool-pool1] static-bind ip-address 10.1.1.4 mac-address 00e0-fc96-e4c0 option-template template1 [Router-ip-pool-pool1] quit
- Enable the DHCP server function on the interface.
[Router] interface gigabitethernet 1/0/0 [Router-GigabitEthernet1/0/0] dhcp select global [Router-GigabitEthernet1/0/0] quit
- Verify the configuration.
# Run the display ip pool name pool1 command on the router to check the IP address pool configuration.
[Router] 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: 1 Days 0 Hours 0 Minutes Address Statistic: Total :253 Used :4 Idle :247 Expired :0 Conflict :0 Disable :2 ------------------------------------------------------------------------------- Network section Start End Total Used Idle(Expired) Conflict Disabled ------------------------------------------------------------------------------- 192.168.1.1 192.168.1.254 253 4 247(0) 0 2 -------------------------------------------------------------------------------
# Run the display dhcp option template name template1 command on the router to check the DHCP Option template configuration.
[Router] 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
Router configuration file
# sysname Router # dhcp 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 00e0-fc96-e4c0 option-template template1 lease unlimited dns-list 10.1.1.2 # interface GigabitEthernet1/0/0 ip address 10.1.1.1 255.255.255.0 dhcp select global # return