OSPF區域脫離骨幹解決方法---tunnel

 
 
第一步:

配置接口與啓用OSPF協議

配置如下:

R1

interface Loopback0
 ip address 1.1.1.1 255.255.255.0

 

interface FastEthernet0/0
 ip address 10.1.1.1 255.255.255.0

 

router ospf 1

 

network 1.1.1.0 0.0.0.255 area 0
 network 10.1.1.0 0.0.0.255 area 0

 

 

R2

 

interface Loopback0
 ip address 2.2.2.2 255.255.255.0

 

interface FastEthernet0/0
 ip address 10.1.1.2 255.255.255.0

 

interface FastEthernet1/0
 ip address 10.1.2.1 255.255.255.0

 

router ospf 1
network 2.2.2.0 0.0.0.255 area 1
 network 10.1.1.0 0.0.0.255 area 0
 network 10.1.2.0 0.0.0.255 area 1

 

 

 

R3

 

interface Loopback0
 ip address 3.3.3.3 255.255.255.0

 

interface FastEthernet0/0
 ip address 10.1.3.1 255.255.255.0

 

interface FastEthernet1/0
 ip address 10.1.2.2 255.255.255.0

 

router ospf 1
network 3.3.3.0 0.0.0.255 area 1
 network 10.1.2.0 0.0.0.255 area 1
 network 10.1.3.0 0.0.0.255 area 2

 

 

 

R4

 

 

interface Loopback0
 ip address 4.4.4.4 255.255.255.0

 

interface FastEthernet0/0
 ip address 10.1.3.2 255.255.255.0
 

 

router ospf 1

 

network 4.4.4.0 0.0.0.255 area 2
 network 10.1.3.0 0.0.0.255 area 2

 

 

 

第二步

查看路由表:

 

 

 

R1

 

R1#show 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 not set

 

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/2] via 10.1.1.2, 00:17:01, FastEthernet0/0

     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/3] via 10.1.1.2, 00:14:50, FastEthernet0/0

     10.0.0.0/24 is subnetted, 2 subnets
O IA    10.1.2.0 [110/2] via 10.1.1.2, 00:17:08, FastEthernet0/0

C       10.1.1.0 is directly connected, FastEthernet0/0
可以看到,它學到了area 1 中的路由條目,但學不到area2的路由條目。

原因是什麼呢?

大家先想想。後面我會介紹到的。

 

R2

 

R2#show 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 not set

 

     1.0.0.0/32 is subnetted, 1 subnets
O       1.1.1.1 [110/2] via 10.1.1.1, 00:20:55, FastEthernet0/0

     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/2] via 10.1.2.2, 00:18:45, FastEthernet1/0

     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.2.0 is directly connected, FastEthernet1/0
C       10.1.1.0 is directly connected, FastEthernet0/0

 

還是沒有R4的路由

 

 

R3

 

R3#show 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 not set

 

     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/3] via 10.1.2.1, 00:21:51, FastEthernet1/0

     2.0.0.0/32 is subnetted, 1 subnets
O       2.2.2.2 [110/2] via 10.1.2.1, 00:23:51, FastEthernet1/0

     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/2] via 10.1.3.2, 00:21:51, FastEthernet0/0

     10.0.0.0/24 is subnetted, 3 subnets
C       10.1.3.0 is directly connected, FastEthernet0/0
C       10.1.2.0 is directly connected, FastEthernet1/0
O IA    10.1.1.0 [110/2] via 10.1.2.1, 00:21:51, FastEthernet1/0

 

 

R4

 

R4#show 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 not set

 

     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.1.3.0 is directly connected, FastEthernet0/0

 

可以看到,R4上除了直連的路由以外是沒有別的遠程路由條目的。

 

 

第三步

 

我們來做 tunnel

 

也是在R2R3之間做

 

配置如下:

 

R2

 

R2(config)#interface tunnel 0

R2(config-if)#ip address 192.168.1.1 255.255.255.0

R2(config-if)#tunnel source f1/0-------(源地址)

R2(config-if)#tunnel destination 10.1.2.2-----------(目標地址)

R2(config-if)#exit

R2(config)#router ospf 1

 

R2(config-router)#network 192.168.1.0 255.255.255.0 area 0

 

 

 

R3

 

R3(config)#interface tunnel 0
R3(config-if)#ip address 192.168.1.2 255.255.255.0
R3(config-if)#tunnel source f1/0 -------本端接口
R3(config-if)#tunnel destination 10.1.2.1------對端接口
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#network 192.168.1.0 255.255.255.0 area----啓用OSPF,且area0

 

 

第四

 

查看路由表

 

R1

 

R1#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

 

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/2] via 10.1.1.2, 00:07:53, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/3] via 10.1.1.2, 00:07:53, FastEthernet0/0
     4.0.0.0/32 is subnetted, 1 subnets
O IA    4.4.4.4 [110/11114] via 10.1.1.2, 00:07:53, FastEthernet0/0
     10.0.0.0/24 is subnetted, 3 subnets
O IA    10.1.3.0 [110/11113] via 10.1.1.2, 00:07:53, FastEthernet0/0
O IA    10.1.2.0 [110/2] via 10.1.1.2, 00:07:54, FastEthernet0/0
C       10.1.1.0 is directly connected, FastEthernet0/0
O    192.168.1.0/24 [110/11112] via 10.1.1.2, 00:07:54, FastEthernet0/0
R1#

 

 

R2

 

 

 

R4#show 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 not set

 

     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/11114] via 10.1.3.1, 00:08:35, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/3] via 10.1.3.1, 00:08:44, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 10.1.3.1, 00:08:44, FastEthernet0/0
     4.0.0.0/24 is subnetted, 1 subnets
C       4.4.4.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 3 subnets
C       10.1.3.0 is directly connected, FastEthernet0/0
O IA    10.1.2.0 [110/2] via 10.1.3.1, 00:08:44, FastEthernet0/0
O IA    10.1.1.0 [110/11113] via 10.1.3.1, 00:08:35, FastEthernet0/0
O IA 192.168.1.0/24 [110/11112] via 10.1.3.1, 00:08:44, FastEthernet0/0
R4#

 

 

實驗完成!

                                         陳濱

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章