实验27: default-information originate
1.实验目的
通过本实验可以掌握如何通过命令“default-information originate”向OSPF 网络
注入一条默认路由。
注:本实验用R0的环回接口1 来模拟Internet
2.实验拓扑
本实验的拓扑结构如图所示。
 
3.实验步骤
配置如下:
 
r0(config)#no ip do loo
r0(config)#lin c 0
r0(config-line)#logg s
r0(config-line)#exec-t 00
r0(config-line)#exit
r0(config)#int loo 1
r0(config-if)#  
*Mar  1 00:02:45.631: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r0(config-if)#ip add 1.1.1.1 255.255.255.0
r0(config-if)#int s0/1
*Mar  1 00:03:20.375: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:03:21.375: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r0(config-if)#int s0/1
r0(config-if)#ip add 172.16.1.1 255.255.255.0
r0(config-if)#no sh
r0(config-if)#
*Mar  1 00:03:38.475: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up
*Mar  1 00:03:39.475: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r0(config-if)#
*Mar  1 00:03:49.279: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
r0(config-if)#
*Mar  1 00:04:12.623: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to down
r0(config-if)#
*Mar  1 00:05:52.619: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
r0(config-if)#exit
r0(config)#ip route 0.0.0.0 0.0.0.0 loo 1  
r0(config)#router ospf 1
r0(config-router)#net 1.1.1.0 0.0.0.255 area 0
r0(config-router)#net 172.16.119.0 0.0.0.255 area 0
r0(config-router)#net 172.16.1.0 0.0.0.255 area 0
r0(config-router)#ex
*Mar  1 00:08:03.623: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/1 from LOADING to FULL, Loading Done
r0(config-router)#default-in
r0(config-router)#default-information ori
r0(config-router)#default-information originate
r0(config-router)#do ping 172.16.2.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/49/88 ms
r0(config-router)#do ping 3.3.3.3
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/76/120 ms
r0(config)#do 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 0.0.0.0 to network 0.0.0.0
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback1
     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/65] via 172.16.1.2, 00:11:22, Serial0/1
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/129] via 172.16.1.2, 00:11:22, Serial0/1
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/1
O       172.16.2.0 [110/128] via 172.16.1.2, 00:11:22, Serial0/1
S*   0.0.0.0/0 is directly connected, Loopback1
 
r0(config)#do sh ip ospf da
 
            OSPF Router with ID (1.1.1.1) (Process ID 1)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         789         0x80000003 0x00EE10 3
2.2.2.2         2.2.2.2         804         0x80000004 0x0015B8 5
3.3.3.3         3.3.3.3         894         0x80000003 0x008560 3
 
                Type-5 AS External Link States
 
Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         1.1.1.1         108         0x80000001 0x001D91 1
 
r1(config)#int loo 1
r1(config-if)#ip add 2.2..2
*Mar  1 00:05:23.583: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r1(config-if)#ip add 2.2.2.2 255.255.255.0
r1(config-if)#int s0/0
r1(config-if)#ip add 172.16.1.2 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#int s0/
*Mar  1 00:05:48.995: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:05:49.995: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r1(config)#int s0/1
r1(config-if)#ip add 172.16.2.1 255.255.255.0
r1(config-if)#no sh
r1(config-if)#exit
r1(config)#router ospf 1
r1(config-router)#net 172.16.1.0 0.0.0.255 area 0
r1(config-router)#net 172.16.2.0 0.0.0.255 area 0
r1(config-router)#
*Mar  1 00:06:33.831: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Serial0/1 from LOADING to FULL, Loading Done
r1(config-router)#net 2.2.2.0 0.0.0.255 area 0
r1(config-router)#exit
r1(config)#ip  
*Mar  1 00:08:03.291: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Serial0/0 from LOADING to FULL, Loading Done
r1(config)#do 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 172.16.1.1 to network 0.0.0.0
 
     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/65] via 172.16.1.1, 00:14:57, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback1
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/65] via 172.16.2.2, 00:14:57, Serial0/1
     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.1.0 is directly connected, Serial0/0
C       172.16.2.0 is directly connected, Serial0/1
O*E2 0.0.0.0/0 [110/1] via 172.16.1.1, 00:03:41, Serial0/0
从上面R0 的路由表的输出,可以看到通过命令“default-information originate
确实可以向OSPF 区域注入一条默认路由。
O*E2 0.0.0.0/0 [110/1] via 172.16.1.1, 00:03:41, Serial0/0
r1(config)#do sh ip ospf da
 
            OSPF Router with ID (2.2.2.2) (Process ID 1)
 
                Router Link States (Area 0)
 
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         945         0x80000003 0x00EE10 3
2.2.2.2         2.2.2.2         959         0x80000004 0x0015B8 5
3.3.3.3         3.3.3.3         1050        0x80000003 0x008560 3
 
                Type-5 AS External Link States
 
Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         1.1.1.1         264         0x80000001 0x001D91 1
通过查看R4 的拓扑结构数据库可以看到,确实从外面注入了一条类型5 LSA
 
 
r2(config)#int loo 1
r2(config-if)#ip add
*Mar  1 00:01:53.915: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback1, changed state to up
r2(config-if)#ip add 3.3.3.3 255.255.255.0
r2(config-if)#int s0/0
r2(config-if)#ip add 172.16.2.2 255.255.255.0
r2(config-if)#no sh
r2(config-if)#
*Mar  1 00:02:17.255: %LINK-3-UPDOWN: Interface Serial0/0, changed state to up
*Mar  1 00:02:18.255: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to up
r2(config-if)#exit
r2(config)#router ospf 1
r2(config-router)#net 3.3.3.0 0.0.0.255
% Incomplete command.
 
r2(config-router)#net 3.3.3.0 0.0.0.255 area 0
r2(config-router)#net 172.16.2.0 0.0.0.255 area 0
r2(config-router)#   
*Mar  1 00:06:33.459: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from LOADING to FULL, Loading Done
r2(config-router)#