此实验主要用来实现ospf域内的区域间汇总<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

一、基本配置
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no ip do lo
Router(config)#lin con 0
Router(config-line)#exec-ti 0 0
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#host R1
R1(config)#

 

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no ip do lo
Router(config)#lin con 0
Router(config-line)#exec-ti 0 0
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#host R2

R2(config)#

 

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no ip do lo
Router(config)#lin con 0
Router(config-line)#exec-ti 0 0
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#host R3

R3(config)#

 

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#no ip do lo
Router(config)#lin con 0
Router(config-line)#exec-ti 0 0
Router(config-line)#logg sy
Router(config-line)#exit
Router(config)#host R4

R4(config)#

 

二、接口配置

R1(config)#int s1/1
R1(config-if)#ip add 192.168.1.1 255.255.255.252
R1(config-if)#no sh
R1(config-if)#int lo 0
R1(config-if)#ip add <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.1.1.1 255.255.255.0
R1(config-if)#int lo 1
R1(config-if)#ip add 10.1.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#
R1(config)#int lo 0
R1(config-if)#ip ospf net point-to-point
R1(config-if)#int lo 1
R1(config-if)#ip ospf net point-to-point
R1(config-if)#exit

 

R2(config)#int s1/0
R2(config-if)#ip add 192.168.1.2 255.255.255.252

R2(config-if)#cl ra 64000
R2(config-if)#no sh
R2(config-if)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#ip ospf network point-to-point
R2(config-if)#int s1/1
R2(config-if)#ip add 192.168.1.5 255.255.255.252
R2(config-if)#no sh
R2(config-if)#exit

 

R3(config)#int s1/0
R3(config-if)#ip add 192.168.1.6 255.255.255.252

R3(config-if)#cl ra 64000
R3(config-if)#no sh
R3(config-if)#int s1/1
R3(config-if)#ip add 192.168.1.9 255.255.255.252
R3(config-if)#no sh
R3(config-if)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#ip ospf ne point-to-point
R3(config-if)#exit
R3(config)#

 

R4(config)#int s1/0
R4(config-if)#ip add 192.168.1.10 255.255.255.252

R4(config-if)#cl ra 64000
R4(config-if)#no sh
R4(config-if)#int lo 0
R4(config-if)#ip add 172.16.1.1 255.255.255.0
R4(config-if)#ip ospf net point-to-p
R4(config-if)#int lo 1
R4(config-if)#ip add 172.16.2.1 255.255.255.0
R4(config-if)#ip ospf ne point-to-p
R4(config-if)#exit

 

三、配置ospf

R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1      
R1(config-router)#net 10.1.1.1 0.0.0.0 a 1
R1(config-router)#net 10.1.2.1 0.0.0.0 a 1
R1(config-router)#net 192.168.1.1 0.0.0.0 a 1
R1(config-router)#exit

 

R2(config)#router ospf 100
R2(config-router)#router-id 2.2.2.2
R2(config-router)#net 192.168.1.2 0.0.0.0 a 1
R2(config-router)#net 192.168.1.5 0.0.0.0 a 0
R2(config-router)#net 2.2.2.2 0.0.0.0 a 0
R2(config-router)#exit

 

R3(config)#router ospf 100
R3(config-router)#router-id 3.3.3.3
R3(config-router)#net 192.168.1.6 0.0.0.0 a 0
R3(config-router)#net 192.168.1.9 0.0.0.0 a 2
R3(config-router)#net 3.3.3.3 0.0.0.0 a 0
R3(config-router)#exit
R3(config)#

R4(config)#router ospf 100
R4(config-router)#router-id 4.4.4.4
R4(config-router)#net 192.168.1.10 0.0.0.0 a 2
R4(config-router)#net 172.16.1.1 0.0.0.0 a 2
R4(config-router)#net 172.16.2.1 0.0.0.0 a 2

R4(config-router)#exit

 

四、验证连通性:

R1#p 172.16.1.1 so lo 0

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/61/128 ms
R1#p 172.16.2.1 so lo 1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.2.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/43/80 ms
R1#

全部通达

R2上查看路由表

R2#sh ip rou ospf
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/65] via 192.168.1.6, 00:04:58, Serial1/1
     172.16.0.0/24 is subnetted, 2 subnets
O IA    172.16.1.0 [110/129] via 192.168.1.6, 00:04:39, Serial1/1
O IA    172.16.2.0 [110/129] via 192.168.1.6, 00:04:39, Serial1/1
     10.0.0.0/24 is subnetted, 2 subnets
O       10.1.2.0 [110/65] via 192.168.1.1, 00:05:44, Serial1/0
O       10.1.1.0 [110/65] via 192.168.1.1, 00:05:44, Serial1/0
     192.168.1.0/30 is subnetted, 3 subnets
O IA    192.168.1.8 [110/128] via 192.168.1.6, 00:04:58, Serial1/1

以明细路由形式学习到了R1lo口和R4lo

现在对area 1 area 2进行汇总

分别在区域向外通告的ABR上作,area1R2上作,area 2R3上做

R2(config)#router ospf 100
R2(config-router)#area 1 range 10.1.0.0 255.255.0.0

 

R3(config)#router ospf 100
R3(config-router)#area 2 range 172.16.0.0 255.255.0.0

分别查看R2R3的路由表,汇总后会在本地产生一条汇总路由指向null0,同时路由表的明细路由被汇总路由替代

R2(config)#do sh ip rou ospf
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/65] via 192.168.1.6, 00:07:39, Serial1/1
O IA 172.16.0.0/16 [110/129] via 192.168.1.6, 00:04:26, Serial1/1
     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O       10.1.2.0/24 [110/65] via 192.168.1.1, 00:07:39, Serial1/0
O       10.1.1.0/24 [110/65] via 192.168.1.1, 00:07:39, Serial1/0
O       10.1.0.0/16 is a summary, 00:07:39, Null0
     192.168.1.0/30 is subnetted, 3 subnets
O IA    192.168.1.8 [110/128] via 192.168.1.6, 00:07:39, Serial1/1

 

R3(config)#do sh ip rou os
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 [110/65] via 192.168.1.5, 00:05:18, Serial1/0
     172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O       172.16.0.0/16 is a summary, 00:05:18, Null0
O       172.16.1.0/24 [110/65] via 192.168.1.10, 00:05:18, Serial1/1
O       172.16.2.0/24 [110/65] via 192.168.1.10, 00:05:18, Serial1/1
     10.0.0.0/16 is subnetted, 1 subnets
O IA    10.1.0.0 [110/129] via 192.168.1.5, 00:05:18, Serial1/0
     192.168.1.0/30 is subnetted, 3 subnets
O IA    192.168.1.0 [110/128] via 192.168.1.5, 00:05:18, Serial1/0