OSPF区域脱离骨干解决方法---tunnel

OSPF区域脱离骨干解决方法---tunnel_第1张图片
 
 
第一步:
配置接口与启用 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
 
也是在 R2 R3 之间做
 
配置如下:
 
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 ,且 area 0
 
 
第四
 
查看路由表
 
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#
 
 
实验完成!
                                         陈滨
 

你可能感兴趣的:(职场,路由,休闲,ospf)