Basic static route configuration example
Network requirements
As shown in Figure 2, configure static routes on the switches for interconnections between any two hosts.
Figure 2: Network diagram
Configuration procedure
Configure IP addresses for interfaces. (Details not shown.)
Configure static routes:
# Configure a default route on Switch A.
<SwitchA> system-view [SwitchA] ip route-static 0.0.0.0 0.0.0.0 1.1.4.2
# Configure two static routes on Switch B.
<SwitchB> system-view [SwitchB] ip route-static 1.1.2.0 255.255.255.0 1.1.4.1 [SwitchB] ip route-static 1.1.3.0 255.255.255.0 1.1.5.6
# Configure a default route on Switch C.
<SwitchC> system-view [SwitchC] ip route-static 0.0.0.0 0.0.0.0 1.1.5.5
Configure the default gateways of Host A, Host B, and Host C as 1.1.2.3, 1.1.6.1, and 1.1.3.1. (Details not shown.)
Verifying the configuration
# Display static routes on Switch A.
[SwitchA] display ip routing-table protocol static Summary Count : 1 Static Routing table Status : <Active> Summary Count : 1 Destination/Mask Proto Pre Cost NextHop Interface 0.0.0.0/0 Static 60 0 1.1.4.2 Vlan500 Static Routing table Status : <Inactive> Summary Count : 0
# Display static routes on Switch B.
[SwitchB] display ip routing-table protocol static Summary Count : 2 Static Routing table Status : <Active> Summary Count : 2 Destination/Mask Proto Pre Cost NextHop Interface 1.1.2.0/24 Static 60 0 1.1.4.1 Vlan500 Static Routing table Status : <Inactive> Summary Count : 0
# Use the ping command on Host B to test the reachability of Host A (Windows XP runs on the two hosts).
C:\Documents and Settings\Administrator>ping 1.1.2.2 Pinging 1.1.2.2 with 32 bytes of data: Reply from 1.1.2.2: bytes=32 time=1ms TTL=126 Reply from 1.1.2.2: bytes=32 time=1ms TTL=126 Reply from 1.1.2.2: bytes=32 time=1ms TTL=126 Reply from 1.1.2.2: bytes=32 time=1ms TTL=126 Ping statistics for 1.1.2.2: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 1ms, Average = 1ms
# Use the tracert command on Host B to test the reachability of Host A.
C:\Documents and Settings\Administrator>tracert 1.1.2.2 Tracing route to 1.1.2.2 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 1.1.6.1 2 <1 ms <1 ms <1 ms 1.1.4.1 3 1 ms <1 ms <1 ms 1.1.2.2 Trace complete.