登录站点

用户名

密码

OSPF(七): Cisco OSPF default-informtion originate

已有 1783 次阅读  2013-09-28 01:37   标签Cisco  OSPF  default-informtion  originate 

本实验用R1的环回接口1来模拟Internet路由器R5。
1、配置路由器R1
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#int lo 1
R1(config-if)#ip add 5.5.5.5 255.255.255.0
R1(config-if)#int s0/0
R1(config-if)#no shut
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 110
R1(config-router)#router-id 1.1.1.1
R1(config-router)#net 1.1.1.0 0.0.0.255 a 0
R1(config-router)#net 192.168.12.0 0.0.0.255 a 0
R1(config-router)#default-information originate
R1(config-router)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 loopback 1

PS:“default-informtion originate”命令后面可以加可选的”always”参数,如果不使用该参数,路由器上必须存在一条默认路由,否则该命令不产生任何效果。如果使用该参数,无论路由器上是否存在默认路由,路由器都会向OSPF区域内注入一条默认路由。
 
2、配置路由器R2
R2(config)#int lo 0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#int s0/0
R2(config-if)#no shut
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config)#int s0/1
R2(config-if)#no shut
R2(config-if)#ip add 192.168.23.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 110
R2(config-router)#router-id 2.2.2.2
R2(config-router)#net 2.2.2.0 0.0.0.255 a 0
R2(config-router)#net 192.168.12.0 0.0.0.255 a 0
R2(config-router)#net 192.168.23.0 0.0.0.255 a 0
R2(config-router)#end
 
3、配置路由器R3
R3(config)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#int s0/0
R3(config-if)#no shut
R3(config-if)#ip add 192.168.34.3 255.255.255.0
R3(config-if)#int s0/1
R3(config-if)#no shut
R3(config-if)#ip add 192.168.23.3 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 110
R3(config-router)#router-id 3.3.3.3
R3(config-router)#net 3.3.3.3 0.0.0.255 a 0
R3(config-router)#net 192.168.23.0 0.0.0.255 a 0
R3(config-router)#net 192.168.34.0 0.0.0.255 a 0
R3(config-router)#end
 
4、配置路由器R4
R4(config)#int lo 0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#int s0/0
R4(config-if)#no shut
R4(config-if)#ip add 192.168.34.4 255.255.255.0
R4(config-if)#exit
R4(config)#router ospf 110
R4(config-router)#router-id 4.4.4.4
R4(config-router)#net 4.4.4.4 0.0.0.255 a 0
R4(config-router)#net 192.168.34.0 0.0.0.255 a 0
R4(config-router)#end
 
5、实验查看与调试
(1)show ip route
R4#sh ip route
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 192.168.34.3 to network 0.0.0.0
O    192.168.12.0/24 [110/192] via 192.168.34.3, 00:00:04, Serial0/0
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/193] via 192.168.34.3, 00:00:04, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 [110/129] via 192.168.34.3, 00:00:04, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] via 192.168.34.3, 00:00:04, Serial0/0
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
O    192.168.23.0/24 [110/128] via 192.168.34.3, 00:00:05, Serial0/0
C    192.168.34.0/24 is directly connected, Serial0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.34.3, 00:00:05, Serial0/0
R3#sh ip route
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 192.168.23.2 to network 0.0.0.0
O    192.168.12.0/24 [110/128] via 192.168.23.2, 00:00:15, Serial0/1
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/129] via 192.168.23.2, 00:00:15, Serial0/1
     2.0.0.0/24 is subnetted, 1 subnets
O       2.2.2.0 [110/65] via 192.168.23.2, 00:00:15, Serial0/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/65] via 192.168.34.4, 00:00:15, Serial0/0
C    192.168.23.0/24 is directly connected, Serial0/1
C    192.168.34.0/24 is directly connected, Serial0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.23.2, 00:00:16, Serial0/1
 
//从上面R3和R4的路由表的输出可以看到,通过”deafult-information originate”命令确实可以向OSPF区域注入一条默认路由。
 
(2)show ip ospf database
R4#sh ip ospf database
            OSPF Router with ID (4.4.4.4) (Process ID 110)
                Router Link States (Area 0)
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         309         0x80000005 0x00CFBD 3
2.2.2.2         2.2.2.2         661         0x80000001 0x008B53 5
3.3.3.3         3.3.3.3         655         0x80000002 0x006E2B 5
4.4.4.4         4.4.4.4         654         0x80000002 0x00AD8D 3
                Type-5 AS External Link States
Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         1.1.1.1         289         0x80000001 0x00CE72 110

//通过查看R4的链路状态数据库可以看到,确实从外面注入了一条类型5的LSA。
分享 举报