Manual Version
6W100-20090626
Product Version
Release 1102
Organization
The IP Routing Volume is organized as follows:
Features
Description
This document describes:
IP Routing Overview
Static Routing
Table of Contents
1 IP Routing Overview1-1
IP Routing and Routing Table1-1
Routing 1-1
Routing Table 1-1
Displaying and Maintaining a Routing Table1-3
IP Routing Overview
Go to these sections for information you are interested in:
z
The term router in this document refers to a router in a generic sense or a Layer 3 switch.
Routing Table
Routing table
Routing tables play a key role in routing. Each router maintains a routing table, and each entry in the
table specifies which physical interface a packet destined for a certain destination should go out to
reach the next hop (the next router) or the directly connected destination.
Routes in a routing table can be divided into three categories by origin:
z
Direct routes: Routes discovered by data link protocols, also known as interface routes.
Network mask: Specifies, in company with the destination address, the address of the destination
network. A logical AND operation between the destination address and the network mask yields
the address of the destination network. For example, if the destination address is 129.102.8.10 and
the mask 255.255.0.0, the address of the destination network is 129.102.0.0. A network mask is
1-1
made of a certain number of consecutive 1s. It can be expressed in dotted decimal format or by the
number of the 1s.
z
Outbound interface: Specifies the interface through which the IP packets are to be forwarded.
IP address of the next hop: Specifies the address of the next router on the path. If only the
outbound interface is configured, its address will be the IP address of the next hop.
Priority for the route. Routes to the same destination but having different nexthops may have
different priorities and be found by various routing protocols or manually configured. The optimal
route is the one with the highest priority (with the smallest metric).
Based on whether the destination is directly connected to a given router, routes can be divided into:
z
To prevent the routing table from getting too large, you can configure a default route. All packets without
matching any entry in the routing table will be forwarded through the default route.
In Figure 1-1, the IP address on each cloud represents the address of the network. Router G is
connected to three networks and therefore has three IP addresses for its three physical interfaces. Its
routing table is shown under the network topology.
Figure 1-1 A sample routing table
Router A
17.0.0.1
Router F
17.0.0.3
17.0.0.0
16.0.0.2
11.0.0.2
Router D
17.0.0.2
16.0.0.0
11.0.0.0
14.0.0.3
11.0.0.1
16.0.0.1
14.0.0.2
Router B
14.0.0.4
Router G
14.0.0.0
15.0.0.2
12.0.0.1
Router E
14.0.0.1
12.0.0.0
15.0.0.0
13.0.0.2
15.0.0.1
12.0.0.2
13.0.0.3
13.0.0.0
13.0.0.1
Router C
Destination Network
11.0.0.0
12.0.0.0
13.0.0.0
14.0.0.0
15.0.0.0
16.0.0.0
17.0.0.0
Router H
Nexthop
11.0.0.1
12.0.0.1
12.0.0.2
14.0.0.4
14.0.0.2
14.0.0.2
11.0.0.2
Interface
2
1
1
3
3
3
2
1-2
1-3
Remarks
Table of Contents
1 Static Routing Configuration1-1
Introduction 1-1
Static Route 1-1
Default Route1-1
Application Environment of Static Routing 1-2
Configuring a Static Route 1-2
Configuration Prerequisites 1-2
Configuration Procedure1-2
Displaying and Maintaining Static Routes1-3
Static Route Configuration Example 1-3
Basic Static Route Configuration Example1-3
Introduction
The term router in this document refers to a router in a generic sense or a Layer 3 switch.
Introduction
Static Route
A static route is a manually configured. If a networks topology is simple, you only need to configure
static routes for the network to work normally. 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. In
this case, the network administrator has to modify the static routes manually.
Default Route
If the destination address of a packet fails to match any entry in the routing table, the packet will be
discarded.
After a default route is configured on a router, any packet whose destination IP address matches no
entry in the routing table can be forwarded to a designated upstream router.
A router selects the default route only when it cannot find any matching entry in the routing table.
z
If the destination address of a packet fails to match any entry in the routing table, the router selects
the default route to forward the packet.
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.
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.
1-1
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)
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 succeed.
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:
z
If the output interface is a Null 0, there is no need to configure the next hop address.
If the output interface is a VLAN interface or a management Ethernet port (M-GigabitEthernet), 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.
Configuration Procedure
Follow these steps to configure a static route:
To do
Remarks
system-view
Configure a static
route
By default,
preference for
static routes is 60,
and no description
information is
configured.
ip route-static default-preference
default-preference-value
Optional
Required
1-2
60 by default
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, refer to Track Configuration in the System Volume.
display current-configuration
display ip routing-table
Remarks
Available in any
view
Available In
system view
1-3
Configuration procedure
1)
2)
3)
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. The
configuration procedure is omitted.
4)
Destination/Mask
Proto
0.0.0.0/0
Routes : 7
Pre
Cost
NextHop
Interface
Static 60
1.1.4.2
Vlan500
1.1.2.0/24
Direct 0
1.1.2.3
Vlan300
1.1.2.3/32
Direct 0
127.0.0.1
InLoop0
1.1.4.0/30
Direct 0
1.1.4.1
Vlan500
1.1.4.1/32
Direct 0
127.0.0.1
InLoop0
127.0.0.0/8
Direct 0
127.0.0.1
InLoop0
1-4
127.0.0.1/32
Direct 0
127.0.0.1
InLoop0
Cost
NextHop
Interface
Routes : 10
Destination/Mask
Proto
Pre
1.1.2.0/24
Static 60
1.1.4.1
Vlan500
1.1.3.0/24
Static 60
1.1.5.6
Vlan600
1.1.4.0/30
Direct 0
1.1.4.2
Vlan500
1.1.4.2/32
Direct 0
127.0.0.1
InLoop0
1.1.5.4/30
Direct 0
1.1.5.5
Vlan600
1.1.5.5/32
Direct 0
127.0.0.1
InLoop0
127.0.0.0/8
Direct 0
127.0.0.1
InLoop0
127.0.0.1/32
Direct 0
127.0.0.1
InLoop0
1.1.6.0/24
Direct 0
192.168.1.47
Vlan100
1.1.6.1/32
Direct 0
127.0.0.1
InLoop0
# Use the ping command on Host B to check reachability to Host A, assuming Windows XP runs on the
two hosts.
C:\Documents and Settings\Administrator>ping 1.1.2.2
<1 ms
<1 ms
<1 ms
1.1.6.1
<1 ms
<1 ms
<1 ms
1.1.4.1
1 ms
<1 ms
<1 ms
1.1.2.2
Trace complete.
1-5