[IP Adventure] A Packet's Adventures on Routers - 01

EchoW
EchoW  Senior  (1)
5 years 11 months ago  View: 4949  Reply: 7
1F

Switching, Addressing, and Forwarding

This chapter details the basic functions of a router: switching, addressing, and forwarding. This chapter will explain:

  • The importance of switch fabric units (SFUs).
  • Uplink and downlink processes.
  • The relationship between a routing table and a forwarding information base (FIB), and their location in a router.
  • FIB generation methods.

Starting from "Switching"

Data is transmitted and received by line processing units (LPUs) through cables inserted into LPU interfaces. Two interfaces must be connected to allow data transfer between them. In practice, data packets may be sent or received from any interface. If cables are connected through point-to-point (P2P), N x (N-1)/2 cable connections are required.

http://support.huawei.com/ecommunity/showimage-10181092-100242633-39b03491f07f3e3d8fdcead63e690c15.jpg

SFUs simplify LPU connections by allowing interfaces to communicate with each other through the SFUs rather than through P2P connections.

http://support.huawei.com/ecommunity/showimage-10181093-100242633-eb9efd04246869c141e5ab9b0129dd1f.jpg
 

 NOTE:

Devices such as the NE40E-X1/X2, do not have SFUs. Instead, their LPUs have switching modules, which perform the same function as an SFU.

An SFU establishes connections between inbound and outbound interfaces for data switching. It operates independent of device configurations, protocols, and data packet types. For more details about SFUs, see Basic Router Hardware Concept - Switch Fabric.

Uplink and Downlink

With an SFU as the midway point, a packet's journey along a router can be cut into two parts: the former going uplink, and the latter going downlink.

http://support.huawei.com/ecommunity/showimage-10181097-100242633-131bbe4ac71c30380031d469efc2e924.jpg

Addressing and Forwarding

Switches are able to transfer data from one interface to another, but cannot determine the shortest possible route between the countless nodes on the Internet. This is where routers are needed.

Routers perform two tasks:

  • Addressing: the selection of the shortest possible transmission path.
  • Forwarding: the transfer of packets through a matching interface.

Routers improve communication efficiency, reduces network load, and conserves network resources. This is beyond a switch's capability.

Most networks follow the TCP/IP model. In the TCP/IP model, routers operate at the network layer, also known as Layer 3.

Figure 2-1  Routers working at Layer 3 in the TCP/IP model
http://support.huawei.com/ecommunity/showimage-10181098-100242633-ba7ba2332550c5f6f65d9904e0bf13ce.jpg

Addressing is the process of searching for the network layer address of a data packet, known as the IP address. To search for an IP address, a router uses a routing table, which uses destination IP addresses as indexes. Each router has a routing table, which is similar to a subway station map.

What Does a Routing Table Look Like?

The following figure shows a routing table, which contains the following fields: Destination/Mask, NextHop, and Interface.

Destination/Mask    Proto   Pre  Cost        Flags NextHop         Interface

                                                                                

       10.0.0.0/8   Static  60   0             RD  10.136.120.1    GigabitEthernet1/0/0

   10.136.120.0/23  Direct  0    0             D   10.136.120.107  GigabitEthernet1/0/0

 10.136.120.107/32  Direct  0    0             D   127.0.0.1       GigabitEthernet1/0/0

 10.136.121.255/32  Direct  0    0             D   127.0.0.1       GigabitEthernet1/0/0

      127.0.0.0/8   Direct  0    0             D   127.0.0.1       InLoopBack0

      127.0.0.1/32  Direct  0    0             D   127.0.0.1       InLoopBack0

127.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0

      192.1.1.0/30  Direct  0    0             D   192.1.1.2       GigabitEthernet2/0/0

      192.1.1.2/32  Direct  0    0             D   127.0.0.1       GigabitEthernet2/0/0

      192.1.1.3/32  Direct  0    0             D   127.0.0.1       GigabitEthernet2/0/0

255.255.255.255/32  Direct  0    0             D   127.0.0.1       InLoopBack0

This table tells a router how to forward a data packet. For example, if a router receives a packet with the destination address 10.0.0.1, the router searches the routing table, finds the first entry matches, and forwards the packet to GigabitEthernet 1/0/0.

Routing tables are generated dynamically through routing protocols or manually by configuration. In manual configuration, static routes are configured manually and do not adapt to network changes. If the network topology changes, these routes must be manually updated. Dynamic routing protocols allow routers to automatically exchange routing information and calculate routes based on the collected information. This method allows routing tables to update according to topology changes. Direct routes are another type of route discovered by the link layer protocol.

Where Is a Routing Table Placed?

The ideal location for a routing table is in a public network location, such as the MPU. Placing the routing table in the SFU causes data transfer bottlenecks. This is why the SFU cannot run routing protocols, maintain routing tables, or perform address-based forwarding.

The routing table cannot be placed on a downlink LPU, because the SFU must know the destination LPU before switching received packets. Address-based forwarding must be completed on the uplink. Placing the routing table on an uplink LPU will require that each LPU has a routing table, because packets may enter from any LPU. The MPU CPU is the ideal choice for running routing protocols, calculating routes, and generating and maintaining a routing table.

FIB and Routing Table

Huawei high-end routers use hardware-based forwarding. During this process, service packets are not processed by the MPU CPU. The MPU CPU must deliver forwarding information to LPUs after generating a routing table. This forwarding information is stored in each LPU's FIB. All forwarding information comes from the MPU and is therefore identical for all LPUs.

All modern high-performance routers use an architecture that separates the forwarding plane from the control plane. The control plane runs routing protocols, maintains the routing table, and delivers the FIB to the forwarding plane. The forwarding plane forwards data packets. This architecture prevents the two planes from negatively affecting each other. Traffic burdening the forwarding plane will not affect route learning in the control plane, and routing in the control plane will not affect packet transfer in the forwarding plane.

Destination/Mask   Nexthop         Flag TimeStamp     Interface       TunnelID

                                                                               

192.1.1.0/30       192.1.1.2       U    15:54:32      GE2/0/0         0x0

192.1.1.3/32       127.0.0.1       HU   15:54:32      GE2/0/0         0x0

192.1.1.2/32       127.0.0.1       HU   15:54:32      GE2/0/0         0x0

10.136.120.0/23    10.136.120.107  U    00:00:00      GE0/0/0         0x0

127.0.0.0/8        127.0.0.1       HU   00:00:00      InLoop0         0x0

10.136.121.255/32  127.0.0.1       HU   00:00:00      GE0/0/0         0x0

10.136.120.107/32  127.0.0.1       HU   00:00:00      GE0/0/0         0x0

127.255.255.255/32 127.0.0.1       HU   00:00:00      InLoop0         0x0

255.255.255.255/32 127.0.0.1       HU   00:00:00      InLoop0         0x0

127.0.0.1/32       127.0.0.1       HU   00:00:00      InLoop0         0x0

10.0.0.0/8         10.136.120.1    GSU  00:00:00      GE0/0/0         0x0

A FIB, shown in the preceding figure, is similar to a routing table. Both have Destination/Mask, Nexthop, and Interface. This is because a FIB is generated based on a routing table.

A routing table may contain multiple routes to the same destination, but a FIB selects the optimal one. The next hop in a routing table may not be directly reachable, but the next hop in a FIB must be directly reachable. The process of finding the direct next hop from the original next hop is route iteration.

After a router is powered on, it learns the network topology and generates a routing table by running routing protocols. If LPUs successfully register, the MPU generates forwarding entries based on the routing table and delivers them to LPU FIBs. The router then forwards data packets based on the FIB. The component that forwards packets is the packet forwarding engine (PFE), which is typically an NP or ASIC chip.

http://support.huawei.com/ecommunity/showimage-10181100-100242633-e74f16bfa49d5a5dbcef4acb13108246.jpg

What Happens If a Route Is Unreachable?

When a route is unreachable, the router searches an FIB for forwarding procedures. This forwarding mode is called pre-routing, the process of planning the route before forwarding. Most modern routers use this mode for unicast forwarding. In this mode, if a router finds no match and no default route in the FIB, the data packet cannot reach its destination. As attempts at retransmission will continue to fail, the data packet can only be discarded. This is an undesirable outcome, and the PFE records reasons for packet drops as well as packet loss statistics.

Pre-Routing and Flow-Triggering

The routers we have discussed all use pre-routing modes. The alternative is flow-triggering mode, where packets are sent without preemptively establishing a route. When using flow-triggering mode, the router will search the FIB upon receiving a packet. If no match is found, the router will generate a forwarding entry for subsequent forwarding based on the packet.

Routers and switches use MAC address tables for Layer 2 forwarding. MAC address learning is a form of flow-triggering mode.

As it provides legitimate attack paths, flow-triggering mode is more vulnerable to traffic attacks. Attackers can launch traversal attacks by overwhelming the a router with various unknown packets. To prevent these attacks, Huawei high-end routers support a MAC address learning limit function. This function sets a maximum number of MAC addresses that a router can learn and creates a forced time interval between learning addresses. This function can also be disabled.

 

Related subjects:

[IP Adventure] A Packet's Adventures on Routers - Introduction


本帖最后由 EchoW 于 2016-04-19 11:52 编辑
Comment
nklsureshkumar nklsureshkumar  5 years 5 months ago

great doc 

Wanghuijie.Jenny.
Wanghuijie.Jenny.  Medium 
5 years 11 months ago
2F
Nice share, looking forward to the next post~
faz
faz  Platinum 
5 years 11 months ago
3F
Good tutorial
EchoW
EchoW  Senior 
5 years 11 months ago
4F
Thank you, my dear friend!
winktv2002
winktv2002  VIP 
5 years 11 months ago
5F
nice
Saravanan.S
Saravanan.S  Gold 
5 years 5 months ago
6F
Very good tutorial related with Switching, Addressing, and Forwarding
Saravanan.S
Saravanan.S  Gold 
5 years 5 months ago
7F
Concepts of switching, addressing and addressing discussed very clearly in this document