实验设计与排错之一静态路由


一、理解路由协议路由协议(Routing Protocol):用于路由器动态寻找网络最佳路径,保证所有路由器拥有相同的路由表。一般路由协议决定数据包在网络上的行走的路径。这类协议的例子有OSPF、RIP、IGRP、EIGRP等。可路由协议(Routed Protocol):当所有的路由器知道了整个网络的拓扑结构以后,可路由协议就可以用来发送数据。一般可路由协议分配给接口,用来决定数据包的投递方式。这类例子有IP和IPX静态路由。路由是指把1个数据包从1个设备发送到不同网络里的另1个设备上去,这些工作依靠路由器来完成。路由器并不关心主机,它们只关心网络的状态和决定网络中的最佳路径。路由器可以路由数据包,必须至少知道以下状况:目标地址(Destination Address)可以学习到远端网络状态的邻居路由器到达远端网络的所有路线到达远端网络的最佳路径如何保持和验证路由信息静态路由(Static Routing)静态路由是指在提供到不与路由器直接相连的远程网络的连接性,要在不使用路由选择协议的情况下提供端到端连接性,必须在两个方向上都配置静态路由,静态路由是由管理员手动添加到路由器的路由表中的。其优点是没有额外的路由器的CPU负担;节约带宽;增加安全性。缺点是网络管理员必须了解网络的整个拓扑结构;如果网络拓扑发生变化,管理员要在所有的路由器上手动修改路由表;不适合在大型网络中使用。ip route network [mask] [address|interface][distance] [permanent]network:是目标网络或目标子网。mask:子网掩码。address:下一跳的路由器IP地址。interface:是用于到达免费云主机域名目标网络的接口的名称。distance:是一个可选参数,用于指定管理距离;permanent:是一个可选参数,指定路由不会被删除,即使接口关闭了。
例如某公司原有3个子公司,分别为东莞沙田、东莞长安、印度,其中东莞沙田为总部,所有网络连通并可以正常通信。现因业务需要又收购一间小公司做办事处并接入总部网络,现在问题是办事处与总部及以外的子公司都无法通信(如上网络拓扑图)。3、拓扑表
由于是新增网络结点,新增之前网络均无问题,而新增之后出现问题。则可以初步判断是R4路由器上没有出去的路由,下面我们看看其路由表:R4#show ip routeCodes: C – connected, S – static, I -IGRP, R – RIP, M – mobile, B – BGPD – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter areaN1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGPi – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, ia – IS-IS inter area* – candidate default, U – per-user static route, o – ODRP – periodic downloaded static routeGateway of last resort is not set10.0.0.0/8 is variably subnetted, 4 subnets, 2 masksC10.2.0.0/16 is directlyconnected, FastEthernet0/1S 10.5.0.0/16 [1/0] via 10.2.0.2S 10.6.0.0/16 [1/0] via 10.2.0.2C10.13.0.0/22 is directly connected, FastEthernet0/0如红色部分已有指向R2、R3的路由,同时也有一条直连到R1的LAN口的线路,也可以在R4上ping通过R1、R2、R3所有IP地址(如下ping测试)。R4#ping 10.2.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to10.2.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5),round-trip min/avg/max = 0/0/1 msR4#ping 10.6.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to10.6.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5),round-trip min/avg/max = 1/1/2 msR4#ping 10.5.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to10.5.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5),round-trip min/avg/max = 1/5/20 msR4#ping 10.2.0.100Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to10.2.0.100, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5),round-trip min/avg/max = 0/3/15 msR4#按正常来说整个网络应该是正常才对,但这里有一个问题就是R1是否知道办事处的网段存在呢?那么我们先来看看它的路由表如下:R1#show ip routeCodes: C – connected, S – static, I -IGRP, R – RIP, M – mobile, B – BGPD – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter areaN1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2E1 – OSPF external type 1, E2 – OSPF external type 2, E – EGPi – IS-IS, L1 – IS-IS level-1, L2 – IS-IS level-2, ia – IS-IS interarea* – candidate default, U – per-user static route, o – ODRP – periodic downloaded static routeGateway of last resort is not set10.0.0.0/16is subnetted, 3 subnetsC 10.2.0.0is directly connected, FastEthernet0/0S 10.5.0.0 [1/0] via 192.168.10.2S 10.6.0.0 [1/0] via 192.168.20.2192.168.10.0/30is subnetted, 1 subnetsC 192.168.10.0is directly connected, Serial0/0192.168.20.0/30is subnetted, 1 subnetsC 192.168.20.0is directly connected, Serial0/1R1#从R1的路由表中我们不难看出其中同样有2条静态路由,分别指向东莞长安、印度,但的确没有指向R4的路由,也就是说R4根本就不知道办事处的存在,下面我们就来给它添加一条静态路由看看如何?R1(config)#iproute 10.13.0.0 255.255.0.0 10.2.0.3R1(config)#endR1#%SYS-5-CONFIG_I:Configured from console by consoleR1#show iprouteCodes: C -connected, S – static, I – IGRP, R – RIP, M – mobile, B – BGPD – EIGRP, EX – EIGRP external, O -OSPF, IA – OSPF inter areaN1 – OSPF NSSA external type 1, N2 -OSPF NSSA external type 2E1 – OSPF external type 1, E2 – OSPFexternal type 2, E – EGPi – IS-IS, L1 – IS-IS level-1, L2 -IS-IS level-2, ia – IS-IS inter area* – candidate default, U – per-userstatic route, o – ODRP – periodic downloaded static routeGateway oflast resort is not set10.0.0.0/16 is subnetted, 4 subnetsC 10.2.0.0 is directly connected,FastEthernet0/0S 10.5.0.0[1/0] via 192.168.10.2S 10.6.0.0[1/0] via 192.168.20.2S 10.13.0.0 [1/0] via 10.2.0.3192.168.10.0/30 is subnetted, 1 subnetsC 192.168.10.0 is directlyconnected, Serial0/0192.168.20.0/30 is subnetted, 1 subnetsC 192.168.20.0 is directlyconnected, Serial0/1R1#ping10.13.0.2Type escapesequence to abort.Sending 5,100-byte ICMP Echos to 10.13.0.2, timeout is 2 seconds:!!!!!Succe***ate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 msR1#ping10.13.0.100Type escapesequence to abort.Sending 5,100-byte ICMP Echos to 10.13.0.100, timeout is 2 seconds:!!!!!Succe***ate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 msR1#5、总结在此实例中应该想到两个问题,一是路由转发,若一个路由器不知道某个网段的存在,自然是不能为其转发任何数据包的。二是回路测试,如一条ping命令在发出后应该有一个出的条目和一个回来的条目才算完成。因此解决这两问题点后,自然可以解决其中的问题。

相关推荐: linux如何关闭nginx

这篇“linux如何关闭nginx”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“linux如何关闭nginx”文章吧。 linux关闭nginx…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 01/24 22:07
下一篇 01/24 22:07