- Table of Contents
-
- H3C S9500 Operation Manual-Release2132[V2.03]-03 IP Routing Volume
- 00-1Cover
- 01-IP Routing Overview
- 02-BGP Configuration
- 03-IS-IS Configuration
- 04-OSPF Configuration
- 05-RIP Configuration
- 06-Routing Policy Configuration
- 07-Static Routing Configuration
- 08-IPv6 BGP Configuration
- 09-IPv6 IS-IS Configuration
- 10-IPv6 OSPFv3 Configuration
- 11-IPv6 RIPng Configuration
- 12-IPv6 Static Routing Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
07-Static Routing Configuration | 72.33 KB |
Table of Contents
Chapter 1 Static Routing Configuration
1.1.3 Application Environment of Static Routing
1.2 Configuring a Static Route
1.2.1 Configuration Prerequisites
1.3 Displaying and Maintaining Static Routes
Chapter 1 Static Routing Configuration
When configuring a static route, go to the following sections for information you are interested in:
l Displaying and Maintaining Static Routes
& Note:
The term “router” in this document refers to a router in a generic sense or an Ethernet switch running routing protocols.
1.1 Introduction
1.1.1 Static Route
A static route is a special route that is manually configured by the network administrator. If a network’s topology is simple, you only need configure static routes for the network to work normally. The proper configuration and usage of static routes can improve a network’s performance and ensure bandwidth for important network applications.
The disadvantage of using a static route is that, if a fault or a topological change occurs to the network, the routes will be unavailable and the network breaks. In this case, the network administrator has to modify the static routes manually.
1.1.2 Default Route
A router selects the default route only when it cannot find any matching entry in the routing table.
If there is no default route and the destination address of the packet fails to match any entry in the routing table, the packet will be discarded and an ICMP packet will be sent to the source to report that the destination or the network is unreachable.
You can create the default route with both destination and mask being 0.0.0.0, and some dynamic routing protocols, such as OSPF, RIP and IS-IS, can also generate the default route.
1.1.3 Application Environment of Static Routing
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 digits of consecutive 1s in the mask).
2) Output interface and next hop address
While configuring a static route, you can specify either the output interface or the next hop address depending on the specific occasion. The next hop address can not be a local interface IP address; otherwise, the route configuration will not take effect.
In fact, all the route entries must have a next hop address. When forwarding a packet, a router first searches the routing table for the route to the destination address of the packet. The system can find the corresponding link layer address and forward the packet only after the next hop address is specified.
When specifying the output interface, note that:
l If the output interface is a NULL0 interface, there is no need to configure the next hop address.
l If the output interface is a point-to-point interface, there is no need to configure the next hop address. You need not change the configuration even if the peer’s address changes. For example, a PPP interface obtains the peer’s IP address through PPP negotiation, so you need only specify the output interface.
l If the output interface is an NBMA or P2MP interface, which support point-to-multipoint network, the IP address to link layer address mapping must be established. Therefore, it is recommended to configure both the next hop IP address and the output interface.
l You are not recommended to specify a broadcast interface (such as an Ethernet interface, virtual template, or 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 preferences for different static routes so that route management policies can be applied more flexibly. For example, specifying the same preference for different routes to the same destination enables load sharing, while specifying different preferences for these routes enables route backup.
1.2 Configuring a Static Route
1.2.1 Configuration Prerequisites
Before configuring a static route, you need to finish the following tasks:
l Configure the physical parameters for related interfaces
l Configure the link-layer attributes for related interfaces
l Configure the IP addresses for related interfaces
1.2.2 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 } { gateway-address | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ] |
Required By default, the preference of static routes is 60, tag is 0, and no description information is configured. |
ip route-static vpn-instance s-vpn-instance-name&<1-6> dest-address { mask | mask-length } { gateway-address [ public ] | interface-type interface-number [ gateway-address ] | vpn-instance d-vpn-instance-name gateway-address } [ preference preference-value ] [ tag tag-value ] [ description description-text ] |
||
Configure the default preference for static routes |
ip route-static default-preference default-preference-value |
Optional 60 by default |
& Note:
l If you specify the next hop of a static route and then configure the next hop as the IP address of a local interface such as a VLAN interface, the static route cannot take effect.
l 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.
l A description can describe the usage, function of some specific static routes for easy and flexible management, classification and configuration of static routes.
l You can flexibly control static routes by configuring tag values and using the tag values in the routing policy.
l 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.
1.3 Displaying and Maintaining Static Routes
To do… |
Use the command… |
Remarks |
View the current configuration information |
display current-configuration |
Available in any view |
View the brief information of the IP routing table |
display ip routing-table |
|
View the detailed information of the IP routing table |
display ip routing-table verbose |
|
View information of static routes |
display ip routing-table protocol static [ inactive | verbose ] |
|
Delete all the static routes |
delete [ vpn-instance vpn-instance-name ] static-routes all |
Available In system view |
1.4 Configuration Example
I. Network requirements
The IP addresses and masks of the switches and hosts are shown in the following figure. Static routes are required for interconnection between any two hosts.
II. Network diagram
Figure 1-1 Network diagram for static route configuration
III. Configuration procedure
1) Configure IP addresses for interfaces (omitted).
2) 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
3) Configure the hosts.
The default gateways for the three hosts A, B and C are 1.1.2.3, 1.1.6.1 and 1.1.3.1 respectively.
4) View the configuration result.
# 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 192.168.1.47 Vlan100
1.1.6.1/32 Direct 0 0 127.0.0.1 InLoop0
# Use the ping command on Host B to check reachability to Host A (assuming that the hosts run Windows XP).
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=253
Reply from 1.1.2.2: bytes=32 time=1ms TTL=253
Reply from 1.1.2.2: bytes=32 time=1ms TTL=253
Reply from 1.1.2.2: bytes=32 time=1ms TTL=253
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 reachability to Host A.
[HostB] 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.