立即注册 登录
雏鹰部落 返回首页

子杰的个人空间 https://bbs.spoto.net/?131778 [收藏] [复制] [分享] [RSS]

日志

OSPF多区域配置案例

已有 389 次阅读2013-3-11 09:58

 

1     案例配置拓扑

                

           

2     IP地址规划

 

Fastethernet0/0

Fastethernet1/0

R1

192.168.12.1/24

N/A

R2

192.168.12.2/24

192.168.23.2/24

R3

192.168.23.3/24

192.168.34.3/24

R4

192.168.34.4/24

N/A

3     案例配置需求

l  现有四台路由器运行OSPF协议,进程为1。设R1R2为区域1R2R3为区域0R3R4区域为2.

l  四台设备各配一个环回地址且分别都手动指定Router-id,分别为1.1.1.12.2.2.23.3.3.34.4.4.4

l  实现R1R4不同区域通过area0能相互通信。

4     案例配置思路

1)     配置各设备的接口地址和环回接口:

(config)#interface fastEthernet x/x

(config-if)#ip address x.x.x.x x.x.x.x

(config)#interface loopback 0

(config-if)#ip address x.x.x.x x.x.x.x

2)     配置各设备所属的OSPF的相应区域:

(config)#router ospf 1

(config-router)#router-id x.x.x.x

(config-router)#network x.x.x.x x.x.x.x area x

5     案例检验结果

1)     查看让不同区域相通信,现让R2设备属于area1area2两个区域时的状况:

R2#show ip protocols

Routing Protocol is "ospf 1"

  Outgoing ** filter list for all interfaces is not set

  Incoming ** filter list for all interfaces is not set

  Router ID 2.2.2.2

  Number of areas in this router is 2. 2 normal 0 stub 0 nssa

  Maximum path: 4

  Routing for Networks:

    2.2.2.0 0.0.0.255 area 1

    192.168.12.0 0.0.0.255 area 1

    192.168.23.0 0.0.0.255 area 2

  Routing Information Sources:

    Gateway         Distance      Last **

    4.4.4.4              110      00:03:34

    1.1.1.1              110      00:04:48

    3.3.3.3              110      00:03:34

  Distance: (default is 110)

/上面显示R2的一端接口属于area1,一端接口属于area2/

2)     查看R2能否与R1R3建立邻居关系:

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/BDR        00:00:38    192.168.12.1    FastEthernet0/0

3.3.3.3           1   FULL/DR         00:00:32    192.168.23.3    FastEthernet1/0

/上面显示R2R1R3都能建立邻居关系/

3)     查看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

 

C    192.168.12.0/24 is directly connected, FastEthernet0/0

     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       2.2.2.2 [110/2] via 192.168.12.2, 00:08:24, FastEthernet0/0

/上面显示R1此时不能学习到其他区域的路由条目,因为中间没有area0作为传输区域/

4)     查看让不同区域相通信,现让R2设备属于area1area0两个区域时的状况:

R2#show ip protocols

Routing Protocol is "ospf 1"

  Outgoing ** filter list for all interfaces is not set

  Incoming ** filter list for all interfaces is not set

  Router ID 2.2.2.2

  It is an area border router  /表示R2路由器为ABR,主要作用让区域0和非区域0相连/

  Number of areas in this router is 2. 2 normal 0 stub 0 nssa

  Maximum path: 4

  Routing for Networks:

    2.2.2.0 0.0.0.255 area 1

    192.168.12.0 0.0.0.255 area 1

    192.168.23.0 0.0.0.255 area 0

  Routing Information Sources:

    Gateway         Distance      Last **

    1.1.1.1              110      00:07:25

    3.3.3.3              110      00:07:25

  Distance: (default is 110)

/上面显示的是R2设备即属于区域0,也属于区域1。此时该路由器称为ABR/

5)     查看当R2属于两个不同区域时,是否能与这两个不同区域同时建立邻居:

R2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface

3.3.3.3           1   FULL/DR         00:00:30    192.168.23.3    FastEthernet1/0

1.1.1.1           1   FULL/BDR        00:00:32    192.168.12.1    FastEthernet0/0

/上面显示与R1area0)和R3(area1)都能建立邻居关系/

6)     查看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

 

C    192.168.12.0/24 is directly connected, FastEthernet0/0

     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       2.2.2.2 [110/2] via 192.168.12.2, 00:00:04, FastEthernet0/0

     3.0.0.0/32 is subnetted, 1 subnets

O IA    3.3.3.3 [110/3] via 192.168.12.2, 00:00:04, FastEthernet0/0

     4.0.0.0/32 is subnetted, 1 subnets

O IA    4.4.4.4 [110/4] via 192.168.12.2, 00:00:04, FastEthernet0/0

O IA 192.168.23.0/24 [110/2] via 192.168.12.2, 00:00:05, FastEthernet0/0

O IA 192.168.34.0/24 [110/3] via 192.168.12.2, 00:00:05, FastEthernet0/0

/上面显示O IA表示该路由条目是从别的区域学习到,不在自己所属的区域1/

7)     查看R1R4能否相互通信:

R1#ping 192.168.34.4

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.34.4, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 60/66/84 ms

6     案例配置文件

R1:


hostname R1
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 no shutdown
 exit
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.0 0.0.0.255 area 1
 network 192.168.12.0 0.0.0.255 area 1
!

 

R2:


hostname R2
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 no shutdown
 exit
!
interface FastEthernet1/0
 ip address 192.168.23.2 255.255.255.0
 no shutdown
 exit
!
router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 1
 network 192.168.12.0 0.0.0.255 area 1
 network 192.168.23.0 0.0.0.255 area 0
!

 

R3:


hostname R3
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.23.3 255.255.255.0
 no shutdown
 exit
!
interface FastEthernet1/0
 ip address 192.168.34.3 255.255.255.0
 no shutdown
 exit
!
router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes
 network 3.3.3.0 0.0.0.255 area 0
 network 192.168.23.0 0.0.0.255 area 0
 network 192.168.34.0 0.0.0.255 area 2
!

R4:

 

hostname R4
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.0
!
interface FastEthernet0/0
 ip address 192.168.34.4 255.255.255.0
 no shutdown
 exit
!
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 network 4.4.4.0 0.0.0.255 area 2
 network 192.168.34.0 0.0.0.255 area 2
!

7     案例总结及其

1)     不同区域要相互通信,中间需要area0作为传输区域。

2)     O IA表示不是本区域的路由条目,而是从别的区域学习到的路由条目。

3)     ABR的路由器定义:当路由器上有一个接口属于area0,另一个接口属于非area0,则此时该路由器就是ABRarea border router

 

 

 

 

 

 

 

 

 

-----------------------------------------------------------------------------------------

SPOTO 我们共创未来

 

您的朋友 周俊杰(Jay)
 

Email:zhoujj@spoto.net

新浪微博:http://weibo.com/zhoujj0130

新浪博客:http://blog.sina.com.cn/zhoujj0130

持续付出不亚于任何的人努力

-----------------------------------------------------------------------------------------

 

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-4-28 01:51 , Processed in 0.059616 second(s), 18 queries , Gzip On.

返回顶部