OSPF 的高级路由配置
1.实验拓扑:
 
2.实验目的:2.1按照拓扑图正确连接4台路由器
                     2.2完成NSSA的配置,进行路由重分发,并进行验证.
                      2.3   (Config-router)#area 51 nssa
                               (configt)#router rip
                               (Config-router)#redistribute ospf 7 metric 10
                               (config)#router ospf 8
                              (Config-router)# redistribute rip metric 200 subnets

3.操作详细配置
step 1.配置路由器SH1,SH3,GZ1,BJ的相应接口IP地址
路由器SH1配置如下:
Router(config)#HO SH1
SH1(config)#int lo 0
SH1(config-if)#ip add 192.168.64.1 255.255.255.0
SH1(config-if)#no shut
SH1(config-if)#exit
SH1(config)#int lo 5
SH1(config-if)#ip add 10.0.0.6 255.255.255.252
SH1(config-if)#no shut
SH1(config-if)#exit
SH1(config)#int f0/0
SH1(config-if)#ip add 192.168.1.1 255.255.255.0
SH1(config-if)#no shut
SH1(config-if)#exit
SH1(config)#
路由器SH3配置如下:
Router>
Router>EN
Router#CONF T
Router(config)#HO SH3
SH3(config)#int f0/0
SH3(config-if)#ip add 192.168.1.3 255.255.255.0
SH3(config-if)#no shut
SH3(config-if)#exit
SH3(config)#int lo 0
SH3(config-if)#ip add 192.168.3.1 255.255.255.0
SH3(config-if)#no shut
SH3(config-if)#exit
SH3(config)#int s1/0
SH3(config-if)#ip add 192.168.224.1 255.255.255.252
SH3(config-if)#no shut
SH3(config-if)#exit
SH3(config)#
路由器GZ1配置如下:
Router>en
Router#conf t
Router(config)#ho GZ1
GZ1(config)#int s1/0
GZ1(config-if)#ip add 192.168.224.2 255.255.255.252
GZ1(config-if)#no shut
GZ1(config-if)#exit
GZ1(config)#int f0/0
GZ1(config-if)#ip add 192.168.5.1 255.255.255.0
GZ1(config-if)#no shut
GZ1(config-if)#exit
GZ1(config)#
路由器BJ配置如下:
Router>EN
Router#CONF T
Router(config)#HO BJ
BJ(config)#int f0/0
BJ(config-if)#ip add 192.168.5.2 255.255.255.0
BJ(config-if)#no shut
BJ(config-if)#end
step2 .配置OSPF路由协议
路由器SH1配置如下:
 
SH1(config)#router ospf 7
SH1(config-router)#net 192.168.64.0 0.0.0.255 area 1
SH1(config-router)#net 192.168.1.0 0.0.0.255 area 0
SH1(config-router)#exit
SH1(config)#
路由器SH3配置如下:
SH3(config)#router ospf 8
SH3(config-router)#net 192.168.1.0 0.0.0.255 area 0
SH3(config-router)#net 192.168.3.0 0.0.0.255 area 0
SH3(config-router)#net 192.168.224.0 0.0.0.3 area 51
SH3(config-router)#end
路由器GZ1配置如下:

GZ1(config)#router ospf 9
GZ1(config-router)#net 192.168.224.0 0.0.0.3 area 51
GZ1(config-router)#end
查看SH1路由表
SH1#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
O IA    192.168.224.0 [110/65] via 192.168.1.3, 00:01:03, FastEthernet0/0
C    192.168.64.0/24 is directly connected, Loopback0
     10.0.0.0/30 is subnetted, 1 subnets
C       10.0.0.4 is directly connected, Loopback5
C    192.168.1.0/24 is directly connected, FastEthernet0/0
     192.168.3.0/32 is subnetted, 1 subnets
O       192.168.3.1 [110/2] via 192.168.1.3, 00:01:03, FastEthernet0/0
查看SH3路由表
SH3#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     192.168.64.0/32 is subnetted, 1 subnets
O IA    192.168.64.1 [110/2] via 192.168.1.1, 00:00:29, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.3.0/24 is directly connected, Loopback0
 
查看GZ1路由表
GZ1#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     192.168.64.0/32 is subnetted, 1 subnets
O IA    192.168.64.1 [110/66] via 192.168.224.1, 00:00:18, Serial1/0
C    192.168.5.0/24 is directly connected, FastEthernet0/0
O IA 192.168.1.0/24 [110/65] via 192.168.224.1, 00:00:18, Serial1/0
     192.168.3.0/32 is subnetted, 1 subnets
O IA    192.168.3.1 [110/65] via 192.168.224.1, 00:00:18, Serial1/0
验证:
SH1(config)#do ping 192.168.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 64/113/200 ms
SH1#ping 192.168.224.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.224.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 216/256/296 ms
 
step3 .配置 NSSA并进行路由重分发
 
路由器GZ1配置如下:
配置RIP
GZ1(config)#router rip
GZ1(config-router)#net 192.168.5.0
路由器BJ配置如下:
配置RIP
BJ#conf t
BJ(config)#router rip
BJ(config-router)#net 192.168.5.0
BJ(config-router)#exit
BJ(config)#
 
BJ#show ip rou
Codes: 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
Gateway of last resort is not set
C    192.168.5.0/24 is directly connected, FastEthernet0/0

配置 area 51为 nssa
路由器SH3配置如下:
SH3(config)#router ospf 8
SH3(config-router)#area 51 nssa
SH3(config-router)#end

路由器GZ1配置如下:
 
GZ1(config)#router ospf 9
GZ1(config-router)#area 51 nssa
GZ1(config-router)#end
 
在ASBR 路由器GZ1上进行路由重分发
路由器GZ1配置如下:
GZ1(config)#router ospf 9
GZ1(config-router)#redistribute rip metric 200 subnets
GZ1(config-router)#exit
GZ1(config)#router rip
GZ1(config-router)#redistribute ospf 8 metric 10
GZ1(config-router)#exit
GZ1(config)
查看SH1路由表
SH1#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
O IA    192.168.224.0 [110/65] via 192.168.1.3, 00:08:17, FastEthernet0/0
C    192.168.64.0/24 is directly connected, Loopback0
O E2 192.168.5.0/24 [110/200] via 192.168.1.3, 00:00:48, FastEthernet0/0
     10.0.0.0/30 is subnetted, 1 subnets

C       10.0.0.4 is directly connected, Loopback5
C    192.168.1.0/24 is directly connected, FastEthernet0/0
     192.168.3.0/32 is subnetted, 1 subnets
O       192.168.3.1 [110/2] via 192.168.1.3, 00:08:17, FastEthernet0/0
SH1#ping 192.168.5.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 388/489/688 ms
查看SH3路由表
SH3#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     192.168.64.0/32 is subnetted, 1 subnets
O IA    192.168.64.1 [110/2] via 192.168.1.1, 00:02:19, FastEthernet0/0
O N2 192.168.5.0/24 [110/200] via 192.168.224.2, 00:00:57, Serial1/0

C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.3.0/24 is directly connected, Loopbac
查看BJ路由表
BJ#show ip rou
Codes: 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
Gateway of last resort is not set
R    192.168.224.0/24 [120/10] via 192.168.5.1, 00:00:12, FastEthernet0/0
R    192.168.64.0/24 [120/10] via 192.168.5.1, 00:00:12, FastEthernet0/0
C    192.168.5.0/24 is directly connected, FastEthernet0/0
R    192.168.1.0/24 [120/10] via 192.168.5.1, 00:00:12, FastEthernet0/0
R    192.168.3.0/24 [120/10] via 192.168.5.1, 00:00:12, FastEthernet0/0
查看GZ1路由表
GZ1#show ip rou
Codes: 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
Gateway of last resort is not set
     192.168.224.0/30 is subnetted, 1 subnets
C       192.168.224.0 is directly connected, Serial1/0
     192.168.64.0/32 is subnetted, 1 subnets
O IA    192.168.64.1 [110/66] via 192.168.224.1, 00:01:57, Serial1/0
C    192.168.5.0/24 is directly connected, FastEthernet0/0
O IA 192.168.1.0/24 [110/65] via 192.168.224.1, 00:01:57, Serial1/0
     192.168.3.0/32 is subnetted, 1 subnets
O IA    192.168.3.1 [110/65] via 192.168.224.1, 00:01:57, Serial1/0