Example: Configuring DHCP user class whitelist

Network configuration

As shown in Figure 22, configure the DHCP user class whitelist to allow the DHCP server to assign IP addresses to clients whose hardware addresses are six bytes long and begin with aabb-aabb.

Figure 22: Network diagram

Procedure


[IMPORTANT: ]

IMPORTANT:

By default, interfaces on the device are disabled (in ADM or Administratively Down state). To have an interface operate, you must use the undo shutdown command to enable that interface.


  1. Specify IP addresses for the interfaces on the DHCP server. (Details not shown.)

  2. Configure DHCP:

    # Create DHCP user class ss and configure a match rule to match DHCP requests in which the hardware address is six bytes long and begins with aabb-aabb.

    <SwitchB> system-view
    [SwitchB] dhcp class ss
    [SwitchB-dhcp-class-ss] if-match rule 1 hardware-address aabb-aabb-0000 mask ffff-ffff-0000
    [SwitchB-dhcp-class-ss] quit
    

    # Create DHCP address pool aa.

    [SwitchB] dhcp server ip-pool aa
    

    # Specify the subnet for dynamic allocation.

    [SwitchB-dhcp-pool-aa] network 10.1.1.0 mask 255.255.255.0
    

    # Enable the DHCP user class whitelist.

    [SwitchB-dhcp-pool-aa] verify class
    

    # Add DHCP user class ss to the DHCP user class whitelist.

    [SwitchB-dhcp-pool-aa] valid class ss
    [SwitchB-dhcp-pool-aa] quit
    

    # Enable DHCP.

    [SwitchB] dhcp enable
    

    # Enable DHCP server on VLAN-interface 2.

    [SwitchB] interface vlan-interface 2
    [SwitchB-Vlan-interface2] dhcp select server
    [SwitchB-Vlan-interface2] quit
    

Verifying the configuration

# Verify that clients matching the DHCP user class can obtain IP addresses on subnet 10.1.1.0/24 from the DHCP server. (Details not shown.)

# On the DHCP server, display the IP addresses assigned to the clients.

[SwitchB] display dhcp server ip-in-use
IP address       Client identifier/    Lease expiration      Type
                 Hardware address
10.1.1.2         aabb-aabb-ab01        Jan 14 22:25:03 2015  Auto(C)