< Home

Example for Configuring IPv4 Static Routes

Networking Requirements

In Figure 1, PC1, PC2, and PC3 are on different network segments, and are connected through SwitchA, SwitchB, and SwitchC. Any two PCs must be connected using static routes to communicate with each other without using dynamic routing protocols.
Figure 1 Configuring IPv4 static routes

Configuration Roadmap

The configuration roadmap is as follows:

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

Procedure

  1. Configure VLANs to which interfaces belong. The following example configures SwitchA. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA.
    1. Choose Configuration > Basic Services > Interface Settings > Service Interface Setting. Click Connect to PC.
    2. Select GE0/0/2 under Step 2: Select Interface, and set Interface Status and Default VLAN under Step 3: Configure Interface to ON and 30, as shown in Figure 2. You do not need to configure other parameters under Step 3: Configure Interface.

      Figure 2 Connecting an interface to a PC

    3. Click Apply. In the dialog box that is displayed, click OK.
    4. Click Connect to Switch, select GE0/0/1 under Step 2: Select Interface, and set Interface Status, Allowed VLANs, and Auto VLAN Creation under Step 3: Configure Interface to ON, 10, and OFF, as shown in Figure 3. You do not need to configure other parameters under Step 3: Configure Interface.

      Figure 3 Connecting an interface to a switch

    5. Click Apply. In the dialog box that is displayed, click OK.
  2. Configure an IP address for each VLANIF interface. The following example configures SwitchA. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA.
    1. Choose Configuration > Basic Services > VLAN in the navigation tree to open the VLAN configuration page.
    2. Click Create and set parameters, as shown in Figure 4.

      Configure GE0/0/2:

      • Set VLAN ID to 30.
      • Select Create VLANIF.
      • Set IPv4 address/Mask to 10.1.1.1/24.
      • Click Add Interface, click Select Interface to open the Add Interface page, select GE0/0/2, and click OK.

      Configure GE0/0/1:

      • Set VLAN ID to 10.
      • Select Create VLANIF.
      • Set IPv4 address/Mask to 10.1.4.1/30.
      • Click Add Interface, click Select Interface to open the Add Interface page, select GE0/0/1, and click OK.
      Figure 4 Configuring a VLANIF interface



    3. Set the parameters and click OK.
  3. Configure PCs.

    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. The following example configures SwitchA. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA.
    1. Choose Configuration > Basic Services > Static Routes and click the IPv4 Static Routes tab.
    2. Click Add and set parameters according to Table 1, as shown in Figure 5.

      Table 1 Static route list

      Switch

      Destination IP

      Destination IP Address Mask

      Next Hop Address

      SwitchA

      0.0.0.0

      0.0.0.0

      10.1.4.2

      SwitchB

      10.1.1.0

      255.255.255.0

      10.1.4.1

      SwitchB

      10.1.3.0

      255.255.255.0

      10.1.4.6

      SwitchC

      0.0.0.0

      0.0.0.0

      10.1.4.5

      Figure 5 Configuring static routes

    3. Set the parameters and click .

Operation Result

The following example displays the configuration of SwitchA. You can also use this method to view the configurations of SwitchB and SwitchC.

  1. Choose Configuration > Basic Services > Static Routes > IPv4 Static Routes to view routing information, as shown in Figure 6.

    Figure 6 Displaying routing information

  2. PC1 can communicate with PC2 and PC3.
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >