< Home

(Optional) Configuring User-defined Options

Context

Vendors can define DHCP options. The device can function as a DHCP server to allocate vendor-defined network parameters to clients. When the device functions as a DHCP server, it can allocate network parameters using either of the following methods:
  • Based on the options in DHCP Discovery messages

    The device inserts an option configured using the dhcp server option (based on an interface address pool) or option (based on a global address pool) command into DHCP Reply messages to be sent to a client only when the client requests this option.

  • By forcibly appending the option field

    The device inserts an option configured using the dhcp server force insert option (based on an interface address pool) or force insert option (based on a global address pool) command into DHCP Reply messages to be sent to a client regardless of whether the client requests this option.

Procedure

  • Configure user-defined options based on an interface address pool.
    1. Enter the system view.

      system-view

    2. (Optional) Enable the DHCP server to trust Option 82.

      dhcp server trust option82

      By default, the device is enabled to trust Option 82.

    3. (Optional) Enable the DHCP server to check and discard DHCP messages with duplicate options.

       dhcp anti-attack check duplicate option [ option-start [ to option-end ] ] &<1-254>

      By default, a device is disabled from checking and discarding DHCP messages with duplicate options.

    4. Enter the interface or sub-interface view.

      interface interface-type interface-number[.subinterface-number ]

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731S-H, S5731-S, S5731S-S, S6720-HI, S5732-H, S6730-H, S6730S-H, S6730-S, S6730S-S, S6720-EI, and S6720S-EI support sub-interfaces.

    5. (Optional) On an Ethernet interface, run undo portswitch

      The interface is switched to Layer 3 mode.

      By default, an Ethernet interface works in Layer 2 mode.

      Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support switching between Layer 2 and Layer 3 modes.

    6. (Optional) Force the DHCP server to insert a specified option field into DHCP Reply messages.

      dhcp server force insert option code &<1-254>

      By default, the DHCP server does not forcibly insert a specified option field into DHCP Reply messages.

      After this function is configured, the device inserts an option field into DHCP Reply messages to be sent to clients regardless of whether the clients request this option.

    7. Configure user-defined options.

      dhcp server option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }

      By default, no user-defined option is configured.

      If an option carries a password, the option code in ascii or hex type is insecure. Therefore, you are advised to set the option code type to cipher. For security purposes, use a password that is at least six characters long and contains at least two types of the following: lowercase letters, uppercase letters, digits, and special characters.

      After an option is configured, the device inserts the option into DHCP Reply messages to be sent to clients only when the clients request this option.

      Not all options can be configured using the preceding command. The following table lists the options and their commands.
      Table 1 Commands for configuring options

      Option

      Configuration Command

      Description

      Option1

      mask-length in the ip address ip-address { mask | mask-length } command

      Subnet mask

      Option3

      ip-address in the ip address ip-address { mask | mask-length } command

      Gateway address

      Option6

      dhcp server dns-list ip-address &<1-8>

      DNS server IP address

      Option15

      dhcp server domain-name (interface view) domain-name

      Domain name

      Option44

      dhcp server nbns-list ip-address &<1-8>

      NetBIOS server IP address

      Option46

      dhcp server netbios-type { b-node | h-node | m-node | p-node }

      NetBIOS node type

      Option50

      N/A

      Requested IP address

      Option51

      dhcp server lease { day day [ hour hour [ minute minute ] ] | unlimited }

      IP address lease

      Option52

      N/A

      Additional option

      Option53

      N/A

      DHCP message type

      Option54

      N/A

      Server identifier

      Option55

      N/A

      Parameter request list

      Option57

      N/A

      Maximum length of a DHCP message

      Option58

      N/A

      Lease renewal time (T1), which is 50% of the lease time

      Option59

      N/A

      Lease renewal time (T2), which is 87.5% of the lease time

      Option61

      N/A

      Client identifier

      Option82

      N/A

      Relay agent information

      Option120

      dhcp server sip-server { ip-address ip-address &<1-2> | list domain-name &<1-2> }

      SIP server IP address

      Option121

      dhcp server option121 ip-address { ip-address mask-length gateway-address } &<1-8>

      A group of classless routes

      Option184

      dhcp server option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-address | voice-vlan vlan-id }

      Voice parameters

  • Configure user-defined options based on a global address pool.

    • In the global address pool view:

      1. Enter the system view.
        system-view
      2. (Optional) Enable the DHCP server to trust Option 82.

        dhcp server trust option82

        By default, the device is enabled to trust Option 82.

      3. Enter the global address pool view.
        ip pool ip-pool-name
      4. (Optional) Force the DHCP server to insert a specified option field into DHCP Reply messages.

        force insert option code &<1-254>

        By default, the DHCP server does not forcibly insert a specified option field into DHCP Reply messages.

      5. Configure user-defined options.

        option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }

        By default, no user-defined option is configured.

        If an option carries a password, the option code in ascii or hex type is insecure. Therefore, you are advised to set the option code type to cipher. For security purposes, use a password that is at least six characters long and contains at least two types of the following: lowercase letters, uppercase letters, digits, and special characters.

        Not all options can be configured using the preceding command. The following table lists the options and their commands.
        Table 2 Commands for configuring options

        Option

        Configuration Command

        Description

        Option1

        mask-length in the network (IP address pool view) ip-address [ mask { mask | mask-length } ]

        Subnet mask

        Option3

        gateway-list ip-address &<1-8>

        Gateway address

        Option6

        dns-list ip-address &<1-8>

        DNS server IP address

        Option15

        domain-name domain-name

        Domain name suffix

        Option44

        nbns-list ip-address &<1-8>

        NetBIOS server IP address

        Option46

        netbios-type { b-node | h-node | m-node | p-node }

        NetBIOS node type

        Option50

        N/A

        Requested IP address

        Option51

        lease { day day [ hour hour [ minute minute ] ] | unlimited }

        IP address lease

        Option52

        N/A

        Additional option

        Option53

        N/A

        DHCP message type

        Option54

        N/A

        Server identifier

        Option55

        N/A

        Parameter request list

        Option57

        N/A

        Maximum length of a DHCP message

        Option58

        N/A

        Lease renewal time (T1), which is 50% of the lease time

        Option59

        N/A

        Lease renewal time (T2), which is 87.5% of the lease time

        Option61

        N/A

        Client identifier

        Option82

        N/A

        Relay agent information

        Option120

        sip-server { ip-address ip-address &<1-2> | list domain-name &<1-2> }

        SIP server IP address

        Option121

        option121 ip-address { ip-address mask-length gateway-address } &<1-8>

        A group of classless routes

        Option184

        option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-address | voice-vlan vlan-id }

        Voice parameters

    • In the DHCP Option template view:

      1. Enter the system view.
        system-view
      2. Create a DHCP Option template and enter the DHCP Option template view.

        dhcp option template template-name

        By default, no DHCP Option template is created.

        To allocate network parameters except IP addresses to static clients, configure a DHCP Option template. Network parameters configured in the DHCP Option template view take effect only for static clients. For static clients, if a network parameter is configured in both the DHCP Option template view and global address pool view, only the configuration in the DHCP Option template view takes effect.

        To allocate only IP addresses to static clients (for details, see (Optional) Configuring Fixed IP Addresses in an Address Pool), you do not need to configure a DHCP Option template.

      3. (Optional) Force the DHCP server to insert a specified option field into DHCP Reply messages.

        force insert option code &<1-254>

        By default, the DHCP server does not forcibly insert a specified option field into DHCP Reply messages.

      4. Configure user-defined options.

        option code [ sub-option sub-code ] { ascii ascii-string | hex hex-string | cipher cipher-string | ip-address ip-address &<1-8> }

        By default, no user-defined option is configured.

        If an option carries a password, the option code in ascii or hex type is insecure. Therefore, you are advised to set the option code type to cipher. For security purposes, use a password that is at least six characters long and contains at least two types of the following: lowercase letters, uppercase letters, digits, and special characters.

        Not all options can be configured using the preceding command. See Table 2 for the list of options and their commands.

      5. Configure a classless static route to be allocated to clients.

        option121 ip-address { ip-address mask-length gateway-address } &<1-8>

        By default, no classless static route to be allocated to DHCP clients is configured.

      6. Configure Option 184.

        option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-address | voice-vlan vlan-id }

        By default, the Option 184 field is not configured.

        If you need to configure other items in the DHCP Option template view, complete them first before performing the following steps.

      7. (Optional) Return to the system view.
        quit
      8. (Optional) Enter the global address pool view.
        ip pool ip-pool-name
      9. (Optional) Bind a DHCP Option template to static clients.
        static-bind ip-address ip-address mac-address mac-address option-template template-name

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >