< Home

CLI: Example for Configuring the Interworking Between DHCP and IP-Link

By binding the link where DHCP runs to IP-link, you can resolve the problem that the automatically delivered static route cannot be bound to the IP-link.

Networking Requirements

As shown in Figure 1, the router is the gateway of a building. All enterprises in the building access the Internet through the router. FW_A acts as the gateway of an enterprise in the building. To ensure network continuity, the enterprise uses the dual-uplink networking. The active link accesses the Internet through DHCP, that is, FW_A as the DHCP client accesses the Internet by obtaining the IP address from the DHCP server. The standby link accesses the Internet through PPPoE, that is, PPPoE dial-on-demand.

Because the DHCP client cannot sense link reachability, FW_A cannot switch the traffic to the standby link in the event of link faults. To interwork with IP-link, check the availability of the link where the DHCP client resides. Upon link faults, service traffic is switched to the standby link.

Figure 1 Networking diagram of configuring the interworking between DHCP and IP-link

Procedure

  1. Configure IP-link.

    To ensure interworking between DHCP and IP-link, the destination IP address detected by IP-link must be consistent with the IP address of the Router.

    # Enable IP-link.

    <FW> system-view
    [FW] ip-link check enable

    # Create IP-link test for detecting link reachability from the FW_A to destination address 8.8.8.1.

    [FW] ip-link name test
    [FW-iplink-test] destination 8.8.8.1 interface GigabitEthernet 0/0/2 mode icmp next-hop dhcp
    [FW-iplink-test] quit

  2. Configure the DHCP client function, and associate DHCP with the IP-link.

    # Enable the DHCP client function on interface GigabitEthernet 0/0/2, and associate DHCP with the IP-link 1.

    [FW] dhcp enable
    [FW] interface GigabitEthernet 0/0/2
    [FW-GigabitEthernet0/0/2] ip address dhcp-alloc 
    [FW-GigabitEthernet0/0/2] dhcp client track ip-link test
    [FW-GigabitEthernet0/0/2] quit

  3. Configure the default route.

    # Configure the default route with outbound interface Dialer 0 and route priority 70.

    When the FW acts as the DHCP client, the priority of the default route obtained from the DHCP server is 60. When PPPoE is used for backup access, the priority of the default route must be larger than 60. The higher the priority value, the lower the priority.

    [FW] ip route-static 0.0.0.0 0.0.0.0 Dialer 0 preference 70

Verification

  1. When the active link is reachable, access packets are forwarded by FW to the active link.

    # Run the display ip-link command. You can view that IP-link is created and it is in Up state.

    [FW] display ip-link                                                            
    Current Total Ip-link Number : 1                                                
    Name                            Member   State   Up/Down/Init                   
    test                            1        up      1  0    0    

    # Run the display ip routing-table command on FW You can view that the default route to FW is the gateway address obtained through the DHCP server and the route priority is 60.

    [FW] display ip routing-table
    Route Flags: R - relay, D - download to fib 
    ------------------------------------------------------------------------------  
    Routing Tables: Public    
            Destinations : 7        Routes : 7 
                                               
    Destination/Mask    Proto  Pre  Cost     Flags NextHop         Interface  
                                                         
            0.0.0.0/0   Unr    60   0          RD  10.1.1.1        GigabitEthernet0/0/2
           10.1.1.0/24  Direct 0    0           D  10.1.1.2        GigabitEthernet0/0/2
           10.1.1.2/32  Direct 0    0           D  127.0.0.1       InLoopBack0 
          127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0  
          127.0.0.1/32  Direct 0    0           D  127.0.0.1       InLoopBack0 
        192.168.0.0/24  Direct 0    0           D  192.168.0.100   GigabitEthernet0/0/1
      192.168.0.100/32  Direct 0    0           D  127.0.0.1       InLoopBack0
    
  2. When the active link is faulty, FW switches the traffic to the standby link.

    # Run the display ip-link command. You can view that the status of the IP-link is Down.

    [FW] display ip-link                                                            
    Current Total Ip-link Number : 1                                                
    Name                            Member   State   Up/Down/Init                   
    test                            1        down      0  1    0    

    # Run the display ip routing-table command. You can view that default route obtained through the DHCP server is deleted and the backup default route with outbound interface Dialer 0 is loaded to the routing table.

    [FW] display ip routing-table
    Route Flags: R - relay, D - download to fib                                     
    ------------------------------------------------------------------------------  
    Routing Tables: Public                                                          
            Destinations : 5        Routes : 5   
       
    Destination/Mask    Proto  Pre  Cost     Flags NextHop         Interface        
                                                                                    
            0.0.0.0/0   Static 70   0           D  0.0.0.0         Dialer0          
          127.0.0.0/8   Direct 0    0           D  127.0.0.1       InLoopBack0      
          127.0.0.1/32  Direct 0    0           D  127.0.0.1       InLoopBack0      
        192.168.0.0/24  Direct 0    0           D  192.168.0.100   GigabitEthernet0/0/1
      192.168.0.100/32  Direct 0    0           D  127.0.0.1       InLoopBack0      
    
  3. When the active link recovers, run the display ip-link command on FW. You can view that the status of the IP-link turns to Up. Run the display ip routing-table command. You can view that the default route to FW obtained through the DHCP server is re-loaded to the routing table.

Configuration Scripts

Configuration scripts of FW

#
sysname FW
ip-link check enable
ip-link name test
 destination 8.8.8.1 interface GigabitEthernet0/0/2 mode icmp next-hop dhcp
#
interface GigabitEthernet0/0/2
 ip address dhcp-alloc 
 dhcp client track ip-link test
#
 ip route-static 0.0.0.0 0.0.0.0 Dialer 0 preference 70
#
return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic