Static routing and configuration principle - the theory papers

                                                             静态路由原理与配置——理论篇

Objective: Understand the principles of routing
configuration of static and default routing learn
learning content:
① routing principle
works ② routers
form routing table ③
④ static and default routing
⑤ router forwards the packet encapsulation process

First, the principle of routing
routers work at the network layer of the OSI reference model, his forehead important role is to select the best path for the data treasure, the final destination.
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 from reaching the B There are many paths to choose from, but it is clear that these paths at some point there will always be a route is the 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.
Static routing and configuration principle - the theory papers

Second, the principle of the router
first look at the router how it works. For the average user, with access to the LAN only. By setting the default gateway on the LAN PC can make computers and the Internet to communicate. In fact, the default gateway on the PC set the IP address of the router Ethernet port. If the computers on the LAN to communicate with the outside of the computer, as long as the request to the router's Ethernet port to the next job will be done by the router. It can be said transit point is the Internet router, a network packet is forwarded by a router to a destination network.
How does the router to forward packets of it?
In fact, it has a routing table within each router is like to go out tourist maps we use. In the routing table, the destination network address contains all of the master router, the router and the best path through the network. The best path refers to an interface or next-hop router address of the router.
It is the existence of the routing table, the router can forward packets efficiently.
As shown, we simply explain an optimal path selection process of the router (here we abbreviated segment 192.168.1.0/24 1.0, other segments also empathy):
Static routing and configuration principle - the theory papers
1. send data to the host DATA to 1.1 host 4.1, because the IP address is not on the same network segment, the host family will send packets to the network segment of the network router A.
2. A router receives a packet, it will first check the IP packet header destination IP address in its routing table lookup. Found DATA packet destination address number is 4.1, 4.0 belonging to the network segment, the interface S0, then the router A sends the data packet out interface S0.
3. Similarly, Router B after receiving the data packet router A sends, will first check the destination IP address and its own routing table. At the same time the data packet transmitted from the network segment 4.0, E0 interface.
4. Final 4.1 host receives the packet.
This is the working principle of the router!

Third, the formation of the routing table
the routing table is a set of routing entries maintained in a router, the router to make routing according to the routing table.
Then the routing table is how did this happen?
① directly connected network segment, in simple words is long in his body segment, when configured IP address and port in the UP state, to form a directly connected segment
② non-directly connected network segments, while for non-directly connected network segment, requires a static routing or dynamic routing, network added to the routing table.
Figure:
Static routing and configuration principle - the theory papers

Fourth, static and default routing
① Static Routing
Static routes are manually configured by the administrator in the router fixed route.
The disadvantage is the lack of flexibility, but allows for precise routing of behavior control, while it is one-way.
Therefore, in general, static routing network for small scale, relatively fixed topology network.
Specifically as shown:
Static routing and configuration principle - the theory papers
② default route
default route is a static route entries when selecting a router can not make a match between the destination address in the routing table of the packet. If there is no default route, then the destination address of the packet does not match entries in the routing table are discarded.
The default routing feature is that it is only when a unique path to reach the other networks, the default route will greatly simplify the configuration of the router, reducing administrator workload, improve network performance.
It is specifically shown in FIG :( stub network: The network is only a unique path to reach the other network)
Static routing and configuration principle - the theory papers

五、路由器转发数据包的封装过程
我们用下图来模拟数据包转发封装过程,并做步骤解释:
Static routing and configuration principle - the theory papers
1.Host A 在网络层将来自上层的报文封装成 IP 数据包,其首部包含了源地址和目的地址。源地址即本机地址 192.168.1.2,目的地址为 Host B 的地址 192.168.2.2。此时发现目的地址与本机地址不在同一网段,因此发往 Host B 的数据包需要经过路由器 A 转发。
2.Host A 通过 ARP广播请求获得默认网关路由器A的E0口的MAC地址为00-11-12-21-22-22。在数据链路层 Host A 将 IP 数据包封装成以太网数据帧,在以太网数据帧首部的源 MAC 地址为 00-11-12-21-11-11,目的 MAC 地址为网关 E0 口的 MAC 地址 00-11-12-21-22-22。 此时,路由器A会根据收到的数据帧进行拆分,并查找自己的路由表,找出符合IP地址的路由表项,并重新封装,发送给下一跳地址E1接口。
3.在 E1 接口路由器 A 重新封装以太网帧,此时源 MAC 地址为路由器 A 的 E1 口 MAC地址 00-11-12-21-33-33,目的 MAC 地址为与之相连的路由器 B 的 E1 口 MAC 地址00-11-12-21-44-44。
4.路由器 B 从 E1 口接收到数据帧,同样会把数据链路层的封装去掉,对目的 IP 地址进行检查,并与路由表进行匹配,再根据路由表的下一跳信息将数据包转发到 E0 接口。路由器 B 发现目的网段与自己的 E0 接口直接相连,通过 ARP 广播,路由器 B 获得 Host B 以太口的 MAC 地址 00-11-12-21-66-66。路由器 B 再将 IP 数据包封装成以太网帧,源 MAC 地址为路由器 B 的 E0 口的 MAC 地址 00-11-12-21-55-55,目的 MAC 地址为 Host B 的 MAC 地址00-11-12-21-66-66。封装完毕,将以太网帧从 E0 接口发往 Host B。
因此,一般通过以上4步来进行数据包的转发封装,由此可以得出一个规律:IP地址始终不变,MAC地址一直改变!

交换域路由对比
-路由工作在网络层
根据“路由表”转发数据
路由选择
路由转发
-交换工作在数据链路层
根据"MAC地址表"转发数据
硬件转发

附:
对网络进行排错的时候需要用到的方法:
1.分层检查:
从物理层检查,查看端口状态来排除接口线缆等问题
查看IP地址和路由等的配置是否正确 
2.分段检查:
将网络划分成多个小段,逐段排除错误

Summary overview
of Routers work at the network layer of the OSI reference model, his forehead important role is to select the best path for the data treasure, the final destination. Routing table entry is a collection of routers maintain routing, the router to make the routing path selection table.
2. static route is one-way, if you want to achieve two communication parties, must be configured in a bi-directional communication both static route
3. The default route is a static route, when the route between the destination address of the packet table when there is no matching entry router can make a choice. If there is no default route, then the destination address of the packet does not match entries in the routing table are discarded.
4. In the process configuration of a route, when the network troubleshooting to be layered, check segment. Stratification check may first check from the physical layer, the network will check segmented into a plurality of small pieces, piecewise negative error.

Static routing fundamentals and configuration test case can refer to previous blog oh: https://blog.51cto.com/14481836/2427239

Guess you like

Origin blog.51cto.com/14481836/2427845