directory

  • An overview of the
  • The physical layer
  • Data link layer
  • Network layer (1) Basic knowledge
  • Network layer (2) IP address design and exhaustion
  • Network layer (3) Network layer packet transmission process
  • Network layer (4) Network layer multicast and other applications
  • Transport layer (1) Reliable transport and TCP/UDP
  • Transport layer (2) congestion control and handshake waving
  • Application layer (1) HTTP and the World Wide Web

Router Composition

It consists of two parts, routing part and packet forwarding part, using routing table and forwarding table.

Routing section

A routing processor is used to construct routing tables according to routing protocols and periodically synchronize the relationship with other routers.

Routing and forwarding part

It consists of a switching structure and input/output ports. It operates according to the forwarding table, and the information received through the route is sent through it correctly.

Difference between forwarding table and routing table

The routing table stores the topology of the entire network and the mapping between the destination network and the next address. However, the forwarding table is derived from the routing table, involves only one router, and stores hardware information and output port information. Routing tables are implemented by software, while forwarding tables are implemented by hardware. Routing table updates will also update the forwarding table. After grouping, forwarding will be done according to the hardware forwarding table. But data comes in faster than it can be processed, which requires a cache to wait for the data to be processed.

How is the routing table formed

Which is to use routing protocol, from whether can dynamic adjustment classification, there are two categories respectively

Static route selection protocol

The cost is small and simple, but it cannot adapt to the changes of the network. For a very small network, this method can be adopted, and each route is manually configured.

Dynamic routing protocol

The implementation is complex and expensive, which is suitable for large networks.

The Internet uses distributed dynamic routing protocols, because the Internet is so large that if it were all centralized, routing table items would explode, and some networks would not want to be connected to their own internal selected protocols. So the Internet is divided into many small autonomous systems that are independent of each other. The Internet divides routing protocols into two broad categories:

Internal Gateway protocol IGP:

It is used in autonomous systems and has nothing to do with other systems, such as RIP and OSPF.

External gateway protocol (EGP)

Since each AUTONOMOUS system may use different protocols, data between them needs to be transformed, which is the external gateway protocol. This is BGP.

The specific agreement

RIP:

It is a distributed routing protocol based on distance vector and its biggest advantage is simplicity. Its distance value is the number of hops, each time it passes through a router, it increases by one. Its routing table stores three values: the address next to the destination network hop count. It states that the maximum hop count is 15, and if it is greater than 15 it is defined as unreachable. So he only adapted to small networks. Because RIP is distributed, each router needs to constantly exchange information with other routers. RIP only exchanges information with neighboring routers and exchanges the entire routing table at a fixed interval. If one represents empty, after a few swaps, it will know the hop count information to all the routers in the system. It uses the distance vector algorithm. If the destination address does not exist in the routing table, the destination address is added to the routing table and the distance is increased by one. If so, determine the distance and make an update. Its main disadvantage is that bad news travels slowly and good news travels fast. Can you think for yourself why

OSPF

Open shortest path first, which was developed after RIP, overcame its shortcomings. It uses the shortest path algorithm SPF, whose main principle is also to find a shortest L path. The most important feature is the use of distributed link state protocol, rather than RIP distance vector. The difference is that it sends information to all routers, also called flood method, which sends information about the status of all adjacent routes of the route. The status includes reachability and metric, which has many options, such as delay, distance, cost and so on. When to send it? It’s triggered only when the link state of the router changes. After this synchronization, all routers on the system know the structure of the whole network, and will establish a link-state database. OSPF can also divide areas, which improves efficiency and reduces traffic. Neighboring routers exchange greetings once every 10 seconds to see if the other router is alive, and send hongfan messages if some status changes. He doesn’t have a problem with bad news spreading slowly.

BGP

Since the Internet is quite large, if the above two-week protocol is used, the data transferred and the topology database created will be quite large and the efficiency is quite low. And the concerns of each autonomous system are different. You can’t uniformly select them with one variable. Some are money, some are distance, etc. Autonomous systems vary greatly from one system to another, from those that do not want to transmit data from other systems through themselves to those that do. Issues such as security and the economy should be considered. Therefore, the boundary gateway protocol can only strive for a better route that can reach the destination network. The border router of each AUTONOMOUS system needs to run both internal and external protocols. As a BGP spokesperson, he also passes on information about the list of autonomous systems through which to reach a network. The number of nodes is on the order of magnitude of the AUTONOMOUS system, so the number is much less, storing the destination network prefix, the next router, and the sequence of Autonomous systems that need to go through to reach the destination network. The sequence is to keep from going around in circles. I’m sure I’ll get back to myself in there.

It can be seen that the autonomous system strives to find a shortest cost path for data transmission, while the external system strives to find a reachable path that takes many other factors into account.

Some scenarios and rules

Packet forwarding of the subnet mask

1. Extract the destination IP address. 2. Find the hardware address 3. If there is no direct delivery, see if there is a specific host route to the destination address, if there is direct delivery 4. Check the network prefix (and subnet mask) of each entry in the router's routing table. If they are the same, go to the next address 5. I haven't checked whether there is a default route, if there is, it will be delivered directly. 6Copy the code

This article is formatted using MDNICE