Dynamic IP address assignment configuration example

Network requirements

As shown in Figure 21, the DHCP server (Switch A) assigns IP addresses to clients in subnet 10.1.1.0/24.

In address pool 10.1.1.0/24, configure the address lease duration as 10 days and 12 hours, domain name suffix aabbcc.com, DNS server address 10.1.1.2/24, gateway 10.1.1.126/24, and WINS server 10.1.1.4/24.

Figure 21: Network diagram

Configuration procedure

  1. Specify IP addresses for VLAN interfaces. (Details not shown.)

  2. Configure the DHCP server:

    # Enable DHCP.

    <SwitchA> system-view
    [SwitchA] dhcp enable
    

    # Enable the DHCP server on VLAN-interface 1.

    [SwitchA] interface vlan-interface 1
    [SwitchA-Vlan-interface1] dhcp select server global-pool
    [SwitchA-Vlan-interface1] quit
    

    # Exclude the IP addresses of the DNS server, WINS server, and gateways from address allocation.

    [SwitchA] dhcp server forbidden-ip 10.1.1.2
    [SwitchA] dhcp server forbidden-ip 10.1.1.4
    [SwitchA] dhcp server forbidden-ip 10.1.1.126
    

    # Configure DHCP address pool 0 (subnet, client domain name suffix, and DNS server address).

    [SwitchA] dhcp server ip-pool 0
    [SwitchA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0
    [SwitchA-dhcp-pool-0] domain-name aabbcc.com
    [SwitchA-dhcp-pool-0] expired day 10 hour 12
    [SwitchA-dhcp-pool-0] dns-list 10.1.1.2
    [SwitchA-dhcp-pool-0] gateway-list 10.1.1.126
    [SwitchA-dhcp-pool-0] nbns-list 10.1.1.4
    [SwitchA-dhcp-pool-0] quit
    

Verifying the configuration

After the preceding configuration is complete, clients on networks 10.1.1.0/24 can obtain IP addresses on the corresponding network and other network parameters from Switch A. You can use the display dhcp server ip-in-use command on the DHCP server to view the IP addresses assigned to the clients.