实验拓扑
基本配置
R1
Router>en
Router#conf terminal
Router(config)#hostname R1
interface e0/0
ip address 13.0.0.1 255.255.255.0
no sh
interface e0/1
ip address 12.0.0.1 255.255.255.0
no sh
interface e0/2
ip address 15.0.0.1 255.255.255.0
no sh
interface e0/3
ip address 14.0.0.1 255.255.255.0
no sh
R2
en
conf terminal
hostname R2
interface e0/0
ip address 12.0.0.2 255.255.255.0
no sh
interface loopback 0
ip address 172.16.0.2 255.255.255.0
no sh
interface loopback 1
ip address 172.16.1.2 255.255.255.0
no sh
interface loopback 2
ip address 172.16.2.2 255.255.255.0
no sh
interface loopback 3
ip address 172.16.3.2 255.255.255.0
no sh
R3
en
conf terminal
hostname R3
interface e0/0
ip address 13.0.0.3 255.255.255.0
no sh
interface loopback 4
ip address 172.16.4.3 255.255.255.0
no sh
interface loopback 5
ip address 172.16.5.3 255.255.255.0
no sh
interface loopback 6
ip address 172.16.6.3 255.255.255.0
no sh
interface loopback 7
ip address 172.16.7.3 255.255.255.0
no sh
R4
en
conf terminal
hostname R4
interface e0/0
ip address 14.0.0.4 255.255.255.0
no sh
interface e0/1
ip address 46.0.0.4 255.255.255.0
no sh
R5
en
conf terminal
hostname R5
interface e0/0
ip address 15.0.0.5 255.255.255.0
no sh
interface loopback 5
ip address 5.5.5.5 255.255.255.0
no sh
R6
en
conf terminal
hostname R6
interface e0/0
ip address 46.0.0.6 255.255.255.0
no sh
配置路由协议
R1
router rip
no au
ver 2
net 12.0.0.0
router eigrp 1
no au
net 13.0.0.0
router ospf 1
router-id 1. 1. 1.1
net 14.0.0.1 0.0.0.0 a 0
ip route 5.5.5.0 255.255.255.0 15.0.0.5 //配置静态路由到R5
R2
router rip
version 2
no auto
net 12.0.0.0
net 172.16.0.0
//rip 在宣告的时候不需要打反掩码,只需要打主类
R3
router eigrp 1
no auto
net 13.0.0.0
net 172.16.0.0
R4
router ospf 1
router-id 4.4.4.4
net 14.0.0.4 0.0.0.0 a 0
net 46.0.0.4 0.0.0.0 a 0
//R4要宣告两个接口
R5
ip route 0.0.0.0 0.0.0.0 15.0.0.1
R6
router ospf 1
router-id 6.6.6.6
net 46.0.0.6 0.0.0.0 a 0
检验
此时R1的路由表
R1#sh ip route
R1 现在拥有所有的路由
R1#ping 46.0.0.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 46.0.0.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 172.16.5.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.5.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
// R1现在ping其他ip地址都是可以通的
但是路由协议不兼容,R2的路由表只有直连,没有其他路由。
其他路由器也是一样,学不到其他协议的路由
配置路由重分发
RIP的路由注入到EIGRP中
// 在R1上面配置
R1(config)#router eigrp 1
R1(config-router)#redistribute rip //把rip 注入到EIGRP
但是R3还是学不到路由(EIGRP的种子度量值是无穷大)
R3# sh ip route eigrp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is not set
所以注入路由时时要加上eigrp的度量值
redistribute rip/ospf 1 metric 100000 10 255 1 1500
// 带宽 延迟 可靠性 负载 MTU
度量值要写被注入的接口的参数(实验中为R1的e0/1接口)、
R1# sh int e0/1
Ethernet0/1 is up, line protocol is up
Hardware is AmdP2, address is aabb.cc00.1010 (bia aabb.cc00.1010)
Internet address is 12.0.0.1/24
MTU 1500 bytes(最大传输单元), BW 10000 Kbit/sec(带宽), DLY 1000 usec,(延迟)**
reliability 255/255(可靠性), txload 1/255(负载), rxload 1/255**
Encapsulation ARPA, loopback not set
…
R1(config-router)#redistribute rip metric 1000 100 255 1 1500
//根据上面的信息配置度量值
此时R3已经能学到路由了
把ospf注入到eigrp
同样在R1上面配置
R1(config-router)#redistribute ospf 1 metric 1000 100 255 1 1500
R3上面能学到ospf的路由了
把其他协议注入到RIP
R1(config-router)#redistribute eigrp 1 metric ?
<0-16> Default metric //RIP的度量值只有条数
transparent Transparently redistribute metric
// 注入时不加参数依旧没有用
R1(config-router)#redistribute eigrp 1 metric 1
R2 上面可以学到eigrp注入的路由
R1(config-router)#redistribute ospf 1 metric 5
//把ospf注入的路由度量值为5
把路由注入到ospf
R1(config)#router ospf 1
R1(config-router)#redistribute rip //注入rip
R1(config-router)#redistribute eigrp 1 //注入 eigrp
//注入的开销都为20
参看R4是否学到路由
R4#sh ip route ospf
//我现在已经都学到了,但是老师说默认注入不加参数只能注入主类路由.不知道是不是系统版本问题.
注入近ospf的命令:
redistribute rip/eigrp/ospf 2 metric 1 metric-type 1 subnets
// ` 度量值 外部类型 子网路由
!默认注入主类路由,加上subnets可以注入子网路由(一定要加) !
R1(config-router)#redistribute rip subnets
R1(config-router)#redistribute eigrp 1 subnets
//加上subnets 参数查看效果(但是没啥效果好像不加也可以)
R6 也学到了注入的路由
但是R6的接口开销也是20
//因为ospf默认注入的类型是E2 开销为20 E2不计算内部开销,
可以修改外部路由的类型,命令如下:
R1(config-router)#redistribute rip subnets metric-type ?
1 Set OSPF External Type 1 metrics
2 Set OSPF External Type 2 metrics
把注入的rip类型改成1
R1(config-router)#redistribute rip subnets metric-type 1
查看R4 和R6 ospf路由表:
上图显示注入的rip路由开始计算内部开销了
也可以在注入时修改度量值
R1(config-router)#redistribute rip subnets metric 50 metric-type 1
//这条命令即引入了子网,又改了度量值 还修改了路由类型
直连路由注入rip EIGRP OSPF
R1(config)#router rip
R1(config-router)#redistribute connected ?
metric Metric for redistributed routes //
route-map Route map reference
<cr>
//不修改修改度量值默认是1 也可以手动修改度量值
R1(config-router)#redistribute connected
R1(config-router)#redistribute connected metric 8
//修改注入直连路由的度量值为8 其他的直连路由的度量值也会跟着改变,下图.
重新发布直连和静态
RIP
R1(config)#router rip
R1(config-router)#redistribute static
R1(config-router)#redistribute static ?
metric Metric for redistributed routes
route-map Route map reference
<cr>
//同样也可以修改度量值
R2学到了5.5.5.0
EIGRP
R1(config)#router EIGrp 1
R1(config-router)#redistribute connected
R1(config-router)#redistribute static
//同样可以不用添加参数
可以学到静态和直连路由
ospf
R1(config)#router ospf 1
R1(config-router)#redistribute connected subnets
R1(config-router)#redistribute static subnets
//需要加上引入子网
R4 R6都已经学到路由了
修改默认种子度量值
修改默认种子度量值就不用每次引入都下该参数了
ospf
R1(config)#router ospf 1
R1(config-router)#default-metric ?
<1-16777214> OSPF default metric //开销
EIGRP
R1(config)#router eigrp 1
R1(config-router)#default-metric ?
<1-4294967295> Bandwidth in Kbits per second //接口参数
rip
R1(config)#router rip
R1(config-router)#default-metric ?
<1-4294967295> Default metric 跳数
完成实验要求的配置[总结]
实验要求
配置路由协议:
R1和R3: EIGRP, ID5认证,禁止向R3发送查
R1和R4和R6: 0SPF
R1和R5:静态到达5网段
配置路由重分发:
RIP:度量值为5跳
EIGRP:度量值为快速以太网口默认值
0SPF:度量值为64,并且需要计算内部开销
全网通
R1配置
R1:
router rip
version 2
no auto
net 12.0.0.0
redistribute eigrp 1 metric 5
redistribute ospf 1 netric 5
redistribute connected subnets
redistribute static subnets
router eigrp 1
no auto
net13.0.0.0
redistribute rip metric 100000 10 255 1 1500
redistribute ospf 1 netric 100000 10 255 1 1500
redistribute connected subnets
redistribute static subnets
router ospf 1
router-id 1.1.1.1
net 14.0.0.1 0.0.0.0 a 0
redistribute rip subnets netric 64 netric-type 1
redistribute eigrp 1 subnets metric 64 metric-type 1
redistribute connected subnets
redistribute static subnets