实验题目及ip地址规划
配置各个路由器接口的IP地址及各个路由器之间的环回
R1
[R1]int loop0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]int G0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int G0/0/1
[R1-GigabitEthernet0/0/1]ip add 13.1.1.1 24
R2
[R2]int loop0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]int G0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int G0/0/01
[R2-GigabitEthernet0/0/1]ip add 24.1.1.1 24
R3
[R3]int loop0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]int G0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.1.1.2 24
[R3-GigabitEthernet0/0/0]int G0/0/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
R4
[R4]int loop0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int G0/0/0
[R4-GigabitEthernet0/0/0]ip add 24.1.1.2 24
[R4-GigabitEthernet0/0/0]int G0/0/1
[R4-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/1]int G0/0/2
[R4-GigabitEthernet0/0/2]ip add 45.1.1.1 24
R5
[R5]int loop0
[R5-LoopBack0]ip add 5.5.5.5 24
[R5-LoopBack0]int G0/0/0
[R5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[R5-GigabitEthernet0/0/0]int G0/0/1
[R5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
R6
[R6]int G0/0/0
[R6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
[R6-GigabitEthernet0/0/0]int loop0
[R6-LoopBack0]ip add 6.6.6.6 24
[R6-LoopBack0]int G0/0/1
[R6-GigabitEthernet0/0/1]ip add 67.1.1.1 24
R7
[R7]int G0/0/0
[R7-GigabitEthernet0/0/0]ip add 67.1.1.2 24
[R7-GigabitEthernet0/0/0]int loop0
[R7-LoopBack0]ip add 7.7.7.7 24
配置RIP协议
R1
[R1]rip 1
[R1-rip-1]ver 2
[R1-rip-1]network 1.0.0.0
[R1-rip-1]net 12.0.0.0
[R1-rip-1]net 13.0.0.0
R2
[R2]rip 1
[R2-rip-1]ver 2
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 2.0.0.0
R3
[R3]rip 1
[R3-rip-1]ver 2
[R3-rip-1]network 13.0.0.0
配置OSPF协议
R2
[R2]os
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
R4
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 45.1.1.1 0.0.0.0
R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 56.1.1.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0
R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 56.1.1.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 67.1.1.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
R7
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 67.1.1.2 0.0.0.0
R7进行重发布以造成环路
R2和R3路由在ospf引入R7环回后也有了R7的环回路由,但R1在没有对R2,R3做重发布的时候是没有R7环回的路由的
[R7]ospf 1
[R7-ospf-1]import-route direct
查看R6 R4路由是否引入了R7的回环
R6
R4
R2,R3双向重发布
R2
[R2]rip
[R2-rip-1]import-route ospf 1
[R2-rip-1]q
[R2]ospf 1
[R2-ospf-1]import-route rip
R3
[R3]ospf 1
[R3-ospf-1]import-route rip
[R3-ospf-1]q
[R3]rip 1
[R3-rip-1]import-route ospf 1
出现环路
查看R4路由表及路由表数据库
路由库数据库
由以上两图得出到7的回环出现了环路
破环
更改优先级
R3
[R3]ip ip
[R3]ip ip-prefix b permit 7.7.7.0 24
[R3]route-policy bb permit node 10
[R3-route-policy]if-match ip-prefix b
[R3-route-policy]apply preference 151
[R3-route-policy]q
关闭R3,R4之间的连接
查看R3路由表及优先级
调用
[R3]rip
[R3-rip-1]preference route-policy bb
查看路由表优先级
恢复3,4之间的连接
按理R2
[R2]ip ip-prefix b permit 7.7.7.0 24
[R2]route-policy b permit node 10
[R2-route-policy]if-match ip-prefix b
[R2-route-policy]apply preference 151
[R2]rip
[R2-rip-1]preference route-policy b
上图标出的地方应该负载均衡
将R3的回环改为3.3.3.3/32
[R3]int loop0
[R3-LoopBack0]ip add 3.3.3.3 32
查看R1路由表,虽然已将负载均衡了,但是还有一条残留,这里出环了,解决办法就是将R1,R3之间的连接断开重连就行
选路最佳
R2
[R2]ip ip-prefix y permit 3.3.3.3 32
[R2]ip ip-prefix y permit 34.1.1.0 24
[R2]int G0/0/0
[R2-GigabitEthernet0/0/0]rip metricout ip-prefix y 2
R3
[R3]ip ip-prefix y permit 24.1.1.0 24
[R3]int G0/0/1
[R3-GigabitEthernet0/0/1]rip metricout ip-prefix y 2
R2
[R2]ip ip
[R2]ip ip-prefix c permit 12.1.1.0 24
[R2]ip ip-prefix c permit 2.2.2.0 24
[R2]route-policy cc permit node 10
Info: New Sequence of this List.
[R2-route-policy]if-match ip-prefix c
[R2-route-policy]apply cost-type type-1
[R2-route-policy]q
[R2]route-policy cc permit node 20
Info: New Sequence of this List.
[R2-route-policy]q
[R2]ospf 1
[R2-ospf-1]import-route rip route-policy cc
[R2-ospf-1]
R3
[R3]ip ip
[R3]ip ip-prefix c permit 13.1.1.0 24
[R3]route-policy cc permit node 10
Info: New Sequence of this List.
[R3-route-policy]if-match ip-prefix c
[R3-route-policy]apply cost-type type-1
[R3-route-policy]q
[R3]route-policy cc permit node 20
Info: New Sequence of this List.
[R3-route-policy]q
[R3]ospf 1
[R3-ospf-1]import-route rip route-policy cc
[R3-ospf-1]