Static routing principle

Routing principles

The router in the network layer of the OSI reference model, it is important to choose the best path for the role of the data packet, the final destination. So how to choose the path of the router is it? In only a segment of the network, the packet can easily reach the target host from the source host. But if a computer is to communicate, the data packet and non-computer network segment may go through many routers. As shown, network hosts A and B are separated by many routers where, when communication with the host A and the host B to go through these intermediate routers, which will face a very important problem - how to select arrival path to the destination. A packet arrival from B there are many alternative paths, it is clear that these paths at a time there is always a path is the best (fastest). Therefore, to increase speed as long as the network access, a need for a method to determine the best path to reach the destination host from the source host passes, thereby performing the data transfer, which is routing technology.

Screenshot micro-channel _20190806150453.png


The router works

(1) the host wants to send data packet to the host 1.1 4.1, because the IP address is not the same network segment, the host sends packets to a gateway router network segment A.

(2) A router receives a packet, first check the destination IP address in the IP packet header, and then look for its own routing table. Destination IP address of the packet is 4.1, 4.0 belonging to the network segment, the router A found in the routing table 4.0 forwarding network interface is S0 interface. Then, router A forwards the packet out from the S0 interface.

(3) Each router in the network are by the step of forwarding the data, until it reaches the router B, then the same method forwarded from the forwarding port E0, and finally 4.1 host receives the packet.

Screenshot micro-channel _20190806150845.png


Forming the routing table

Routing table entry router maintains a set route, the router to make the routing table routing

Directly connected network segment: Configure IP address, port UP state, a direct route (Long himself is directly connected)

Non-directly connected network segment: 20.0.0.0 like this is not directly connected route is not directly connected on the A (long on others is not directly connected)

Screenshot micro-channel _20190806151749.png

Static route: Router A wants to send data to a non-linear network segments 1.0 to configure static routes in the route A
manually configured, the unidirectional
lack of flexibility (small scale applied, relatively fixed topology network)
default route
, when a router can not find the destination network route entry in the routing table, the router forwards the request to the default routing interface (the presence of stub network, greatly simplifying routing configuration)

Screenshot micro-channel _20190806153124.png



Router forwards the packet encapsulation process


1, HostA the source and destination IP address encapsulated into data packets, but because it is not certain IP to forward the same segment by router A

2 E0 interface MAC address, the router A HostA obtained by ARP broadcast at the data link layer HostA encapsulates the IP packets into data frames, source mac address mac address of the target 00-11-12-21-11-11 gateway mac address E0 interface 00-11-12-21-22-22

3, router A receives the data frame from the E0 interface data link layer encapsulation removal, routing table lookup, to find the target and the routing table that matches the address ip, and then a next hop routing table data packet forwarding E1 interface

4, we need to reseal the E1 mac address obtained at this time also E1 interface of router B through ARP, and then re-encapsulation, then the source is the mac address mac address of the router A E1 interface 00-11-12- 21-33-33, target mac address of the router B E1 interface mac address 00-11-12-21-44-44

5, router B receives the data frame from the E1 interface, the same data link layer encapsulation is removed, the target ip address match in the routing table and next hop router according to the data packet to the interface E0, router B and finding the target IP network interface E0 through their direct connection, then re-obtained by the ARP broadcast HostB mac address, then the package, this time source mac address mac address of the router interface E0 B, the target address mac HostB mac address, the transmission completion after packaging directly to HostB.

Router forwards encapsulation process .png

Each router interface different network segments, different broadcast domains
each interface switch is collision domains

Screenshot micro-channel _20190806112537.png

Guess you like

Origin blog.51cto.com/14080162/2427115
Recommended