DHCP option customization configuration example

Network requirements

As shown in Figure 25, DHCP clients obtain IP addresses and PXE server addresses from the DHCP server (Router A). The subnet for address allocation is 10.1.1.0/24.

Configure the address allocation scheme as follows:

Assign PXE addresses

To clients

2.3.4.5 and 3.3.3.3

The hardware address in the request is six bytes long and begins with aabb-aabb.

1.2.3.4 and 2.2.2.2.

Other clients.

The DHCP server assigns PXE server addresses to DHCP clients through Option 43, a custom option. The formats of Option 43 and PXE server address sub-option are shown in Figure 15 and Figure 17. For example, the value of Option 43 configured in the DHCP address pool is 80 0B 00 00 02 01 02 03 04 02 02 02 02.

Figure 25: Network diagram

Configuration procedure

  1. Specify an IP address for interface GigabitEthernet 1/0/1. (Details not shown.)

  2. Configure the DHCP server:

    # Enable DHCP.

    <RouterA> system-view
    [RouterA] dhcp enable
    

    # 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.

    [RouterA] dhcp class ss
    [RouterA-dhcp-class-ss] if-match rule 1 hardware-address aabb-aabb-0000 mask ffff-ffff-0000
    [RouterA-dhcp-class-ss] quit
    

    # Create DHCP option group 1 and customize Option 43.

    [RouterA] dhcp option-group 1
    [RouterA-dhcp-option-group-1] option 43 hex 800B0000020203040503030303
    

    # Enable the DHCP server on GigabitEthernet 1/0/1.

    [RouterA] interface gigabitethernet 1/0/1
    [RouterA-GigabitEthernet1/0/1] dhcp select server
    [RouterA-GigabitEthernet1/0/1] quit
    

    # Create DHCP address pool 0.

    [RouterA] dhcp server ip-pool 0
    

    # Specify the subnet for dynamic address allocation.

    [RouterA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0
    

    # Customize Option 43.

    [RouterA-dhcp-pool-0] option 43 hex 800B0000020102030402020202
    

    # Associate DHCP user class ss with option group 1.

    [RouterA-dhcp-pool-0] class ss option-group 1
    [RouterA-dhcp-pool-0] quit
    

Verifying the configuration

# Verify that Router B can obtain an IP address on subnet 10.1.1.0/24 and the corresponding PXE server addresses from Router A. (Details not shown.)

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

[RouterA] 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)