Example for Configuring a DHCP Client
Networking Requirements
As shown in Figure 3-17, GE0/0/1 on the router is enabled with the DHCP client function, and dynamically obtains network information such as IP addresses from the carrier's DHCP server.
GE0/0/2 on the router is enabled with the DHCP server function, and allocates information such as IP addresses and gateway addresses to the connected PCs. In addition, the function is enabled on the router that the DNS and NetBIOS server configurations can be automatically obtained from the address pool of GE0/0/2, so that these configurations assigned to PCs are the same as those assigned by the carrier.
Configuration Roadmap
- Enable the DHCP client function on GE0/0/1 so that the router can dynamically obtain IP addresses, DNS and NetBIOS server configurations from the DHCP server.
- Enable the DHCP server function on GE0/0/2 to use the interface address pool for address allocation. Enable the function of automatically obtaining DNS and NetBIOS server configurations to assign network parameters such as IP addresses, DNS and NetBIOS server configurations to PCs.
Before the configuration, ensure that the devices on the network can communicate with each other.
In this example, the carrier's DHCP server will deliver the configurations to the router. The configurations include the DNS server address 10.1.2.1, domain name suffix huawei, and NetBIOS server address 10.1.3.1. Configure the carrier's DHCP server before configuring the router.
Procedure
- Configure the DHCP client function on GE0/0/1.
<Huawei> system-view [Huawei] sysname Router [Router] interface gigabitethernet 0/0/1 [Router-GigabitEthernet0/0/1] ip address dhcp-alloc [Router-GigabitEthernet0/0/1] quit
- Enable the DHCP server function on GE0/0/2 to use the interface address pool for address allocation, and enable the function of automatically obtaining DNS and NetBIOS server configurations.
- Verify the configuration.
# Run the display dhcp client command on the router to view the status of the DHCP client function.
[Router] display dhcp client DHCP client lease information on interface GigabitEthernet0/0/1 : Current machine state : Bound Internet address assigned via : DHCP Physical address : 00e0-fcf7-310f IP address : 10.1.5.254 Subnet mask : 255.255.255.0 Gateway ip address : 10.1.5.1 DHCP server : 10.1.5.1 Lease obtained at : 2015-02-10 08:47:41 Lease expires at : 2015-02-11 08:47:41 Lease renews at : 2015-02-10 20:47:41 Lease rebinds at : 2015-02-11 05:47:41 Domain name : huawei DNS : 10.1.2.1 NBNS : 10.1.3.1
# Run the display ip pool import all command to view the DNS and NetBIOS server configurations dynamically obtained by the router.
[Router] display ip pool import all ----------------------------------------------------------------------------- Parameter Update time Protocol Value ----------------------------------------------------------------------------- domain-name 2015-02-10 08:47:41 dhcp huawei dns-server 2015-02-10 08:47:41 dhcp 10.1.2.1 nbns-server 2015-02-10 08:47:41 dhcp 10.1.3.1 -----------------------------------------------------------------------------