No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

CLI-based Configuration Guide - IP Unicast Routing

AR100, AR120, AR150, AR160, AR200, AR1200, AR2200, AR3200, and AR3600 V200R009

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Example for Configuring IPv4 Static Routes

Example for Configuring IPv4 Static Routes

Networking Requirements

Hosts on different network segments are connected using several Routers. Every two hosts on different network segments can communicate with each other without using dynamic routing protocols.

Figure 2-7 Networking diagram of configuring IPv4 static routes

Configuration Roadmap

The configuration roadmap is as follows:

  1. Configure IPv4 addresses for interfaces so that directly-connected interfaces can communicate with each other.
  2. Configure the default IPv4 gateway on each host, and configure IPv4 static routes and default routes on each Router so that hosts on different network segments can communicate with each other.

Procedure

  1. Configure IP addresses for interfaces on each Router.

    # Configure an IP address for each interface on RouterA. The configurations of RouterB and RouterC are similar to the configuration of RouterA, and are not mentioned here.

    <Huawei> system-view
    [Huawei] sysname RouterA
    [RouterA] interface gigabitethernet 1/0/0
    [RouterA-GigabitEthernet1/0/0] ip address 192.168.4.1 30
    [RouterA-GigabitEthernet1/0/0] quit
    [RouterA] interface gigabitethernet 2/0/0
    [RouterA-GigabitEthernet2/0/0] ip address 192.168.1.1 24

  2. Configure static routes.

    # Configure an IPv4 default route on RouterA.

    [RouterA] ip route-static 0.0.0.0 0.0.0.0 192.168.4.2

    # Configure two IPv4 static routes on RouterB.

    [RouterB] ip route-static 192.168.1.0 255.255.255.0 192.168.4.1
    [RouterB] ip route-static 192.168.3.0 255.255.255.0 192.168.4.6

    # Configure an IPv4 default route on RouterC.

    [RouterC] ip route-static 0.0.0.0 0.0.0.0 192.168.4.5

  3. Configure hosts.

    Set default gateway addresses of PC1, PC2, and PC3 to 192.168.1.1, 192.168.2.1, and 192.168.3.1 respectively.

  4. Verify the configuration.

    # Check the IP routing table of RouterA.

    [RouterA] display ip routing-table
    Route Flags: R - relay,
    D - download to fib
    ------------------------------------------------------------------------------
    Routing Tables: Public
             Destinations : 11        Routes : 11
    Destination/Mask        Proto  Pre  Cos      Flags    NextHop         Interface
            0.0.0.0/0       Static 60   0        RD       192.168.4.2         GigabitEthernet1/0/0
            192.168.1.0/24  Direct 0    0         D       192.168.1.1         GigabitEthernet2/0/0
            192.168.1.1/32  Direct 0    0         D       127.0.0.1       GigabitEthernet2/0/0
            192.168.1.255/32  Direct 0    0         D       127.0.0.1       GigabitEthernet2/0/0
            192.168.4.1/30  Direct 0    0         D       192.168.4.1         GigabitEthernet1/0/0
            192.168.4.1/32  Direct 0    0         D       127.0.0.1       GigabitEthernet1/0/0
          192.168.4.255/32  Direct 0    0         D       127.0.0.1       GigabitEthernet1/0/0
          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
    127.255.255.255/32  Direct 0    0         D       127.0.0.1       InLoopBack0
    255.255.255.255/32  Direct 0    0         D       127.0.0.1       InLoopBack0
    

    # Run the ping command to verify the connectivity.

    [RouterA] ping 192.168.3.1
      PING 192.168.3.1: 56  data bytes, press CTRL_C to break
        Reply from 192.168.3.1: bytes=56 Sequence=1 ttl=254 time=62 ms
        Reply from 192.168.3.1: bytes=56 Sequence=2 ttl=254 time=63 ms
        Reply from 192.168.3.1: bytes=56 Sequence=3 ttl=254 time=63 ms
        Reply from 192.168.3.1: bytes=56 Sequence=4 ttl=254 time=62 ms
        Reply from 192.168.3.1: bytes=56 Sequence=5 ttl=254 time=62 ms
      --- 192.168.3.1 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 62/62/63 ms
    

    # Run the tracert command to verify the connectivity.

    [RouterA] tracert 192.168.3.1
     traceroute to  192.168.3.1(192.168.3.1), max hops: 30 ,packet length: 40,press CTRL_C to break
     1 192.168.4.2 31 ms  32 ms  31 ms
     2 192.168.4.6 62 ms  63 ms  62 ms
    

Configuration Files

  • Configuration file of RouterA

    #
     sysname RouterA
    #
    interface GigabitEthernet2/0/0
     ip address 192.168.1.1 255.255.255.0
    #
    interface GigabitEthernet1/0/0
     ip address 192.168.4.1 255.255.255.252
    #
    ip route-static 0.0.0.0 0.0.0.0 192.168.4.2
    #
    return
    
  • Configuration file of RouterB

    #
     sysname RouterB
    #
    interface GigabitEthernet1/0/0
     ip address 192.168.4.2 255.255.255.252
    #
    interface GigabitEthernet2/0/0
     ip address 192.168.4.5 255.255.255.252
    #
    interface GigabitEthernet3/0/0
     ip address 192.168.2.1 255.255.255.0
    #
    ip route-static 192.168.1.0 255.255.255.0 192.168.4.1
    ip route-static 192.168.3.0 255.255.255.0 192.168.4.6
    #
    return
    
  • Configuration file of RouterC

    #
     sysname RouterC
    #
    interface GigabitEthernet2/0/0
     ip address 192.168.3.1 255.255.255.0
    #
    interface GigabitEthernet1/0/0
     ip address 192.168.4.6 255.255.255.252
    #
    ip route-static 0.0.0.0 0.0.0.0 192.168.4.5
    #
    return
Translation
Download
Updated: 2019-05-17

Document ID: EDOC1000174069

Views: 130647

Downloads: 274

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next