Router development (i)--router hardware structure and software system

Source: Internet
Author: User

first, the hardware configuration of the routerrouters consist mainly of the following parts:Input/Output Interface Section,packet forwarding or switching fabric section (switching fabric),route calculation or processing Section.

Figure 1 Basic composition of the router


        the input port is the physical link and the import of the input packet . The port is usually provided by a line card, a line card generally supports 4, 8 or 16 ports, and one input port has many functions. The first feature is the encapsulation and encapsulation of the data link layer. The second function is to find the destination address of the input package in the forwarding post to determine the destination port (called the routing lookup), which can be implemented using generic hardware, or by embedding a microprocessor on each line card. Thirdly, in order to provide QoS (quality of service), the port is to classify the received packets into business classifications, divided into several predefined service levels. Finally, ports may need to run data-link-level protocols such as SLIP (Serial Line Internet Protocol) and PPP (Point-to-Point Protocol) or network-level protocols such as PPTP (Point-to-Point Tunneling Protocol). Once the routing lookup is complete, the packet must be sent to its output port with a swap switch. If the router is input-queued, several inputs share the same switch. The last feature of this input port is to participate in an arbitration agreement for public resources such as switch switches. The function of this part of the normal router is performed entirely by the CPU of the router, which restricts the packet forwarding rate (thousands of to tens of thousands of packets per second). High-end routers generally realize the distributed hardware processing, the interface part has a powerful CPU processor and high-capacity cache, so that the interface data rate reached 10Gbps, to meet the high-speed backbone network transmission requirements.

        Router's forwarding mechanism has a great impact on the performance of routers, the common forwarding methods are: Process forwarding, fast forwarding, optimized forwarding, distributed fast forwarding . Process forwarding copies the packet from the interface cache to the processor's cache for processing, looking at the routing table before looking at the ARP table, re-encapsulating the packet and then copying the packet into the interface cache to prepare to be sent out, two times to look up the table and copy the data is very CPU-intensive processing time, so this is the slowest way to exchange, Only used in low-end routers. Fast switching caches the results of two tables, eliminating the need to copy data, so the CPU's time to process packets is shortened. Optimized switching is a slight improvement on the basis of fast switching, which changes the data structure of the cache table, replaces the 2-fork tree or hash table (hash) with a depth of 4, and the CPU's lookup time is shortened. These two kinds of forwarding methods are widely used in high-grade routers. In the backbone router due to the multiplication of the routing table entries, any changes in the routing table or ARP table will cause most of the route buffer invalidation, the previous Exchange method is no longer applicable, the latest Exchange Mode is distributed fast switching, It builds a forwarding table of mirrored (mirror) routing tables and MAC address tables on each interface processing board, which is a 256-fork tree with a depth of 4, but the data portion of each node points to another pointer called an adjacency table, which contains all the information needed for the router to frame. This structure allows the forwarding table to be fully synchronized with the ARP table and the update, itself no longer requires additional aging process, overcome the other exchange methods need to constantly aging the cache table defects.

       the most common type of switched fabric is bus, shared-memory, Cross-bar-empty-structured . The overall linear structure is the simplest, with all input and output interfaces on a single bus, with only two interfaces exchanging data over the bus at a time. The disadvantage is that its exchange capacity is limited by the capacity of the bus and the additional overhead incurred for the shared bus quorum. It is necessary to spend some overhead on dispatching shared data transmission channel, and the extension of bus bandwidth is restricted, which restricts the expansion of switching capacity, which is generally used in mid-range routers. In a shared-memory structure, the incoming packet is stored in a shared storage, exchanging only the pointer of the packet, which improves the switching capacity, but is limited by the memory access speed and memory management efficiency, although the storage capacity doubles every 18 months, but the memory access time is reduced by only 5% per year, This is an inherent limitation of the shared memory switching switch. The shared-memory structure is widely used in the early middle and low routers. Cross-bar empty structure equivalent to a number of parallel work of the bus, with Nx The crossover switch of the N intersection point can be considered to have a 2N bus. If a crossover is closed, the data on the input bus is available on the output bus, otherwise it is unavailable. The switching speed of the data flowing through it, the switching rate determines the switching capacity, with the continuous emergence of various high-speed devices, the exchange capacity of this structure generally reached more than dozens of Gbps, become the current high-end routers and switches of the preferred switching structure.

the routing Calculation or processing section is primarily the running of dynamic routing protocols . Receives and sends routing information, calculates the way out by the table, provides the basis for the packet forwarding. The size of the routing table entries of various grade routers is very different from thousands of to millions of, so the routing table of high-end routers has great influence on the route-finding speed, the data structure of the routing table is often used in the form of binary tree, and the speed of searching and updating is faster.

The output port stores the packet before the packet is sent to the output link, and can implement a complex scheduling algorithm to support the priority level requirements . As with the input port, the output port also supports encapsulation and encapsulation of the data link layer, as well as many more advanced protocols.

In general, routers to a packet exchange to undergo a series of complex processing, mainly in the following aspects:

1) Compression and decompression

2) encryption and decryption

3) packet filtering with input/output access list

4) Input Rate limit

5) network address translation (NAT)

6) Handle any policy routes that affect this article

7) Apply firewall features to check the package

8) Handle Web page buffering redirection

9) Physical broadcast processing, such as a helper address (IP help addresses)

10) Queue packets with the enabled QoS mechanism

One) processing of TTL values

12) Handle any option in the IP header

13) Check the integrity of the packet


Second, the software system of the router The router is under the control of the software, compared with the normal operating system, its software system is relatively concise, all reside in the memory and is limited by the original platform of an operating system. Based on the core of the commercial real-time operating system, an interface platform with TCP/IP protocol stack is developed, which is supplemented with various function modules to form a complete software system. To maximize the ability of routers to quickly exchange messages,the operating system is designed to have minimal operational overhead while allowing the CPU to use the maximum bandwidth for message exchange. Its architecture. Figure 2 router software architecture
There are five main components of the router's software system:

1, Process: A separate thread that performs a specific task, and related data, such as the System configuration maintenancetelnetdaemon, client process,FTPprocesses,TFTPprocess,SNMPprocess, various protocol processes:IP,TCP,UDP,RIP,OSPF,BGP,ARP,ICMP,IGMP, other encryption and decryption processes, message filtering processes,NATprocesses and so on.

2. Kernel: Provide basic system services for other parts of the system, such as memory management, process scheduling, timer and clock management. It provides the management of hardware (CPU and memory) resources for the process.

3, message buffer: Used to store the message will be exchanged.

4, device driver: Control network interface hardware equipment and other peripheral devices (such as Flash). The device driver interface is located between the process, kernel, and hardware, and interfaces with the Exchange control software.

5, exchange control software: According to the forwarding mode control the exchange of messages, in high-end wire-speed routers in this part of the function is implemented by the hardware.


three Basic concepts of network layer

The router works on the third layer of the OSI Reference Model-the network layer, a device that implements network services that provide interfaces to a large number of links and subnets at different speeds. Routers are active and intelligent network nodes that can participate in network management.

1. Passive routing protocol and route selection protocol

Passive routing Protocol (routed protocols ): Refers to any network protocol that provides sufficient information in the network layer address that allows packets to be forwarded from one host to another based on the addressing scheme. The passive routing protocol defines the format and purpose of the fields within the packet. Packets are typically driven from one end system to another. the IP protocol is a passive routing protocol.

Route Selection Protocol (routing protocol ): supports the passive routing protocol by providing a shared routing information mechanism. Route selection Negotiation messages are routed between routers. The routing protocol allows routers to communicate with other routers to modify and maintain routing tables. Routing protocols are:RIP,OSPF,IGRP , and so on. 4-3 Describes the relationship between the passive routing protocol and the routing protocol.


Figure 3 Passive routing protocol for Bootstrap information, routing protocol for maintaining routing tables between routers


2, the Network layer protocol work

When an application on one host needs to send a packet to a destination host on another network, one of the routers ' interfaces receives a data link frame. The network layer process checks the packet header to determine the destination network and then queries the routing table associated with the network egress interface,4.

Packets are repackaged in the data link frame of the selected interface, queued for distribution to the next station router (Hop) of the path.

This process occurs when the packet is exchanged over another router, and in the router that is connected to the network that contains the destination host, the packet is again encapsulated as the type of the destination LAN Data link frame and sent to the destination host.

Figure 4 Each router provides its various services for its upper-level capabilities


3. Static routing, dynamic routing, default routing

A fixed route is defined by the system administrator in advance, which is usually based on the configuration of the network when the system is installed, and it will not change with the future changes of the network topology. At this point, the accessibility of the network does not depend on the existence and state of the network itself, regardless of the existence or absence of the destination network, static routes will be saved in the routing forwarding, the IP traffic is still sent to the destination. Static routing allows Internet administrators to specify which of these can be made public in a limited number of divisions. When a network can only be reached by one path, a static route to the network is sufficient, and this partition is calleda stub network. Configuration for a stub network

Static route selection avoids the overhead of dynamic routing. 5 shows the purpose of a static route


Figure 5 Static Routes


Dynamic routing is a route that the router automatically adjusts based on the operation of the network system. The router automatically learns and remembers network operation based on the functions provided by the routing protocol (Routing Protocol), and automatically calculates the best path for data transfer when needed. At this point, network accessibility depends on the existence and state of the network. If a destination does not exist, the route disappears from the routing forwarding statement and the IP packet traffic is not sent to that destination. Using dynamic routing can adapt well to the changes of topology. It can change the traffic direction between different paths in the network.

The default route is a route table entry that indicates some frames that are not explicitly listed in the routing table in the next hop. The default route can be said to be the result of an administrator's static configuration. 6 shows the purpose of the default route



Figure 6 default route

4. To represent distances with measuresWhen a routing algorithm changes the routing table, its primary goal is to determine the best information to include in the table. Each routing algorithm interprets the best path in its own way. The algorithm generates a number for each path through the network, called a measure (metric). The typical meaning is that the smaller the measure, the better the path. (7 shows)
Figure 7withto select the bestvarious metrics for routing paths

The calculation of a measure can be based on a feature of a path, or a combination of several features to calculate a more complex metric. , used to measure several path characteristics of the calculation. The most commonly used measurements in routers are as follows:

1) Hops (hop count): The number of routers that the packet must pass to reach the destination. The lower the number of hops, the better the route. The path length is used to describe the hop number of the destination;

2) bandwidth (Bandwidth): The data capability of the link. such as: a 10mb/s T1 link is better than the 64kb/s line;

3) Delay (delay): The time required to send the packet from the source to the destination;

4) Load: network resources such as routers and the number of activities on the link;

5) Reliability (Reliability): Refers to the error rate on each network link;

6) tick count (Ticks): Data Link delay with the clock tick (approximately 55ms) of the IBM PC ;

7) overhead (cost): is a variable value, usually based on bandwidth, amount spent, or other units specified by the network administrator.

Router development (i)--router hardware structure and software system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.