< Home

Example for Configuring Static Routes for Interworking Between Different Network Segments

Static Route Overview

Static routes use less bandwidth than dynamic routes and do not use CPU resources for route calculation and update analysis. They are manually configured by administrators. If a network fault occurs or the topology changes, static routes must be manually reconfigured as they cannot be automatically updated. Static routes have five parameters: destination IP address, mask, outbound interface, next hop, and priority.

Static routes are generally suitable for simple networks. However, they can be used on complex networks to improve network performance and ensure bandwidth for important applications.

Configuration Notes

  • Communication between two devices is bidirectional, so reachable routes must be available in both directions. To enable two devices to communicate through static routes, configure a static route on the local device and then configure a return route on the peer device.
  • If an enterprise network has two egresses, two equal-cost static routes can be configured for load balancing. In this case, two non-equal-cost static routes can be configured for active/standby backup. When the active link is faulty, traffic is switched from the active link to the standby link.
  • This example applies to all versions of all S series switches.

Networking Requirements

As shown in Figure 1, hosts on different network segments are connected using several switches. Every two hosts on different network segments can communicate with each other without using dynamic routing protocols.

Figure 1 Networking diagram of configuring static routes for interworking between different network segments

Configuration Roadmap

The configuration roadmap is as follows:

  1. Create VLANs, add interfaces to the VLANs, and assign IPv4 addresses to VLANIF interfaces so that neighboring devices can communicate with each other.
  2. Configure the IPv4 default gateway on each host, and configure IPv4 static routes or default static routes on each Switch so that hosts on different network segments can communicate with each other.

Procedure

  1. Create VLANs and add interfaces to the VLANs.

    # Configure SwitchA. The configurations of SwitchB and SwitchC are similar.

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan batch 10 30
    [SwitchA] interface gigabitethernet 0/0/1
    [SwitchA-GigabitEthernet0/0/1] port link-type trunk
    [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
    [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 30
    [SwitchA-GigabitEthernet0/0/2] quit

  2. Assign IPv4 addresses to the VLANIF interfaces.

    # Configure SwitchA. The configurations of SwitchB and SwitchC are similar.

    [SwitchA] interface vlanif 10
    [SwitchA-Vlanif10] ip address 10.1.4.1 30
    [SwitchA-Vlanif10] quit
    [SwitchA] interface vlanif 30
    [SwitchA-Vlanif30] ip address 10.1.1.1 24
    [SwitchA-Vlanif30] quit

  3. Configure hosts.

    Set the default gateway addresses of PC1, PC2, and PC3 to 10.1.1.1, 10.1.2.1, and 10.1.3.1 respectively.

  4. Configure static routes.

    # Configure a default IPv4 route on SwitchA.

    [SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.4.2

    # Configure two IPv4 static routes on SwitchB.

    [SwitchB] ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
    [SwitchB] ip route-static 10.1.3.0 255.255.255.0 10.1.4.6

    # Configure a default IPv4 route on SwitchC.

    [SwitchC] ip route-static 0.0.0.0 0.0.0.0 10.1.4.5

  5. Verify the configuration.

    # Check the IP routing table on SwitchA.

    [SwitchA] display ip routing-table
    Route Flags: R - relay, D - download to fib, T - to vpn-instance
    ------------------------------------------------------------------------------
    Routing Tables: Public
             Destinations : 7        Routes : 7
     
    Destination/Mask    Proto  Pre  Cost   Flags   NextHop      Interface
     
            0.0.0.0/0    Static 60   0        RD    10.1.4.2     Vlanif10
            10.1.1.0/24  Direct 0    0         D    10.1.1.1     Vlanif30
            10.1.1.1/32  Direct 0    0         D    127.0.0.1    Vlanif30
            10.1.4.0/30  Direct 0    0         D    10.1.4.1     Vlanif10
            10.1.4.1/32  Direct 0    0         D    127.0.0.1    Vlanif10
          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
    

    # Run the ping command to verify the connectivity.

    [SwitchA] ping 10.1.3.1
      PING 10.1.3.1: 56  data bytes, press CTRL_C to break
        Reply from 10.1.3.1: bytes=56 Sequence=1 ttl=253 time=62 ms
        Reply from 10.1.3.1: bytes=56 Sequence=2 ttl=253 time=63 ms
        Reply from 10.1.3.1: bytes=56 Sequence=3 ttl=253 time=63 ms
        Reply from 10.1.3.1: bytes=56 Sequence=4 ttl=253 time=62 ms
        Reply from 10.1.3.1: bytes=56 Sequence=5 ttl=253 time=62 ms
    
      --- 10.1.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.

    [SwitchA] tracert 10.1.3.1
     traceroute to  10.1.3.1(10.1.3.1), max hops: 30 ,packet length: 40,press CTRL_C to break
     1 10.1.4.2 31 ms  32 ms  31 ms
     2 10.1.3.1 62 ms  63 ms  62 ms

Configuration Files

  • SwitchA configuration file

    #
    sysname SwitchA
    #
    vlan batch 10 30
    #
    interface Vlanif10
     ip address 10.1.4.1 255.255.255.252
    #
    interface Vlanif30
     ip address 10.1.1.1 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    interface GigabitEthernet0/0/2
     port link-type access
     port default vlan 30
    #
    ip route-static 0.0.0.0 0.0.0.0 10.1.4.2
    #
    return
  • SwitchB configuration file

    #
    sysname SwitchB
    #
    vlan batch 10 20 40
    #
    interface Vlanif10
     ip address 10.1.4.2 255.255.255.252
    #
    interface Vlanif20
     ip address 10.1.4.5 255.255.255.252
    #
    interface Vlanif40
     ip address 10.1.2.1 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 10
    #
    interface GigabitEthernet0/0/2
     port link-type trunk
     port trunk allow-pass vlan 20
    #
    interface GigabitEthernet0/0/3
     port link-type access
     port default vlan 40
    #
    ip route-static 10.1.1.0 255.255.255.0 10.1.4.1
    ip route-static 10.1.3.0 255.255.255.0 10.1.4.6
    #
    return
  • SwitchC configuration file

    #
    sysname SwitchC
    #
    vlan batch 20 50
    #
    interface Vlanif20
     ip address 10.1.4.6 255.255.255.252
    #
    interface Vlanif50
     ip address 10.1.3.1 255.255.255.0
    #
    interface GigabitEthernet0/0/1
     port link-type trunk
     port trunk allow-pass vlan 20
    #
    interface GigabitEthernet0/0/2
     port link-type access
     port default vlan 50
    #
    ip route-static 0.0.0.0 0.0.0.0 10.1.4.5
    #
    return
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >