- Table of Contents
-
- 03-Layer 3 Configuration Guide
- 00-Preface
- 01-ARP Configuration
- 02-IP Addressing Configuration
- 03-DHCP Configuration
- 04-DNS Configuration
- 05-IP Performance Optimization Configuration
- 06-UDP Helper Configuration
- 07-IPv6 Basics Configuration
- 08-IP Routing Basics Configuration
- 09-Static Routing Configuration
- 10-IPv6 Static Routing Configuration
- 11-RIP Configuration
- 12-RIPng Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
09-Static Routing Configuration | 102.29 KB |
Contents
Static route configuration items
Displaying and maintaining static routes
Static route configuration examples
Basic static route configuration example
This chapter includes these sections:
· Displaying and maintaining static routes
· Static route configuration examples
|
NOTE: · The term "switch" or "device" in this chapter refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this chapter are for illustration only. |
Introduction
Static route
Static routes are manually configured. If a network’s topology is simple, you only need to configure static routes for the network to work properly. The proper configuration and usage of static routes can improve network performance and ensure bandwidth for important network applications.
The disadvantage of using static routes is that they cannot adapt to network topology changes. If a fault or a topological change occurs in the network, the routes will be unreachable and the network breaks. The network administrator has to modify the static routes manually.
Default route
Without a default route, a packet that does not match any routing entries is discarded and an ICMP destination-unreachable packet is sent to the source.
A default route is used to forward packets that match no entry in the routing table. It can be configured in either of the following ways:
· The network administrator can configure a default route with both destination and mask being 0.0.0.0. The router forwards any packet whose destination address fails to match any entry in the routing table to the next hop of the default static route.
· RIP can also generate a default route. For example, an upstream router running RIP can generate a default route and advertise it to other routers, which install the default route with the next hop being the upstream router.
Static route configuration items
Before configuring a static route, you need to know the following concepts:
1. Destination address and mask
In the ip route-static command, an IPv4 address is in dotted decimal format and a mask can be either in dotted decimal format or in the form of mask length—the number of consecutive 1s in the mask.
2. Output interface and next hop address
When configuring a static route, specify either the output interface, next hop address, or both depending on the specific occasion. The next hop address cannot be a local interface IP address; otherwise, the route configuration will not take effect.
In fact, each route lookup operation has to find the next hop to resolve the destination link layer address.
When specifying the output interface, observe the following rules:
· If the output interface is a Null 0 interface, no next hop address is required.
· H3C does not recommend you to specify a broadcast interface (such as a VLAN interface) as the output interface, because a broadcast interface may have multiple next hops. If you have to do so, you must specify the corresponding next hop for the output interface.
3. Other attributes
You can configure different priorities for different static routes so that route management policies can be more flexible. For example, specifying the same priority for different routes to the same destination enables load sharing, but specifying different priorities for these routes enables route backup.
Configuring a static route
Configuration prerequisites
Before configuring a static route, complete the following tasks:
· Configure the physical parameters for related interfaces
· Configure the link-layer attributes for related interfaces
· Configure the IP addresses for related interfaces
Configuration procedure
Follow these steps to configure a static route:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Configure a static route |
ip route-static dest-address { mask | mask-length } { next-hop-address | interface-type interface-number [ next-hop-address ] } [ preference preference-value ] [ description description-text ] |
Required Use one of the approaches. By default, preference for static routes is 60, and no description information is configured. |
Configure the default preference for static routes |
ip route-static default-preference default-preference-value |
Optional 60 by default |
|
NOTE: · When configuring a static route, the static route does not take effect if you specify the next hop address first and then configure it as the IP address of a local interface, such as VLAN interface. · If you do not specify the preference when configuring a static route, the default preference will be used. Reconfiguring the default preference applies only to newly created static routes. · If the destination IP address and mask are both configured as 0.0.0.0 with the ip route-static command, the route is the default route. · For detailed information about track, see the High Availability Configuration Guide. |
Displaying and maintaining static routes
To do… |
Use the command… |
Remarks |
Display information of static routes |
display ip routing-table protocol static [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Delete all the static routes |
delete static-routes all |
Available in system view |
|
NOTE: For more information about the display ip routing-table protocol static [ inactive | verbose ] [ | { begin | exclude | include } regular-expression ] command, see the Layer 3 Command Reference. |
Static route configuration examples
Basic static route configuration example
Network requirements
The IP addresses and masks of the switches and hosts are shown in Figure 1. Static routes are required for interconnection between any two hosts.
Figure 1 Network diagram for static route configuration
Configuration procedure
1. Configuring IP addresses for interfaces (omitted)
2. Configuring 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
3. Configure the hosts.
The default gateways for hosts A, B and C are 1.1.2.3, 1.1.6.1 and 1.1.3.1, respectively. The configuration procedure is omitted.
4. Display the configuration.
# Display the IP routing table of Switch A.
[SwitchA] display ip routing-table
Routing Tables: Public
Destinations : 7 Routes : 7
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 Static 60 0 1.1.4.2 Vlan500
1.1.2.0/24 Direct 0 0 1.1.2.3 Vlan300
1.1.2.3/32 Direct 0 0 127.0.0.1 InLoop0
1.1.4.0/30 Direct 0 0 1.1.4.1 Vlan500
1.1.4.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
# Display the IP routing table of Switch B.
[SwitchB] display ip routing-table
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost NextHop Interface
1.1.2.0/24 Static 60 0 1.1.4.1 Vlan500
1.1.3.0/24 Static 60 0 1.1.5.6 Vlan600
1.1.4.0/30 Direct 0 0 1.1.4.2 Vlan500
1.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0
1.1.5.4/30 Direct 0 0 1.1.5.5 Vlan600
1.1.5.5/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
1.1.6.0/24 Direct 0 0 1.1.6.1 Vlan100
1.1.6.1/32 Direct 0 0 127.0.0.1 InLoop0
# Use the ping command on Host B to check the reachability of Host A, assuming 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=255
Reply from 1.1.2.2: bytes=32 time=1ms TTL=255
Reply from 1.1.2.2: bytes=32 time=1ms TTL=255
Reply from 1.1.2.2: bytes=32 time=1ms TTL=255
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 check 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.