案例:
1.主要内容:
(1)在路由器上配置接口IP地址
(2)在路由器上配置OSPF协议
(3)在路由器上配置虚链路实现非0区域与区域0连接
(4)在ASBR上配置外部路由汇总
(5)在ABR上配置Stub和完全Stub
2.拓扑图
3.参考拓扑图:
1.路由器上配置接口IP地址
R1(config)#alias exec a show ip route
R1(config)#alias exec b show ip inter brief
R1(config)#alias exec c show running-config
R1(config)#alias exec d clear ip route *
R1(config)#no ip domain-lookup
R1(config)#line console 0
R1(config-line)#exec-timeout 0 0
R1(config-line)#logging synchronous
R1(config-line)#exit
R1(config)#INT lo0
R1(config-if)#ip add 192.223.4.1 255.255.255.128
R1(config-if)#int f0/0
R1(config-if)#ip add 192.223.1.1 255.255.255.0
R1(config-if)#no shutdown
R2(config)#int lo0
R2(config-if)#ip address 192.223.5.1 255.255.255.0
R2(config-if)#int f0/1
R2(config-if)#ip address 192.223.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#int f0/0
R2(config-if)#ip address 192.223.2.2 255.255.255.0
R2(config-if)#no shut
R3(config)#int f0/1
R3(config-if)#ip address 192.223.2.3 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/0
R3(config-if)#ip add 192.223.3.3 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo0
R3(config-if)#ip add 192.223.7.1 255.255.255.0
R4(config)#int lo0
R4(config-if)#ip address 192.223.6.1 255.255.255.0
R4(config-if)#int lo1
R4(config-if)#ip address 192.223.8.1 255.255.255.0
R4(config-if)#int lo2
R4(config-if)#ip add 192.223.9.1 255.255.255.0
R4(config-if)#int lo3
R4(config-if)#ip add 172.223.1.1 255.255.255.0
R4(config-if)#int lo4
R4(config-if)#ip add 172.223.2.1 255.255.255.0
R4(config)#int f0/1
R4(config-if)#ip add 192.223.3.4 255.255.255.0
R4(config-if)#no shut
R4#ping 192.223.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.223.3.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/7/12 ms
R2#ping 192.223.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.223.1.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 4/8/12 ms
R2#ping 192.223.2.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.223.2.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/3/4 ms
(2)在路由器上配置OSPF协议
R1(config)#router ospf 223
R1(config-router)#network 192.223.4.0 0.0.0.127 area 1
R1(config-router)#network 192.223.1.0 0.0.0.255 area 1
R2(config)#router ospf 223
R2(config-router)#network 192.223.1.0 0.0.0.255 area 1
R2(config-router)#network 192.223.5.0 0.0.0.255 area 0
R2(config-router)#network 192.223.2.0 0.0.0.255 area 0
R3(config)#router ospf 223
R3(config-router)#network 192.223.2.0 0.0.0.255 area 0
R3(config-router)#network 192.223.3.0 0.0.0.255 area 2
R3(config-router)#network 192.223.7.0 0.0.0.255 area 0
R4(config)#router ospf 223
R4(config-router)#network 192.223.6.0 0.0.0.255 area 2
R4(config-router)#network 192.223.3.0 0.0.0.255 area 2
3.在R4上配置
R4(config)#router ospf 223
R4(config-router)#network 192.223.8.0 0.0.0.255 area 3
R4(config-router)#network 192.223.9.0 0.0.0.255 area 3
3.配置在R3和R4上的虚链路
R3(config)#router ospf 223
R3(config-router)#area 2 virtual-link 192.223.9.1
R4(config)#router ospf 223
R4(config-router)#area 2 virtual-link 192.223.7.1
4.在R4上配置RIP路由选择协议
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#network 172.223.0.0
R4(config-router)#no auto-summary
5 在R4上对OSPF和RIP做路由重分发.
R4(config)#router ospf 223
R4(config-router)#redistribute rip metric 200 subnets
R4(config)#router rip
R4(config-router)#redistribute ospf 223 metric 10
6.在R4上自治系统外的路由汇总(为了减少路由条目)
R4(config)#router ospf 223
R4(config-router)#summary-address 172.223.0.0 255.255.0.0
7.为了减少区域1的路由条目,把区域1设为存根区域(不接受类型4和5路由)
R1(config)#router ospf 223
R1(config-router)#area 1 stub
8.将area 1设为完全存根区域(进一步简化R1的路由)
R2(config)#router ospf 223
R2(config-router)#area 1 stub no-summary
本文转自 gjp0731 51CTO博客,原文链接:http://blog.51cto.com/guojiping/950236