Example for Configuring the Device as a DHCP Relay (on the Same Network)

100 0 0 0

DHCP Relay Overview

A DHCP relay forwards DHCP packets between the DHCP server and clients. When the DHCP server and clients belong to different network segment, the DHCP relay needs to be configured. For DHCP clients, the DHCP relay is the DHCP server; for the DHCP server, the DHCP relay is a DHCP client.

The DHCP relay function applies to large networks with many sparsely-distributed user gateways. To reduce the maintenance workload, the network administrator does not want to configure the DHCP server function on each aggregation switch (user gateway) and requires that the DHCP server function be configured on a core device or an exclusive DHCP server be deployed in the server area. In this case, the aggregation switches functioning as the user gateways need to be configured with the DHCP relay function to implement exchange of DHCP packets between the DHCP server and clients.

Configuration Notes

For applicable product models and versions, see Applicable Product Models and Versions.

imgDownload?uuid=b799313239fb4bca98b551f NOTE:
For details about software mappings, visit Hardware Query Tool and search for the desired product model.

Networking Requirements

As shown in Figure 7-6, an enterprise deploys the DHCP server on the core switch. The DHCP server and terminals in the enterprise belong to different network segments. The enterprise requires that the DHCP server should dynamically assign IP addresses to the terminals.

Figure 7-6  Networking diagram for configuring the device as a DHCP relay 
imgDownload?uuid=716fdb8b03534fb6aa2adad

Configuration Roadmap

The configuration roadmap is as follows:

  1. Configure the DHCP relay on SwitchA (user gateway) to forward DHCP packets between the terminals and DHCP server.

  2. On SwitchB, configure the DHCP server based on the global address pool so that the DHCP server can assign IP addresses from the global address pool to the terminals.

imgDownload?uuid=b799313239fb4bca98b551f NOTE:

Use a Huawei S series switch as an example for the DHCP server (SwitchB).

On the LSW, configure the interface link type and VLAN to implement Layer 2 communication.

Procedure

  1. Configure the DHCP relay on SwitchA.

    # Add the interface to the VLAN.

    <HUAWEI> system-view[HUAWEI] sysname SwitchA[SwitchA] vlan batch 100 200[SwitchA] interface gigabitethernet 0/0/1[SwitchA-GigabitEthernet0/0/1] port link-type trunk[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 200[SwitchA-GigabitEthernet0/0/1] quit[SwitchA] interface gigabitethernet 0/0/2[SwitchA-GigabitEthernet0/0/2] port link-type access[SwitchA-GigabitEthernet0/0/2] port default vlan 100[SwitchA-GigabitEthernet0/0/2] quit[SwitchA] interface vlanif 200 [SwitchA-Vlanif200] ip address 192.168.20.1 24[SwitchA-Vlanif200] quit

    # Enable the DHCP relay function on the interface.

    [SwitchA] dhcp enable  //Enable the DHCP service. By default, the service is disabled.[SwitchA] interface vlanif 100[SwitchA-Vlanif100] ip address 10.10.20.1 24[SwitchA-Vlanif100] dhcp select relay   //Enable the DHCP relay function. By default, the function is disabled.[SwitchA-Vlanif100] dhcp relay server-ip 192.168.20.2  //Configure the DHCP server IP address for the DHCP relay agent.[SwitchA-Vlanif100] quit

  2. Configure the DHCP server function based on the global address pool on SwitchB.

    # Enable the DHCP service. By default, the service is disabled.

    <HUAWEI> system-view[HUAWEI] sysname SwitchB[SwitchB] dhcp enable

    # Configure VLANIF 200 to work in global address pool mode.

    [SwitchB] vlan 200 [SwitchB-vlan200] quit[SwitchB] interface gigabitethernet 0/0/1[SwitchB-GigabitEthernet0/0/1] port link-type trunk[SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 200[SwitchB-GigabitEthernet0/0/1] quit[SwitchB] interface vlanif 200 [SwitchB-Vlanif200] ip address 192.168.20.2 24[SwitchB-Vlanif200] dhcp select global  //Enable the DHCP server function based on the global address pool on the interface. By default, the function is disabled.[SwitchB-Vlanif200] quit

    # Create an address pool and configure the attributes. The default lease (one day) is used and does not need to be configured.

    [SwitchB] ip pool pool1[SwitchB-ip-pool-pool1] network 10.10.20.0 mask 24  //Configure the network segment and mask of the global address pool.[SwitchB-ip-pool-pool1] gateway-list 10.10.20.1  //Configure the gateway address assigned to the terminals.[SwitchB-ip-pool-pool1] quit

  3. Configure static routes to the terminals on SwitchB.

    [SwitchB] ip route-static 10.10.20.0 255.255.255.0 192.168.20.1 

  4. Configure each terminal (using the PC running Windows 7 as an example) to automatically obtain an IP address.

    1. Right-click Network and choose Properties to display the Network and Sharing Center window.
    2. Click Local Area Connection to display the Local Area Connection Status window.
    3. Click Properties to display the Local Area Connection Properties window.
    4. Select Internet Protocol Version 4 (TCP/IPv4) and click Properties to display the Internet Protocol Version 4 (TCP/IPv4) Properties window. Select Obtain an IP address automatically, and click OK.

  5. Verify the configuration.

    # Run the display dhcp relay interface vlanif 100 command on SwitchA to check the DHCP relay configuration.

    [SwitchA] display dhcp relay interface vlanif 100
     DHCP relay agent running information of interface Vlanif100 : 
     Server IP address [00] : 192.168.20.2
     Gateway address in use : 10.10.20.1

    # Run the display ip pool command on SwitchB to check the IP address allocation of pool1. For example, the enterprise has 100 terminals. The following uses the command output in V200R011C10 as an example.

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

Configuration Files

  • SwitchA configuration file

    #
    sysname SwitchA
    #
    vlan batch 100 200
    #
    dhcp enable
    #
    interface Vlanif100
     ip address 10.10.20.1 255.255.255.0
     dhcp select relay
     dhcp relay server-ip 192.168.20.2
    #
    interface Vlanif200
     ip address 192.168.20.1 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 200
    #
    interface GigabitEthernet0/0/2
     port link-type access
     port default vlan 100
    #
    return
  • SwitchB configuration file

    #
    sysname SwitchB
    #
    vlan batch 200
    #
    dhcp enable
    #
    ip pool pool1
     gateway-list 10.10.20.1
     network 10.10.20.0 mask 255.255.255.0
    #
    interface Vlanif200
     ip address 192.168.20.2 255.255.255.0
     dhcp select global
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 200
    #
    ip route-static 10.10.20.0 255.255.255.0 192.168.20.1
    #
    return

Applicable Product Models and Versions

Table 7-5  Applicable product models and versions

Series

Product Model

Software Version

S2700

S2720EI

V200R006C10, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00

S2750EI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S3700

S3700SI, S3700EI

V100R006C05

S3700HI

V200R001C00

S5700

S5700LI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5700S-LI

V200R005C00SPC300, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5700SI

V200R001C00, V200R002C00, V200R003C00, V200R005C00

S5700EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02&C03)

S5700HI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00SPC500&C01&C02)

S5710-X-LI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00

S5710EI

V200R001C00, V200R002C00, V200R003C00, V200R005(C00&C02)

S5710HI

V200R003C00, V200R005(C00&C02&C03)

S5720LI, S5720S-LI

V200R010C00, V200R011C00, V200R011C10, V200R012(C00&C20), V200R013C00

S5720SI, S5720S-SI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00

S5720I-SI

V200R012C00, V200R013C00

S5720EI

V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00

S5720HI

V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00

S5730HI

V200R012C00, V200R013C00

S5730SI

V200R011C10, V200R012C00, V200R013C00

S5730S-EI

V200R011C10, V200R012C00, V200R013C00

S6700

S6700EI

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005(C00&C01&C02)

S6720LI, S6720S-LI

V200R011C00, V200R011C10, V200R012C00, V200R013C00

S6720SI, S6720S-SI

V200R011C00, V200R011C10, V200R012C00, V200R013C00

S6720EI

V200R008C00, V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00

S6720S-EI

V200R009C00, V200R010C00, V200R011C00, V200R011C10, V200R012C00, V200R013C00

S6720HI

V200R012C00, V200R013C00

S7700

S7703, S7706, S7712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007C00, V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00

S7703 PoE

V200R013C00

S7706 PoE

V200R013C00

S9700

S9703, S9706, S9712

V200R001(C00&C01), V200R002C00, V200R003C00, V200R005C00, V200R006C00, V200R007(C00&C10), V200R008C00, V200R009C00, V200R010C00, V200R011C10, V200R012C00, V200R013C00

See more please click 

https://support.huawei.com/enterprise/en/doc/EDOC1000069520/9aadccc0/comprehensive-configuration-examples


  • x
  • convention:

Reply

Reply
You need to log in to reply to the post Login | Register

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 " Privacy."
If the attachment button is not available, update the Adobe Flash Player to the latest version!

Login and enjoy all the member benefits

Login
Fast reply Scroll to top