Nine, IP routing foundation and static routing infrastructure

Ethernet switch operates in a data link layer, for data transfer within the network. The topology of the enterprise network generally more complex, different departments, or the headquarters and branches may be in different networks, then you need to use a router to connect to different networks, forwarding data between networks.

IP Routing Basics

Autonomous system

Here Insert Picture Description
Autonomous System (AS): a router with a management authority, using a uniform set of routing policy. (Single entity under the jurisdiction of the network, such as a corporate network, an Internet service provider, a organization of institutions. In BGP involving more)

LAN (local area network) and broadcast domain

Here Insert Picture Description
Routers are used to separate different broadcast domains. Under different router interfaces belong to different network segments.

Route selection

Here Insert Picture Description
Routers are responsible for selecting an optimal route data packets, and forwards. As shown, the RTA is assumed that the data to be transmitted to the RTD, two paths will be selected at this time. At this point we need to be routed by the routing table. Routing principles behind the blog will slowly introduced. During route selection, keep the following two steps:

  1. Selecting an optimal path for the data packet
  2. Forwarded

IP routing table

Here Insert Picture Description
Routing table contains the destination network router can be reached. The destination network does not exist in the routing table data packet is dropped.
On various parameters shown in FIG.

  1. destination: Destination network segment
  2. mask: the mask length
  3. proto: protocol type
  4. pre: route priority
  5. cost: path cost (the smaller the priority)
  6. nexthop: next hop address
  7. interface: an interface to
    establish a routing table mainly through direct, static and dynamic routing protocols (OSPF, RIP) established. By table display ip-routing view the routing table.

Route Preferences

Here Insert Picture Description
Different routing protocols have different priorities
Here Insert Picture Description

The longest match

Here Insert Picture Description
Routing table if there are multiple matching entries in the destination network routing, the router chooses the longest entry mask.

Router to forward packets

Here Insert Picture Description
Routers need to know that next hop and outbound interface to forward the data out. . At this point mention the meaning of communication: Communication is two-way, have to go back there in it is called communication.

Router selecting the best route order

  1. Route Preferences
  2. cost and the longest match

路由表中Pre的单词为:preference。百度翻译中含义为偏爱,我们只需要记住数值越小越优先即可。

静态路由基础

静态路由是指由管理员手动配置和维护的路由。
静态路由配置简单,被广泛应用于网络中。另外,静态路由还可以实现负载均衡和路由备份。因此,学习并掌握好静态路由的应用与配置是非常必要的。
在一个网络中,我们无法保证某条线路不会出现意外情况,所以当某条线路出现问题的时候,我们需要该网络依旧畅通,不影响使用。所以要采用备份机制。负载均衡是,例如上面路由基础中有一张图是RTA到RTD有两条路可以选择,但是因为我们需要到达的是同一个目的地。所以如果能让两条线路都利用起来,相当于增加了我们的带宽,不会造成浪费。一般而言,负载均衡和备份会同时使用。
Here Insert Picture Description
如图所示,既可以做备份,也可以做负载均衡。

静态路由应用场景

Here Insert Picture Description
静态路由是指由管理员手动配置和维护的路由。一般而言,访问外网时配置的就是静态路由(缺省路由)。
缺省路由的含义是:代表除了路由器上知道的所有网络。
因为在我们的internet网中,存在数不清的网络,我们不可能将每个网段都写入我们的路由器中,所以使用缺省路由来代替。

静态路由配置

Here Insert Picture Description
路由器各个接口IP地址如图中所示,其中R1和R2相连网段为192.168.1.0/24,R2与R3之间相连网段为192.168.2.0/24。注意观察,R2两个接口的配置不是属于同一网段的,与前面提到的相呼应。
配置相同网段时:
Here Insert Picture Description
显示的是有冲突的。
在没配置静态路由时,网段之内是可以通信的,但是网段与网段之间是不可以通信的。
Here Insert Picture Description
配置命令:

ip route-static 目的网段 掩码 下一跳

Here Insert Picture Description
前面提过。通信是一个双向的过程,所以,在R3上也需要配置到达R1的路由。
Here Insert Picture Description
此时再ping一下试试:
Here Insert Picture Description
此时可以看到是成功的,通过tracert查看它经过的路径:
Here Insert Picture Description
可以看到它经过的路径,同时tracert的工作原理在前面的博客有写。
查看一下路由表:display ip routing-table
Here Insert Picture Description
在串行接口上,可以通过指定下一跳地址或出接口来配置静态路由。但是现在不太使用串行口了,所以就不演示了。串行口为ensp中这个图标
Here Insert Picture Description
有兴趣的话可以自己配置一下,配置命令是一样的,只需要把下一跳换成出接口就好了。

负载分担

静态路由支持到达同一目的地的等价负载分担。
Here Insert Picture Description
交换机里面是没有配置的,此时把它当作集线器来用即可。
配置命令:同时需要在R5上配置。
Here Insert Picture Description
Here Insert Picture Description
查看路由表:
Here Insert Picture Description
此时可以看到去R5的两条路由是等价的,此时便实现了等价负载分担。
【注】L0为环回口
环回口定义:是路由器上的一个逻辑、虚拟接口。此处用来代表路由去R4、R5。你可以理解为路由器的另一个接口,只不过是虚拟出来的。

路由备份

采用的依旧是刚刚那张图

Here Insert Picture Description
Configuration is slightly different:
Here Insert Picture Description
the backup to below that line. Note followed in preference to 100. The static priority of 60, this time we'll look at the routing table:
Here Insert Picture Description
can clearly find that link below to be hidden. But above this line came out the problem (here manually shut down G 0/0/0), below that line will be able to play a role.
Here Insert Picture Description
As illustrated, above the line error occurs. The following lines will unravel. The following also called a floating piece of the backup line static routing. When the active link fails, and it will be added to the routing table to forward data traffic.

Default route

Here Insert Picture Description
A default route is the destination address and the mask are both special routing all zeros.
If the destination address of the packet fails to match any entry in the routing table, the router will be selected in accordance with the default route to forward packets. However, the default route prone loops, it is generally used to access the external network (Mentioned earlier).
ok, next say RIP, OSPF on the back to say, but starting with the OSPF wrote two articles, but not complete, if future experiments related to OSPF can refer to previous blog.

Published 65 original articles · won praise 9 · views 1419

Guess you like

Origin blog.csdn.net/weixin_44064040/article/details/104655897