关于简单动态路由协议配置,注入,路由重分布
Posted BigxBoss
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于简单动态路由协议配置,注入,路由重分布相关的知识,希望对你有一定的参考价值。
动态路由的配置记录基于cisco模拟器 Packet Tracer Student 6.2 ,一下是实践以及具体内容
拓扑结构基本如图所示:
RIP协议
RIP协议现有两个版本,v1和v2 ,
命令 | 功能 | 命令 | 功能 |
router rip | 指定使用RIP协议 | show ip route | 查看路由表信息 |
version {1|2} | 指定RIP版本 | show ip route rip | 查看RIP协议的路由信息 |
network network | 指定改路由器相连的网络 | show ip protocol | 查看路由协议的配置信息 |
两个版本的区别在于:
v1 不支持变长的子网掩码, 同时会将IP地址自动汇总
v2 支持变长的子网掩码,同时能够关闭自动汇总
RIPv1
1 Router(config)#router rip 2 Router(config-router)#version 1 //选择rip的版本,默认为 1 版本 3 Router(config-router)#do show ip route //查看直连网络 4 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 5 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 6 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 7 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 8 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 9 * - candidate default, U - per-user static route, o - ODR 10 P - periodic downloaded static route 11 12 Gateway of last resort is not set 13 14 1.0.0.0/24 is subnetted, 1 subnets 15 C 1.1.1.0 is directly connected, FastEthernet0/0 16 192.168.1.0/30 is subnetted, 1 subnets 17 C 192.168.1.0 is directly connected, Serial0/0/0 18 19 Router(config-router)#network 1.1.1.0 ? //从此处能够发现ripv1 的宣告规则 20 <cr> 21 Router(config-router)#network 1.1.1.0 22 Router(config-router)#network 192.168.1.0
通过ripv1来宣告路由方法如上
RIPv2
1 Router(config)#router rip 2 Router(config-router)#version 2 //选择rip 2版本 3 Router(config-router)#no auto-summary //关闭自动汇总 4 Router(config-router)#network 1.1.1.0 ? 5 <cr> 6 Router(config-router)#network 1.1.1.0 7 Router(config-router)#network 192.168.1.0
RIPv2 与RIPv1 配置方法均较为简单,但要注意最多支持15个路由器
除此之外有些共通的命令
1 Router(config)#int loopback 0 //采用回环接口,相当于建立虚拟主机 2 3 Router(config-if)# 4 %LINK-5-CHANGED: Interface Loopback0, changed state to up 5 6 %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up 7 8 Router(config-if)#ip address 15.15.15.15 255.255.255.255 9 Router(config-if)#do show ip route 10 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 11 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 12 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 13 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 14 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 15 * - candidate default, U - per-user static route, o - ODR 16 P - periodic downloaded static route 17 18 Gateway of last resort is not set 19 20 1.0.0.0/24 is subnetted, 1 subnets 21 C 1.1.1.0 is directly connected, FastEthernet0/0 22 15.0.0.0/32 is subnetted, 1 subnets 23 C 15.15.15.15 is directly connected, Loopback0 //在这里可以看到创建的回环地址 24 192.168.1.0/30 is subnetted, 1 subnets 25 C 192.168.1.0 is directly connected, Serial0/0/0
debug ip rip 显示更新过程
1 Router(config-if)#do debug ip rip 2 RIP protocol debugging is on
no debug ip rip 关闭显示更新过程
1 Router(config-if)#do no debug ip rip 2 RIP protocol debugging is off
passive-interface 禁止端口路由信息更新
Router(config-router)#passive-interface fastEthernet 0/0
rip中的路由重分发
Router(config-router)#default-information originate
rip中的动态路由注入
1 Router(config-router)#redistribute ? 2 connected Connected 3 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) //EIGRP协议 4 metric Metric for redistributed routes //重新分配路由的度量 5 ospf Open Shortest Path First (OSPF) //OSPF协议 6 rip Routing Information Protocol (RIP) //RIP协议 7 static Static routes //静态路由
在rip中注入ospf
1 Router(config-router)#redistribute ospf ? 2 <1-65535> Process ID 3 Router(config-router)#redistribute ospf 1
在rip中注入EIGRP
1 Router(config-router)#redistribute eigrp ? 2 <1-65535> Autonomous system number 3 Router(config-router)#redistribute eigrp 1
ospf协议
命令 | 功能 |
router ospf process-id | 指定使用OSPF协议 |
network address wildcard-mask area area-id | 指定与该路由器相连的网段 |
show ip route | 查看路由表信息 |
show ip route ospf |
查看OSPF协议的路由信息 |
1 Router(config)#router ospf ? 2 <1-65535> Process ID 3 Router(config)#router ospf 1 //使用OSPF协议,并且创建进程 ID=1 4 Router(config-router)#do show ip route 5 6 Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP 7 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 8 N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 9 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP 10 i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area 11 * - candidate default, U - per-user static route, o - ODR 12 P - periodic downloaded static route 13 14 Gateway of last resort is not set 15 16 1.0.0.0/24 is subnetted, 1 subnets 17 C 1.1.1.0 is directly connected, FastEthernet0/0 18 192.168.1.0/30 is subnetted, 1 subnets 19 C 192.168.1.0 is directly connected, Serial0/0/0 20 21 Router(config-router)#network 1.1.1.0 255.255.255.0 area 0 //在OSPF 中区分区域 0区域称为主干区域 使用并配置多个区域可减小链路状态数据
22 Router(config-router)#network 192.168.1.0 255.255.255.252 area 0
OSPF中注入RIP
1 Router(config-router)#router ospf 1 2 Router(config-router)#redistribute r 3 Router(config-router)#redistribute rip ? 4 metric Metric for redistributed routes 5 metric-type OSPF/IS-IS exterior metric type for redistributed routes // 6 subnets Consider subnets for redistribution into OSPF //考虑将子网重新分配到OSPF中 7 tag Set tag for routes redistributed into OSPF //为路由重新分配到OSPF的路由设置标记 8 <cr> 9 Router(config-router)#redistribute rip subnets
OSPF注入EIGRP
1 Router(config-router)#REdistribute Eigrp ? 2 <1-65535> Autonomous system number 3 Router(config-router)#REdistribute Eigrp 1 ? 4 metric Metric for redistributed routes 5 metric-type OSPF/IS-IS exterior metric type for redistributed routes 6 subnets Consider subnets for redistribution into OSPF 7 tag Set tag for routes redistributed into OSPF 8 <cr> 9 Router(config-router)#REdistribute Eigrp 1 Subnets
端口下OSPF的控制
1 Router(config-if)#bandwidth ? //修改开销值 2 <1-10000000> Bandwidth in kilobits 3 Router(config-if)#ip ospf hello-interval ? //修改hello包间隔时间 4 <1-65535> Seconds 5 Router(config-if)#ip ospf cost ? //指定接口开销 6 <1-65535> Cost
EIGRP协议
命令 | 功能 |
router eigrp autonomous-system | 指定使用IGRP协议 |
network network | 指定与该路由器相连的网络 |
show ip route | 查看路由表信息 |
show ip route eigrp | 查看IGRP协议的路由信息 |
1 Router(config)#router eigrp ? 2 <1-65535> Autonomous system number 3 Router(config)#router eigrp 1 4 Router(config-router)#no auto-summary 5 Router(config-router)#network 1.1.1.0 6 Router(config-router)#network 192.168.1.0
端口下EIGRP控制
1 Router(config-if)#ip summary-address ? 2 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) 3 Router(config-if)#ip summary-address eigrp ? 4 <1-65535> Autonomous system number 5 Router(config-if)#ip summary-address eigrp 1 ? 6 A.B.C.D IP address 7 //手动总结 8 Router(config-if)#ip hello-interval ? 9 eigrp Enhanced Interior Gateway Routing Protocol (EIGRP) 10 Router(config-if)#ip hello-interval e 11 Router(config-if)#ip hello-interval eigrp ? 12 <1-65535> Autonomous system number 13 Router(config-if)#ip hello-interval eigrp 1 ? 14 <1-65535> Seconds between hello transmissions
//设置hello 间隔和保留时间
EIGRP中的动态路由注入(以OSPF为例)
1 Router(config-router)#redistribute ospf 1 ? 2 match Redistribution of OSPF routes //OSPF路由重分布 3 metric Metric for redistributed routes //重新分配路由度量 4 <cr> 5 Router(config-router)#redistribute ospf 1 metric ? 6 <1-4294967295> Bandwidth metric in Kbits per second //带宽度量 7 Router(config-router)#redistribute ospf 1 metric 64 ? 8 <0-4294967295> EIGRP delay metric, in 10 microsecond units //延迟 9 Router(config-router)#redistribute ospf 1 metric 64 10 ? 10 <0-255> EIGRP reliability metric where 255 is 100% reliable //可靠性 11 Router(config-router)#redistribute ospf 1 metric 64 10 255 ? 12 <1-255> EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded //有效带宽加载 13 Router(config-router)#redistribute ospf 1 metric 64 10 255 1 ? 14 <1-65535> EIGRP MTU of the path //MTU路径 15 Router(config-router)#redistribute ospf 1 metric 64 10 255 1 1
以上是关于关于简单动态路由协议配置,注入,路由重分布的主要内容,如果未能解决你的问题,请参考以下文章