• Routers provide a mechanism for interconnecting heterogeneous networks to
transmit packets from one network to another. The router selects an appropriate
path (a network include one or more routers) based on the destination address
of the packet header, and then sends the packet to the next router, finally the
packet will be sent to the destination host.
• Routing is the path from the source to the destination of a packet. When there’s
multi-routes available, routers will forward packet according to the best route in
the routing table.
• Depending on the destination of the routing, it can be divided into:
▫ Subnet Routing: destination is a subnet
▫ Host Routing: destination is a host
• According to whether the destination is directly connected to the router, it can be
divided into:
▫ Direct routing: the destination network is directly connected to the router.
▫ Indirect Routing: the destination network is not directly connected to the
router.
• The key of a router to forward packets is the routing table. Each router has a
routing table ,and the route entries inside it will indicate which physical port
should be used to send a packet to the network or the host, or which next router
that can reach the path. Packets with a destination that do not exist in the
routing table will be discarded.
• The following key items are included in the routing table:
▫ Destination: identify the destination address or destination network of IP
packet.
▫ Mask: together with the destination address, it identifies the address of a
network segment where the destination host or router is located. The
corresponding network segment information can be obtained after doing
“AND” operation to the destination address and the network mask. The
mask is composed of a number of continuous "1", which can be expressed
in dot decimal notation or in the continuous number of "1" in the mask.
▫ Interface: Indicate which interface will be used to forward the IP packet out
of the router.
▫ Next-Hop: Specify the interface address of the next router that the IP
packet will go through..
▫ We will introduce some other fields inside the routing table, such as priority,
metric and so on later.
• The Protocol field in the routing table specifies the origin of a route, that is, how
a route is generated. There are three types of routes:
• Routes discovered by link layer protocols (Direct)
▫ Small cost, simple configuration, no manual maintenance. Only the routes
on the network segment to which the interface belongs can be discovered.
These routes are also called interface routes or direct routes.
• Manual configuration static routing (Static)
▫ No cost, simple configuration, manual maintenance. Static routes are
manually configured by administrators. Static routes can be used to
establish an interconnected network. However, when a network fault occurs,
static routes cannot be automatically rectified and must be manually
configured by the administrator.
• Routing discovered by dynamic routing protocol(RIP, OSPF, etc.)
▫ When the network topology is complex, manual configuration of static
routes is time-consuming and error-prone. In this case, dynamic routing
protocols can be used to automatically discover and modify routes without
manual maintenance. However, dynamic routing protocols have high costs
and complex configurations.
• When forwarding data, a router needs to select the optimal route in the routing
table. When a data packet arrives at a router, the router extracts the destination
IP address of the packet, searches the routing table, and then performs the AND
operation on the destination IP address of the packet and the mask field of an
entry in the routing table. If the result of the AND operation is the same as the
destination IP address of the entry in the routing table, the packet matches the
destination IP address of the entry in the routing table. Otherwise, the packet
does not match the destination IP address of the entry in the routing table. When
all routing entries are matched, the router selects the entry with the longest
mask.
• A router can learn the routes to the same destination network through multiple
protocols (including static routes). When these routes meet the longest match
rule, the router must determine which route is preferred. Therefore, each routing
protocol has a protocol priority. When multiple routes exist, the route discovered
by the routing protocol with the highest priority becomes the optimal route and
is added to the routing table.
• Different manufacturers have different requirements for priority of various
routing protocols. The default priority of HUAWEI Quidway router is shown in the
table:
▫ The smaller the value, the higher the preference.
▫ In addition to direct routing, the preference of all dynamic routing protocols
can be manually configured according to user needs. In addition, the
priority of each static route can be different.
• Where the route is unable to be distinguished by either a longest match value or
preference, the cost metric is taken as the decision maker in identifying the route
that should be installed in the routing table.
• Metric represents the length of a path to a destination network. Usually, the
following factors will affect the routing metric.
▫ Line delay, bandwidth, load, communication overhead, line reliability, hop
count and maximum transmission unit.
▫ Hop count refers to the number of routers that arrive at the destination.
▫ Bandwidth refers to the capacity of the link, and the high speed link with
low cost.
▫ The smaller the Metric value, the more priority the routing is.
• Different dynamic routing protocols choose one or more of these factors to
calculate the metric. The metric is only meaningful in the same routing protocol,
and the routing metric between different routing protocols is not comparable
and there is no conversion relationship.
• After receiving a packet, the router will check its destination IP address and then
check the routing table. After finding out the matching routing item, the router
will forward the packet according to the interface and the next-hop information
indicated by the table item.
• There are many ways to classify routes. There are three sources of routing,
Therefore, if classify routes according to the source, it can be divided into:
▫ Direct routes: Small cost, simple configuration, routes belong to local
interfaces can only be found.
▫ Static routes: No cost, simple configuration, manual maintenance. When
topology changes, static routes won’t change. Only for simple network
topologies.
▫ Dynamic routes: High cost, complex configuration, no manual maintenance.
Can be applied to complex network topologies. When topology changes,
dynamic routes can change.
• An AS is a set of routers that share similar routing policies and run in a single
management domain. An AS can be a set of routers that run a single IGP
(internal Gateway Protocol) protocol, or a set of routers that run different
routing protocols but belong to the same organization. In either cases, the
outside world regards the whole Autonomous System as an entity.
• Each Autonomous System has a unique AS number, which is assigned by the
Internet authorized authority IANA. Its basic idea is to distinguish different AS by
different numbers. In this way, when the network administrator does not want
his communication data to pass through an AS, this numbering method is very
useful. For example, the network administrator's network can be fully accessible
to an AS, but it may be managed by a competitor or lack sufficient security
mechanism, it should be avoided. By using routing protocols and AS numbers,
routers can determine the path and routing information exchange methods.
• The numbering range of AS is 1 to 65535, of which 1 to 65411 are registered
Internet numbers, and 65412 to 65535 are dedicated network numbers.
• According to the working area, routing protocols can be divided into IGP and EGP:
• IGP(Interior Gateway Protocols):
▫ RIP and IS-IS exchange routing information in the same AS. Both RIP and
IS-IS are IGPs. IGP is used to discover and calculate routing information in
an AS.
• EGP(Exterior Gateway Protocols):
▫ BGP is used to connect different ASs and exchange routing information
between ASs. Routing policies and route filtering are used to control the
transmission of routing information between ASs. An example of BGP is
BGP.
• All dynamic routing protocols are application layer protocols in the TCP/IP
protocol stack. Different routing protocols, however, use different bottom-layer
protocols.
• OSPF directly encapsulates protocol packets into IP packets. The protocol number
is 89. The IP protocol is an unreliable transmission protocol. Therefore, the
reliability of OSPF transmission depends on the protocol.
• BGP uses TCP as the transmission protocol, improving protocol reliability. The
TCP port number is 179.
• RIP uses UDP as the transmission protocol and port 520
• Raw IP: The IP header is directly operated through a socket. If Raw IP is used, the
IP protocol can be directly used without processing based on the transport layer.
When Raw IP is used, a ping command can be used to send an ICMP request, or
OSPF can be used for routing and addressing.
• To support multiple routing protocols in the same Internet, routing information
must be shared among these different routing protocols. For example, routes
learned from RIP may need to be imported to OSPF. This process of exchanging
routing information between different routing protocols is called route import.
Routes can be imported unidirectionally (for example, RIP is imported into OSPF)
or bidirectionally (RIP and OSPF import routes from each other). Generally, the
routers that import routes are located on the borders of different ASs or different
routing domains.
• Different routing protocols use different algorithms and may discover different
routes. Therefore, the routing protocols need to share their discovery results. As
mentioned above, the costs of different routing protocols are not comparable
and cannot be converted. Therefore, when importing routes, you must reset the
metric value of the imported routes or use the default metric value. The VRP
supports the import-route command to import the routes discovered by one
routing protocol to another routing protocol. Each routing protocol has its own
route import mechanism.
• Routing protocols import routes from each other to share routing information,
but this brings some problems. The use of multiple routing protocols usually
leads to complex network management and extra overheads. When a router
sends the routing information learned from one AS back to the same AS, routing
loops may occur. In addition, each routing protocol uses different metrics to
determine the optimal route. Therefore, using imported route information to
select a path may cause a sub-optimal route. Generally, routing protocols should
not overlap (RIP and OSPF should be used in the same area). The networks that
use different routing protocols should have clear boundaries. If more than one
router is used as the route import point, import routes in only one direction to
avoid routing loops and problems caused by inconsistent convergence time. If
there is only one border router in a routing domain, bidirectional import can be
used.
• Measures the performance indicators of routing protocols:
▫ Correctness
▪ Can be found correctly, and no self-loop occurs.
▫ Fast convergence
▪ When the topology of a network changes, routes in the autonomous
system can be changed quickly.
▫ Low cost
▪ Minimum protocol overhead (memory, CPU, and network bandwidth)
▫ Security
▪ The protocol is not vulnerable to attacks and has a security
mechanism.
▫ Universality
▪ Adapts to networks of various topologies and scales.
• Comprehensive performance comparison of routing protocols: BGP, OSPF, and IS-
IS have no routing loops. RIP1 and RIP2 have routing loops.
• A static route is a special route that is manually configured by a network
administrator. Static routes are easy to configure and do not need to occupy CPU
resources to calculate and analyze routes as dynamic routes do.
• The disadvantage of static routes is that they cannot adapt to the change in a
network automatically, so network changes require manual reconfiguration.
• Static routes are fit for networks with comparatively simple structures. It is not
advisable to configure and maintain static routes for a network with a complex
structure. Static routes do however reduce the effect of bandwidth and CPU
resource consumption that occurs when other protocols are implemented.
• Static routes can be applied to serial networks or Ethernet networks, but their
configurations are different.
• ip route-static ip-address { mask | mask-length } interface-type interface-number
[ nexthop-address ], this command is used to configure static routes. ip-address
specifies the destination address of a network or host, and mask specifies the
length of a subnet mask or prefix. The following parameters specify the next hop
or outbound interface.
• When configuring a static route on a serial network, you can specify only the
next-hop address (for example, 10.0.12.1) or specify only interface-type and
interface-number (for example, Serial 0/0/2) to configure an outbound interface.
On Huawei ARG3 series routers, serial interfaces are encapsulated with PPP by
default. For this type of interfaces, the next-hop address of the static route is the
address of the peer interface connected to the interface. Therefore, you can
configure only the outbound interface when configuring the static route on the
serial network.
• When configuring a static route on a broadcast interface, you must specify the
next hop address. On an Ethernet, a network may be connected to multiple
routers. If only the outbound interface is specified when you configure a static
route, the router cannot forward packets to the correct next hop.
• The two routes are destined for the same destination but use different next-hop
IP addresses. In addition, the two routes have the same priority and cost (the cost
is 0).
• On Huawei devices, the default priority of static routes is 60. Other vendors may
have different priorities.
• If the routing table does not contain any entry that matches the destination
address of a packet, the device selects the default route as the forwarding path
of the packet. In the routing table, the destination IP address and mask of the
default route are both 0.0.0.0.
• In this example, RTA uses the default route to forward packets destined for
unknown destination addresses. The default preference of the default static route
is 60. During route selection, the default route is finally matched.
• VLAN isolated two broadcast domains, and also strictly isolated layer 2 traffic
between VLAN. Users belonging to different VLAN could not manage Layer 2
communication.
• Configure the VLANIF interface on the Layer 3 switch as the gateway to
implement inter-VLAN routing. If there are multiple VLANs on the network,
configure a VLANIF interface for each VLAN and assign an IP address to each
VLANIF interface. The default gateway configured on the user PC is the IP
address of the VLANIF interface on the Layer 3 switch. When checking the IP
routing table of the switch, you can find that only the route to the directly
connected network segment can be found. Therefore, you need to set up a route
to the indirectly connected network segment. You can configure a static route.
• Static routing is configured on both SWA and SWB, where default routing is used,
and the next-hop address respectively points to Vlanif5:10.1.12.2 of SWB and
Vlanif5:10.1.12.1 of SWA.
• Answers:
▫ When forwarding data, the router needs to select the optimal route in the
routing table. When a data packet arrives at a router, the router extracts
the destination IP address of the packet, searches the routing table, and
then performs the AND operation on the destination IP address and the
mask field of an entry in the routing table. If the result of the AND
operation is the same as the destination network segment address of the
entry in the routing table, the packet matches the destination network
segment address. Otherwise, the packet does not match the destination
network segment address. When all routing entries are matched, the
router selects the entry with the longest mask.
▫ When configuring a default route, set the destination network address to
0.0.0.0, indicating any network.
▫ If the outbound interface of a route is a point-to-point interface (for
example, a serial interface encapsulated with HDLC or PPP), the route can
be associated with only the outbound interface. If the outbound interface is
a broadcast multi-access interface, for example, an Ethernet interface, the
outbound interface must be associated with the next hop. Otherwise, the
router cannot forward the packet to the correct next hop.