Got it

how to Configure a DHCP Client?

Created: Yesterday 08:35Latest reply: Apr 20, 2022 08:44:42 74 3 0 0 0
  HiCoins as reward: 0 (problem unresolved)
how to Configure a DHCP Client?

Featured Answers

Recommended answer

AymanOT
MVE Author Created Yesterday 08:35

Configuring a DHCP Client

Networking Requirements

In Figure 4-17, Switch_1 functions as a DHCP client and needs to dynamically obtain an IP address, DNS server address, and gateway address from a DHCP server (Switch_2).

Figure 4-17  Networking diagram for configuring a DHCP client
download?uuid=d7553131e1f04b158aa3df8b7f8bcee9

Configuration Roadmap

  1. Configure Switch_1 as a DHCP client to dynamically obtain an IP address from the DHCP server.

  2. Configure Switch_2 as a DHCP server to dynamically allocate network parameters including IP addresses to Switch_1.

Procedure

  1. Configure Switch_1 as a DHCP client.

    # Create VLAN 10 and add GE0/0/1 to VLAN 10.

    <HUAWEI> system-view[HUAWEI] sysname Switch_1[Switch_1] vlan 10[Switch_1-vlan10] quit[Switch_1] interface gigabitethernet 0/0/1[Switch_1-GigabitEthernet0/0/1] port link-type trunk[Switch_1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_1-GigabitEthernet0/0/1] quit

    # Enable the DHCP client function on VLANIF 10.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] ip address dhcp-alloc[Switch_1-Vlanif10] quit
  2. Create a global address pool on Switch_2 and set attributes for the pool.

    1. Enable DHCP.

      <HUAWEI> system-view[HUAWEI] sysname Switch_2[Switch_2] dhcp enable
    2. Create VLAN 10 and add GE0/0/1 to VLAN 10.

      [Switch_2] vlan 10[Switch_2-vlan10] quit[Switch_2] interface gigabitethernet 0/0/1[Switch_2-GigabitEthernet0/0/1] port link-type trunk[Switch_2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_2-GigabitEthernet0/0/1] quit
    3. Configure VLANIF 10 to work in global address pool mode.

      [Switch_2] interface vlanif 10[Switch_2-Vlanif10] ip address 192.168.1.1 24[Switch_2-Vlanif10] dhcp select global[Switch_2-Vlanif10] quit
    4. Create an address pool and set attributes for the pool.

      [Switch_2] ip pool pool1[Switch_2-ip-pool-pool1] network 192.168.1.0 mask 24[Switch_2-ip-pool-pool1] gateway-list 192.168.1.126[Switch_2-ip-pool-pool1] dns-list 192.168.1.2[Switch_2-ip-pool-pool1] excluded-ip-address 192.168.1.2[Switch_2-ip-pool-pool1] quit
  3. Verify the configuration.

    # Run the display this command on VLANIF 10 of Switch_1 to view the DHCP client configuration.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] display this#
    interface Vlanif10
     ip address dhcp-alloc
    #
    return

    # After VLANIF 10 obtains an IP address, run the display dhcp client command on Switch_1 to view the status of the DHCP client on VLANIF 10.

    [Switch_1] display dhcp clientDHCP client lease information on interface Vlanif10 :
     Current machine state         : Bound
     Internet address assigned via : DHCP
     Physical address              : 0025-9efb-be55
     IP address                    : 192.168.1.254
     Subnet mask                   : 255.255.255.0
     Gateway ip address            : 192.168.1.126
     DHCP server                   : 192.168.1.1
     Lease obtained at             : 2014-09-10 20:30:39
     Lease expires at              : 2014-09-11 20:30:39
     Lease renews at               : 2014-09-11 08:30:39
     Lease rebinds at              : 2014-09-11 17:30:39
     DNS                           : 192.168.1.2

    # On Switch_2, run the display ip pool name pool1 command to view IP address allocation in the address pool. The Used field displays the number of used IP addresses in the address pool.

    [Switch_2] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : 1 Days 0 Hours 0 Minutes
      Domain-name      : -
      DNS-server0      : 192.168.1.2
      NBNS-server0     : -
      Netbios-type     : -
      Position         : Local           Status           : Unlocked
      Gateway-0        : 192.168.1.126
      Network          : 192.168.1.0
      Mask             : 255.255.255.0  VPN instance     : --  Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :253       Used        :1
                         Idle        :251       Expired     :0
                         Conflict    :0         Disabled     :1
    
     -------------------------------------------------------------------------------
      Network section
             Start           End     Total  Used  Idle(Expired)  Conflict  Disable
     -------------------------------------------------------------------------------
         192.168.1.1   192.168.1.254     253       1        251(0)       0     1
     -------------------------------------------------------------------------------

Configuration Files

  • Switch_1 configuration file

    #
    sysname Switch_1
    #
    vlan batch 10
    #
    interface Vlanif10
     ip address dhcp-alloc
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    return
  • Switch_2 configuration file

    #
    sysname Switch_2
    #
    vlan batch 10
    #
    dhcp enable
    #
    ip pool pool1
     gateway-list 192.168.1.126
     network 192.168.1.0 mask 255.255.255.0
     excluded-ip-address 192.168.1.2
     dns-list 192.168.1.2
    #
    interface Vlanif10
     ip address 192.168.1.1 255.255.255.0
     dhcp select global
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    return
View more
  • x
  • convention:

All Answers
Hi,
Kindly wait for a second, our engineers are processing your question and will feedback to you as soon as possible.
View more
  • x
  • convention:

Configuring a DHCP Client

Networking Requirements

In Figure 4-17, Switch_1 functions as a DHCP client and needs to dynamically obtain an IP address, DNS server address, and gateway address from a DHCP server (Switch_2).

Figure 4-17  Networking diagram for configuring a DHCP client
download?uuid=d7553131e1f04b158aa3df8b7f8bcee9

Configuration Roadmap

  1. Configure Switch_1 as a DHCP client to dynamically obtain an IP address from the DHCP server.

  2. Configure Switch_2 as a DHCP server to dynamically allocate network parameters including IP addresses to Switch_1.

Procedure

  1. Configure Switch_1 as a DHCP client.

    # Create VLAN 10 and add GE0/0/1 to VLAN 10.

    <HUAWEI> system-view[HUAWEI] sysname Switch_1[Switch_1] vlan 10[Switch_1-vlan10] quit[Switch_1] interface gigabitethernet 0/0/1[Switch_1-GigabitEthernet0/0/1] port link-type trunk[Switch_1-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_1-GigabitEthernet0/0/1] quit

    # Enable the DHCP client function on VLANIF 10.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] ip address dhcp-alloc[Switch_1-Vlanif10] quit
  2. Create a global address pool on Switch_2 and set attributes for the pool.

    1. Enable DHCP.

      <HUAWEI> system-view[HUAWEI] sysname Switch_2[Switch_2] dhcp enable
    2. Create VLAN 10 and add GE0/0/1 to VLAN 10.

      [Switch_2] vlan 10[Switch_2-vlan10] quit[Switch_2] interface gigabitethernet 0/0/1[Switch_2-GigabitEthernet0/0/1] port link-type trunk[Switch_2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10[Switch_2-GigabitEthernet0/0/1] quit
    3. Configure VLANIF 10 to work in global address pool mode.

      [Switch_2] interface vlanif 10[Switch_2-Vlanif10] ip address 192.168.1.1 24[Switch_2-Vlanif10] dhcp select global[Switch_2-Vlanif10] quit
    4. Create an address pool and set attributes for the pool.

      [Switch_2] ip pool pool1[Switch_2-ip-pool-pool1] network 192.168.1.0 mask 24[Switch_2-ip-pool-pool1] gateway-list 192.168.1.126[Switch_2-ip-pool-pool1] dns-list 192.168.1.2[Switch_2-ip-pool-pool1] excluded-ip-address 192.168.1.2[Switch_2-ip-pool-pool1] quit
  3. Verify the configuration.

    # Run the display this command on VLANIF 10 of Switch_1 to view the DHCP client configuration.

    [Switch_1] interface vlanif 10[Switch_1-Vlanif10] display this#
    interface Vlanif10
     ip address dhcp-alloc
    #
    return

    # After VLANIF 10 obtains an IP address, run the display dhcp client command on Switch_1 to view the status of the DHCP client on VLANIF 10.

    [Switch_1] display dhcp clientDHCP client lease information on interface Vlanif10 :
     Current machine state         : Bound
     Internet address assigned via : DHCP
     Physical address              : 0025-9efb-be55
     IP address                    : 192.168.1.254
     Subnet mask                   : 255.255.255.0
     Gateway ip address            : 192.168.1.126
     DHCP server                   : 192.168.1.1
     Lease obtained at             : 2014-09-10 20:30:39
     Lease expires at              : 2014-09-11 20:30:39
     Lease renews at               : 2014-09-11 08:30:39
     Lease rebinds at              : 2014-09-11 17:30:39
     DNS                           : 192.168.1.2

    # On Switch_2, run the display ip pool name pool1 command to view IP address allocation in the address pool. The Used field displays the number of used IP addresses in the address pool.

    [Switch_2] display ip pool name pool1
      Pool-name        : pool1
      Pool-No          : 0
      Lease            : 1 Days 0 Hours 0 Minutes
      Domain-name      : -
      DNS-server0      : 192.168.1.2
      NBNS-server0     : -
      Netbios-type     : -
      Position         : Local           Status           : Unlocked
      Gateway-0        : 192.168.1.126
      Network          : 192.168.1.0
      Mask             : 255.255.255.0  VPN instance     : --  Logging          : Disable
      Conflicted address recycle interval: -
      Address Statistic: Total       :253       Used        :1
                         Idle        :251       Expired     :0
                         Conflict    :0         Disabled     :1
    
     -------------------------------------------------------------------------------
      Network section
             Start           End     Total  Used  Idle(Expired)  Conflict  Disable
     -------------------------------------------------------------------------------
         192.168.1.1   192.168.1.254     253       1        251(0)       0     1
     -------------------------------------------------------------------------------

Configuration Files

  • Switch_1 configuration file

    #
    sysname Switch_1
    #
    vlan batch 10
    #
    interface Vlanif10
     ip address dhcp-alloc
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    return
  • Switch_2 configuration file

    #
    sysname Switch_2
    #
    vlan batch 10
    #
    dhcp enable
    #
    ip pool pool1
     gateway-list 192.168.1.126
     network 192.168.1.0 mask 255.255.255.0
     excluded-ip-address 192.168.1.2
     dns-list 192.168.1.2
    #
    interface Vlanif10
     ip address 192.168.1.1 255.255.255.0
     dhcp select global
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    return
View more
  • x
  • convention:

Hi, 


This guide will help you https://support.huawei.com/enterprise/en/doc/EDOC1100065646/c57b453a/configuring-a-dhcp-client

Configuring a DHCP Client


Enabling the DHCP Client Function

Context

Before a device can function as a DHCP client, you must enable the DHCP client function.

After an interface is enabled with the DHCP client function, the interface can obtain network parameters including the IP address from the DHCP server. If the allocated IP address and IP addresses of other interfaces are on the same network segment, the interface does not use this IP address and does not re-apply for an IP address. To allow the interface to re-apply for an IP address, run the shutdown and then the undo shutdown commands on the interface. Alternatively, run the undo ip address dhcp-alloc and then the ip address dhcp-alloc command on the interface.

Procedure

  1. Enter the system view.


    system-view


  2. Enter the interface view or sub-interface view.


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


  3. (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.


  4. Enable the DHCP client function.


    ip address dhcp-alloc

    By default, the DHCP client function is disabled on an interface.


(Optional) Configuring Attributes


Context

Configuring attributes allows you to specify certain parameters for the DHCP client. You can configure the Option 60 field in either the system view or the interface view. The configuration in the interface view has a higher priority and overrides the configuration in the system view.

Procedure

  1. Enter the system view.


    system-view


  2. Configure the DHCP client to send DHCP Discover messages that carry the Option 60 field.


    dhcp client class-id class-id



    By default, the value of the Option 60 field is in the format of "huawei-device model".


  3. Enter the interface view or sub-interface view.


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


  4. (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.


  5. Configure a hostname for the DHCP client.


    dhcp client hostname hostname



    By default, no hostname is configured for a DHCP client.

    A hostname allows access to a DHCP client through a domain name. A domain name consists of a hostname and domain name suffix.


  6. Configure an identifier for the DHCP client.


    dhcp client client-id client-id



    By default, a client's MAC address is used as its identifier.

    Client identifier information is entered in the Option 61 field to uniquely identify the DHCP client.


  7. Configure the DHCP client to send DHCP Discover messages that carry the Option 60 field.


    dhcp client class-id class-id



    By default, the Option 60 field is not configured.


(Optional) Configuring an Expected Lease

Context

To enable a DHCP client to determine the lease length, configure an expected lease on the DHCP client. If the expected lease is longer than the global lease, the global lease takes effect.

Procedure

  1. Enter the system view.


    system-view


  2. Enter the interface view or sub-interface view.


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


  3. (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.


  4. Configure the expected lease.


    dhcp client expected-lease time



    By default, no expected lease is configured for a DHCP client.


  5. Renew the lease of the DHCP client's IP address.


    dhcp client renew

    download?uuid=ce352243dd31459eae2386b856ced802This command takes effect only if an IP address is already assigned.


(Optional) Configuring Gateway Detection


Context

To enable a DHCP client to detect the status of the gateway, enable the gateway detection function. A DHCP client enabled with the gateway detection function sends an ARP Request packet to detect the gateway status after obtaining an IP address. If the DHCP client receives no ARP Reply packet within the detection period, it considers the gateway address incorrect or the gateway device faulty, and then re-applies for an IP address.

Procedure

  1. Enter the system view.


    system-view


  2. Enter the interface view or sub-interface view.


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


  3. (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.


  4. Configure the gateway detection function on the DHCP client.


    dhcp client gateway-detect period period retransmit retransmit timeout time


    By default, the gateway detection function is not configured on a DHCP client.

(Optional) Configuring a DHCP Client to Dynamically Obtain Routing Information

Context

To allow a DHCP client to communicate with other network devices, you need to configure a route in which the next hop address is the gateway address of the client. If the gateway address of the client is dynamically obtained from the DHCP server and the route is statically configured on the client, the static route must be manually modified when the gateway address changes. After the DHCP client is configured to dynamically obtain routing entries through DHCP, the next hop address in the static route is automatically updated when the gateway address changes, lowering maintenance costs.

A DHCP server can allocate routing entries to DHCP clients. On a device functioning as the DHCP client, you can set the priorities of routing entries allocated by the DHCP server so that the DHCP client can dynamically update its routing table.

Procedure

  1. Enter the system view.


    system-view


  2. Configure the DHCP client to obtain routing entries through DHCP.


    ip route ip-address { mask | mask-length } interface-type interface-number dhcp [ preference-value  ]

    By default, a DHCP client does not obtain routing entries through DHCP.


  3. Enter the interface view or sub-interface view.


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


  4. (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.


  5. Set the priority of routing entries allocated by the DHCP server to DHCP clients.


    dhcp client default-route preference preference-value

    The default priority of routing entries allocated by the DHCP server to DHCP clients is 60.


(Optional) Configuring Option Information Requested by a DHCP Client

Context

The Option 55 field in DHCP Request messages is used to set the request option list. DHCP clients use this option to specify network configuration parameters that need to be obtained from the DHCP server. By default, the Option 55 field carries request options 3, 6, 15, 28, 33, 44, 121, and 184 by default. You can run the dhcp client request option-list exclude command to set a list of default options that are excluded from the Option 55 field or run the dhcp client request option-list command to set a list of other options that the Option 55 field carries besides the default options based on network requirements. The other options include option 4, 7, 17, 42, 43, 66, 67, 120, and 129.

For option meanings, see DHCP Messages in Configuration- IP Service Configuration Guide - DHCP Configuration.

Procedure

  1. Enter the system view.


    system-view


  2. Enter the interface view or sub-interface view.


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


  3. (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.


  4. Configure a list of default request options that are excluded from the Option 55 field in DHCP Request messages.


    dhcp client request option-list exclude option-code &<1-8>

    By default, the Option 55 field in DHCP Request messages carries request options 3, 6, 15, 28, 33, 44, 121, and 184 by default.


  5. Configure a list of request options that the Option 55 field in DHCP Request messages carries besides the default options.


    dhcp client request option-list option-code &<1-9>

    By default, the Option 55 field in DHCP Request messages carries request options 3, 6, 15, 28, 33, 44, 121, and 184 by default.


Verifying the DHCP Client Configuration

Procedure

  • On an interface enabled with the DHCP client function, run the display this command to view the configuration of the DHCP client.

  • Run the display dhcp client command to view the status of the DHCP client.


View more
  • x
  • convention:

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.