ARTICLE DETAIL

资讯详情

深耕网站视觉设计与运营推广的一线实战洞察。

动态路由配置

动态路由配置 动态路由配置原理RIPOSPF拓扑图示静态ip方式RIP方式要点说明案例OSPF方式要点说明案例ping通测试静态路由配置是动态路由配置的基础动态路由先配置每一个端口的IP之后在根据相应的动态路由配置协议进行相关配置原理RIPRIP是一种基于距离向量Distance Vector的内部网关协议Interior Gateway ProtocolIGP用于在小型网络中实现路由选择。其主要目的是通过交换路由信息来确定最佳的路径使数据包能够在网络中正确地转发到目的地。RIP使用距离向量算法来确定最佳路径。每个路由器根据自己所知道的网络拓扑信息计算到达目的网络的距离通常以跳数作为度量标准。路由器通过发送路由更新消息Route Update来交换信息并且周期性地广播自己的路由表给相邻的路由器。RIP的工作原理可以简单描述为以下几个步骤初始化当路由器启动时它会将自己的直连网络添加到路由表中并将距离设置为0表示直接可达。发送路由更新路由器定期广播其路由表给相邻的路由器。路由更新消息包含路由器所知道的所有网络及其距离。路由表更新当路由器接收到其他路由器发送的路由更新消息时它会根据接收到的信息更新自己的路由表。如果接收到的路由信息表示到达某个网络的路径更短那么路由器会更新自己的路由表以反映最新的最佳路径。路由选择当路由器需要转发数据包时它会根据自己的路由表选择最佳路径。通常路由器选择到达目的网络跳数最少的路径作为最佳路径。定期更新为了保持路由表的最新状态RIP路由器周期性地广播自己的路由表。这样可以确保网络中的所有路由器都具有相同的网络拓扑信息。需要注意的是RIP有一些限制如最大跳数限制和慢收敛速度等。为了解决这些问题更高级的路由协议如OSPFOpen Shortest Path First和BGPBorder Gateway Protocol被广泛使用在大型网络中。OSPFOSPF拓扑图示用以下3中方法配置该拓扑结构使3个PC能够互相ping通静态ip方式方法和前面的静态IP配置相似详见静态路由配置此处省略RIP方式要点说明R2(config)#router ripR2(config-router)#version 2version 有1和2两个参数1的子网掩码只能是按照ABCDE的分类划分2可以遵循CIDR动态子网掩码划分R2(config-router)#network 192.168.11.0要广播的ip段案例3个路由器的配置雷同此处以R2为例R2en R2# R2#conf t Enter configuration commands,one per line.End with CNTL/Z.R2(config)#intf0/0R2(config-if)#ip address192.168.11.2255.255.255.0R2(config-if)#no shutdownR2(config-if)#%LINK-5-CHANGED:Interface FastEthernet0/0,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/0,changed state to upR2(config-if)#exR2(config)#intf0/1R2(config-if)#ip address192.168.13.2255.255.255.0R2(config-if)#no shutdownR2(config-if)#%LINK-5-CHANGED:Interface FastEthernet0/1,changed state to upR2(config-if)#exR2(config)#inte0/0/0R2(config-if)#ip address192.168.2.254255.255.255.0R2(config-if)#no shR2(config-if)#%LINK-5-CHANGED:Interface Ethernet0/0/0,changed state to up%LINEPROTO-5-UPDOWN:Line protocol on Interface Ethernet0/0/0,changed state to upR2(config-if)#exR2(config)#%LINEPROTO-5-UPDOWN:Line protocol on Interface FastEthernet0/1,changed state to upR2(config)#R2(config)#router ripR2(config-router)#version2R2(config-router)#network192.168.11.0R2(config-router)#network192.168.13.0R2(config-router)#network192.168.2.0R2(config-router)#exR2(config)#ex R2#sh ip route Codes:C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP D-EIGRP,EX-EIGRP external,O-OSPF,IA-OSPF inter area N1-OSPF NSSA external type1,N2-OSPF NSSA external type2E1-OSPF external type1,E2-OSPF external type2,E-EGP i-IS-IS,L1-IS-IS level-1,L2-IS-IS level-2,ia-IS-IS inter area*-candidatedefault,U-per-userstaticroute,o-ODR P-periodic downloadedstaticroute Gateway of last resort isnotset R192.168.1.0/24[120/1]via192.168.11.1,00:00:03,FastEthernet0/0C192.168.2.0/24is directly connected,Ethernet0/0/0R192.168.3.0/24[120/1]via192.168.13.1,00:00:20,FastEthernet0/1C192.168.11.0/24is directly connected,FastEthernet0/0R192.168.12.0/24[120/1]via192.168.11.1,00:00:03,FastEthernet0/0[120/1]via192.168.13.1,00:00:20,FastEthernet0/1C192.168.13.0/24is directly connected,FastEthernet0/1OSPF方式要点说明R3(config)#router ospf 1R3(config-router)#network 192.168.11.0 0.0.0.255 area 0network 要广播的ip段 子网掩码的反码 area 区域id案例3个路由器的配置雷同这里以R3为例。注此处的端口号的ip配置省略R3#conf t Enter configuration commands,one per line.End with CNTL/Z.R3(config)#router ospf1R3(config-router)#network?A.B.C.D Network numberR3(config-router)#network192.168.11.00.0.0.255?area Set the OSPF area IDR3(config-router)#network192.168.11.00.0.0.255area0R3(config-router)#network192.168.2.00.0.0.255area0R3(config-router)#network192.168.13.00.0.0.255area0R3(config-router)#exR3(config)#ex R3#sh ip route Codes:C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP D-EIGRP,EX-EIGRP external,O-OSPF,IA-OSPF inter area N1-OSPF NSSA external type1,N2-OSPF NSSA external type2E1-OSPF external type1,E2-OSPF external type2,E-EGP i-IS-IS,L1-IS-IS level-1,L2-IS-IS level-2,ia-IS-IS inter area*-candidatedefault,U-per-userstaticroute,o-ODR P-periodic downloadedstaticroute Gateway of last resort isnotset C192.168.2.0/24is directly connected,Ethernet0/0/0O192.168.3.0/24[110/11]via192.168.13.1,00:04:52,FastEthernet0/0C192.168.11.0/24is directly connected,FastEthernet0/1O192.168.12.0/24[110/2]via192.168.13.1,00:04:52,FastEthernet0/0C192.168.13.0/24is directly connected,FastEthernet0/0R3#sh ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface192.168.13.11FULL/BDR00:00:35192.168.13.1FastEthernet0/0ping通测试原创内容笔者才疏学浅若有错误或遗漏之处还望海涵敬请指正如有转载请注明出处谢谢
返回列表