When running a
routing protocol, the Ethernet switch also functions as a router. The word
“router” and the router icons covered in the following text
represent routers in common sense and Ethernet switches running a routing
protocol. To improve readability, this will not be
mentioned again in this manual.
Routers are used for route selection on the
Internet. As a router receives a packet, it selects an appropriate route
(through a network) according to the destination address of the packet and
forwards the packet to the next router. The last router on the route is
responsible for delivering the packet to the destination host.
A route segment is a common physical
network interconnecting two nodes, which are deemed adjacent on the Internet.
That is, two routers connected to the same physical network are adjacent to
each other. The number of route segments between a router and any host on the
local network is zero. In the following figure, the bold arrows represent route
segments. A router is not concerned about which physical links compose a route
segment. As shown in Figure 1-1, a packet sent
from Host A to Host C travels through two routers over three route segments
(along the broken line).

Figure 1-1
Route segment
The number of route segments on the path
between a source and destination can be used to measure the "length"
of the path. As the sizes of networks may differ greatly, the actual length of
router segments may be different from each other. Therefore, you can put
different weights to different route segments (so that, for example, a route
segment can be considered as two segments if the weight is two), In this way,
the length of the path can be measure by the number of weighted route segments.
If routers in networks are regarded as
nodes in networks and route segments in the Internet are regarded as links in
the Internet, routing in the Internet is similar to that in a conventional
network.
Routing through the shortest route is not always the most ideal way.
For example, routing across three high-speed LAN route segments may be much
faster than routing across two low-speed WAN route segments.
The key for a router to forward packets is
the routing table. Each router maintains a routing table. Each entry in this
table contains an IP address that represents a host/subnet and specifies which physical
port on the router should be used to forward the packets destined for the
host/subnet. And the router forwards those packets through this port to the
next router or directly to the destination host if the host is on a network
directly connected to the router.
Each entry in a routing table contains:
l
Destination address: It identifies the address
of the destination host or network of an IP packet.
l
Network mask: Along with the destination
address, it identifies the address of the network segment where the destination
host or router resides. By performing “logical AND” between
destination address and network mask, you can get the address of the network
segment where the destination host or router resides. For example, if the
destination address is 129.102.8.10 and the mask is 255.255.0.0, the address of
the network segment where the destination host or router resides is
129.102.0.0.A mask consists of some consecutive 1s, represented either in
dotted decimal notation or by the number of the consecutive 1s in the mask.
l
Output interface: It indicates through which
interface IP packets should be forwarded to reach the destination.
l
Next hop address: It indicates the next router
that IP packets will pass through to reach the destination.
l
Preference of the route added to the IP routing
table: There may be multiple routes with different next hops to the same
destination. These routes may be discovered by different routing protocols, or
be manually configured static routes. The one with the highest preference (the smallest
numerical value) will be selected as the current optimal route.
According to different destinations, routes
fall into the following categories:
l
Subnet route: The destination is a subnet.
l
Host route: The destination is a host.
In addition, according to whether the
network where the destination resides is directly connected to the router,
routes falls into the following categories:
l
Direct route: The router is directly connected
to the network where the destination resides.
l
Indirect route: The router is not directly
connected to the network where the destination resides.
In order to avoid an oversized routing
table, you can set a default route. All the packets for which the router fails
to find a matching entry in the routing table will be forwarded through this
default route.
As shown in Figure
1-2, the number in each network cloud indicates the
network address and "R" represents a router. The router R8 is
connected to three networks, and so it has three IP addresses and three
physical ports. Its routing table is shown in Figure
1-2.

Figure 1-2 Routing table
The H3C S7500 Series Ethernet Switches (hereinafter referred to as S7500
series) support the configuration of static routes as well as a series of
dynamic routing protocols such as RIP, OSPF and BGP. Moreover, the switches in
operation can automatically obtain some direct routes according to interface
status and user configuration.
On an S7500 switch, you can manually
configure a static route to a certain destination, or configure a dynamic
routing protocol to make the switch interact with other routers in the
internetwork and find routes by routing algorithm. On an S7500 switch, the
static routes configured by the user and the dynamic routes discovered by
routing protocols are managed uniformly. The static routes and the routes
learned or configured by different routing protocols can also be shared among
routing protocols.
Different routing protocols may discover
different routes to the same destination, but only one route among these routes
and the static routes is optimal. In fact, at any given moment, only one routing
protocol can determine the current route to a specific destination. Routing
protocols (including static routing) are endowed with different preferences.
When there are multiple routing information sources, the route discovered by
the routing protocol with the highest preference will become the current route.
Routing protocols and their default route preferences (the smaller the value,
the higher the preference is) are shown in Table 1-1.
In the table,
“0” is used for directly connected routes, and “255” is
used for routes from untrusted source.
Table 1-1 Routing protocols and
corresponding route preferences
|
Routing protocol or type
|
Preference of the corresponding route
|
|
DIRECT
|
0
|
|
OSPF
|
10
|
|
IS-IS
|
15
|
|
STATIC
|
60
|
|
RIP
|
100
|
|
OSPF ASE
|
150
|
|
OSPF NSSA
|
150
|
|
UNKNOWN
|
255
|
|
IBGP
|
256
|
|
EBGP
|
256
|
Except for direct routing, you can manually configure the
preferences of various dynamic routing protocols as required. In addition, you
can configure different preferences for different static routes.
I. Traffic sharing
The S7500 series support multi-route mode, allowing
the configuration of multiple routes that reach the same destination and have
the same preference. The same destination can be reached via multiple different
routes, whose preferences are equal. When there is no route with a higher
preference to the same destination, the multiple routes will be adopted. Then,
the packets destined for the same destination will be forwarded through these
routes in turn to implement traffic sharing.
II. Route backup
The S7500 series support route backup. When
the main route fails, the system automatically switches to a backup route to
improve network reliability.
To achieve route backup, you can configure multiple routes to the
same destination according to actual situation. One of the routes has the
highest preference and is called primary route. The other routes have
descending preferences and are called backup routes. Normally, the router sends
data through the main route. When line failure occurs on the main route, the
main route will hide itself and the router will choose the one whose preference
is the highest among the remaining backup routes as the path to send data. In
this way, the switchover from the main route to a backup route is implemented.
When the main route recovers, the router will restore it and re-select a route.
And, as the main route has the highest preference, the router will choose the
main route to send data. This process is the automatic switchover from the
backup route to the main route.
As the algorithms
of various routing protocols are different, different routing protocols may
discover different routes. This brings about the problem of how to share the
discovered routes between routing protocols. The S7500 series can import (with
the import-route command) the routes discovered by one routing protocol
to another routing protocol. Each protocol has its own route redistribution
mechanism. For detailed information, refer to the description of importing
external route in routing protocol configuration of the following chapters.
Static routes are special routes. They are
manually configured by the administrator. By configuring static routes, you can
build an interconnecting network. The problem for such configuration is when a
fault occurs on the network, a static route cannot change automatically to
steer away from the fault point without the help of the administrator.
In a relatively simple network, you only
need to configure static routes to make routers work normally. Proper
configuration and usage of static routes can improve network performance and
ensure sufficient bandwidth for important applications.
Static routes are divided into three types:
l
Reachable route: normal route. If a static route
to a destination is of this type, the IP packets destined for this destination
will be forwarded to the next hop. It is the most common type of static routes.
l
Unreachable route: route with ""reject"
attribute". If a static route to a destination has the "reject"
attribute, all the IP packets destined for this destination will be discarded,
and the source hosts will be informed of the unreachability of the destination.
l
Blackhole route: route with “blackhole”
attribute. If a static route destined for a destination has the “blackhole”
attribute, the outgoing interface of this route is the Null 0 interface
regardless of the next hop address, and all the IP packets addressed to this
destination will be dropped without notifying the source hosts.
The attributes "reject"
and "blackhole" are usually used to limit the range of the
destinations this router can reach, and help troubleshoot the network.
A default route is a
special route. You can manually configure a default route by using a static
route. Some dynamic routing protocols, such as OSPF, can automatically generate
a default route.
Simply put, a
default route is a route used only when no matching entry is found in the
routing table. That is, the default route is used only when there is no proper
route. In a routing table, both the destination address and mask of the
default route are 0.0.0.0. You can use the display ip routing-table
command to view whether the default route has been set. If the destination
address of a packet does not match any entry in the routing table, the router
will select the default route for the packet; in this case, if there is no
default route, the packet will be discarded, and an Internet control message
protocol (ICMP) packet will be returned to inform the source host that the
destination host or network is unreachable.
Before configuring a static route, perform
the following tasks:
l
Configuring the physical parameters of the
related interface
l
Configuring the link layer attributes of the
related interface
l
Configuring an IP address for the related
interface
Table 2-1
Configure a static route
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Add a static route
|
ip route-static ip-address { mask | mask-length
} { interface-type interface-number | next-hop } [ preference
value ] [ reject | blackhole ] [ description text
| detect-group group number ]*
|
Required
By default, the system can obtain the
route to the subnet directly connected to the router.
|
|
Delete all static routes
|
delete static-routes all
|
Optional
This command deletes all static routes,
including the default route.
|
l
If the destination IP address and the mask of a
route are both 0.0.0.0, the route is the default route. Any packet for which the router fails to find a matching entry in
the routing table will be forwarded through the default route.
l
Do not configure the next hop address of a
static route to the address of an interface on the local switch.
l
The preference can be configured differently to
implement flexible route management policy.
After the
above configuration, use the display command in any view to display and verify the static route configuration.
Table 2-2
Display the routing table
|
Operation
|
Command
|
Description
|
|
Display routing
table summary
|
display ip routing-table
|
You can execute the display command in any view.
|
|
Display routing
table details
|
display ip routing-table verbose
|
|
Display the detailed information of a
specific route
|
display ip routing-table ip-address [ mask ] [ longer-match
] [ verbose ]
|
|
Display the routes in a specified
address range
|
display ip routing-table ip-address1 mask1 ip-address2 mask2 [
verbose ]
|
|
Display the routes discovered by a
specified protocol
|
display ip routing-table protocol protocol [ inactive | verbose
]
|
|
Display the tree-structured routing table information
|
display ip routing-table radix
|
|
Display the statistics of the routing
table
|
display ip routing-table statistics
|
I. Network requirements
As shown in Figure 2-1,
the masks of all the IP addresses in the figure are 255.255.255.0. It is
required that all the hosts/Layer 3 switches in the figure can interconnect
with each other by configuring static routes.
II. Network diagram

Figure 2-1 Static route configuration
III. Configuration procedure
Before the
following configuration, make sure that the Ethernet link layer works normally
and the IP addresses of the VLAN interfaces have been configured correctly.
# Configure static routes on Switch A.
[SwitchA] ip route-static 1.1.3.0
255.255.255.0 1.1.2.2
[SwitchA] ip route-static 1.1.4.0
255.255.255.0 1.1.2.2
[SwitchA] ip route-static 1.1.5.0
255.255.255.0 1.1.2.2
# Configure static routes on Switch B.
[SwitchB] ip route-static 1.1.2.0
255.255.255.0 1.1.3.1
[SwitchB] ip route-static 1.1.5.0
255.255.255.0 1.1.3.1
[SwitchB] ip route-static 1.1.1.0
255.255.255.0 1.1.3.1
# Configure static routes on Switch C.
[SwitchC] ip route-static 1.1.1.0
255.255.255.0 1.1.2.1
[SwitchC] ip route-static 1.1.4.0
255.255.255.0 1.1.3.2
# Configure the default gateway of Host A
to 1.1.5.1.
[SwitchA] ip route-static 0.0.0.0
0.0.0.0 1.1.5.1
# Configure the default gateway of Host B
to 1.1.4.1.
[SwitchB] ip route-static 0.0.0.0
0.0.0.0 1.1.4.1
# Configure the default gateway of Host C
to 1.1.1.1.
[SwitchC] ip route-static 1.1.1.0
255.255.255.0 1.1.1.1
Now, all the
hosts/switches in the figure can interconnect with each other.
Symptom: The switch is not configured with
a dynamic routing protocol. Both the physical status and the link layer
protocol status of an interface are UP, but IP packets cannot be normally
forwarded on the interface.
Solution: Perform the following procedure.
Use the display ip routing-table protocol static command to view whether the corresponding static route is correctly
configured.
Use the display ip routing-table
command to view whether the static route is valid.
Routing information protocol (RIP) is a simple interior gateway
protocol (IGP) suitable for small-sized networks.
I. RIP
RIP is a distance-vector (D-V)
algorithm-based protocol. It exchanges routing information via UDP packets.
RIP uses hop count (also called routing cost)
to measure the distance to a destination address. In RIP, the hop count from a
router to its directly connected network is 0, and that to a network which can
be reached through another router is 1, and so on. To restrict the time to
converge, RIP prescribes that the cost is an integer ranging from 0 and 15. The
hop count equal to or exceeding 16 is defined as infinite; that is, the
destination network or host is unreachable.
To improve performance and avoid routing
loop, RIP supports split horizon. Besides, RIP can import routes from other
routing protocols.
II. RIP routing database
Each router running RIP manages a routing
database, which contains routing entries to all the reachable destinations in
the internetwork. Each routing entry contains the following information:
l
Destination address: IP address of a host or
network.
l
Next hop address: IP address of an interface on
the adjacent router that IP packets should pass through to reach the
destination.
l
Interface: Interface on this router, through
which IP packets should be forwarded to reach the destination.
l
Cost: Cost for the router to reach the
destination.
l
Routing time: Time elapsed after the routing
entry is updated last time. This time is reset to 0 whenever the routing entry
is updated.
III. RIP timers
As defined in RFC 1058, RIP is controlled
by three timers: Period update, Timeout, and Garbage-collection.
l
Period update timer: This timer is used to
periodically trigger routing information update so that the router to send all
RIP routes to all the neighbors.
l
Timeout timer: If a RIP route is not updated
(that is, the switch does not receive any routing update packet from the
neighbor) within the timeout time of this timer, the route is considered
unreachable.
l
Garbage-collection timer: An unreachable route
will be completely deleted from the routing table if no update packet for the
route is received from the neighbor before this timer times out.
The whole process of RIP startup and
operation is as follows:
l
Once RIP is enabled on a router, the router
broadcasts or multicasts a request packet to its neighbors. Upon receiving the
packet, each neighbor running RIP answers a response packet containing its
routing table information.
l
When this router receives a response packet, it
modifies its local routing table and sends an update triggering packet to the
neighbor. Upon receiving the update triggering packet, the neighbor sends the
packet to all its neighbors. After a series of update triggering processes,
each router can get and keep the updated routing information.
l
By default, RIP sends its routing table to its
neighbors every 30 seconds. Upon receiving the packets, the neighbors maintain
their own routing tables and select optimal routes, and then advertise update
information to their respective neighbors so as to make the updated routes
known globally. Furthermore, RIP uses the timeout mechanism to handle the
timeout routes so as to ensure real-time and valid routes.
RIP is commonly
used by most IP router suppliers. It can be used in most campus networks and
the regional networks that are simple and less dispersive. For larger and more
complicated networks, RIP is not recommended.
Table 3-1
RIP configuration tasks
|
Configuration Task
|
Description
|
Reference section
|
|
Configuring Basic RIP Functions
|
Enabling RIP globally and on the
interface of a specified network segment
|
Required
|
3.3.2 I.
|
|