华为OSPF区域路由聚合的配置案例

6.3        OSPF路由协议
6.3.1           OSPF的基本配置
【需求】

两台PC所在网段,通过两台使用OSPF协议的路由器实现互连互通。

【组网图】

 

【配置脚本(一)】

RouterA配置脚本

#

sysname RouterA

#

router id 1.1.1.1      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet0/0

ip address 10.1.1.1 255.255.255.0

#

interface Serial0/0

link-protocol ppp

ip address 20.1.1.1 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

#

ospf 1                           /启动ospf路由协议/

area 0.0.0.0                     /创建区域0/

network 1.1.1.1 0.0.0.0          /接口loop 0使能OSPF/

network 10.1.1.0 0.0.0.255       /接口e0/0使能OSPF/

network 20.1.1.0 0.0.0.3         /接口s0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

RouterB配置脚本

#

sysname RouterB

#

router id 1.1.1.2      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet0/0

ip address 30.1.1.1 255.255.255.0

#

interface Serial0/0

link-protocol ppp

ip address 20.1.1.2 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.2 255.255.255.255

#

ospf 1                       /启动ospf路由协议/

area 0.0.0.0                 /创建区域0/

network 1.1.1.2 0.0.0.0      /接口loop 0使能OSPF/

network 20.1.1.0 0.0.0.3     /接口s0/0使能OSPF/

network 30.1.1.0 0.0.0.255   /接口e0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

 

【验证】

RouterA和RouterB可以通过OSPF学习到对方路由信息,并可以ping通对方网段。

RouterA路由表:

[RouterA]disp ip routing-table                                                 

Routing Table: public net                                                     

Destination/Mask   Protocol Pre Cost        Nexthop         Interface         

1.1.1.1/32         DIRECT              127.0.0.1       InLoopBack0       

1.1.1.2/32         OSPF     10   1563        20.1.1.2        Serial0/0       

10.1.1.0/24        DIRECT              10.1.1.1        Ethernet0/0     

10.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.0/30        DIRECT              20.1.1.1        Serial0/0       

20.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.2/32        DIRECT              20.1.1.2        Serial0/0       

30.1.1.0/24        OSPF     10   1563        20.1.1.2        Serial0/0       

127.0.0.0/8        DIRECT              127.0.0.1       InLoopBack0       

127.0.0.1/32       DIRECT              127.0.0.1       InLoopB

 

【配置脚本(二)】

RouterA配置脚本

#

sysname RouterA

#

router id 1.1.1.1      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet0/0

ip address 10.1.1.1 255.255.255.0

#

interface Serial0/0

link-protocol ppp

ip address 20.1.1.1 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

#

ospf 1                           /启动ospf路由协议/

area 0.0.0.0                     /创建区域0/

network 1.1.1.1 0.0.0.0          /接口loop 0使能OSPF/

network 10.1.1.0 0.0.0.255       /接口e0/0使能OSPF/

network 20.1.1.0 0.0.0.3         /接口s0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

RouterB配置脚本

#

sysname RouterB

#

router id 1.1.1.2      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet1/0/0

ip address 30.1.1.1 255.255.255.0

#

interface Serial2/0/0

link-protocol ppp

ip address 20.1.1.2 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.2 255.255.255.255

#

ospf 1                      /启动ospf路由协议/

import-route direct         /引入接口直连路由/

area 0.0.0.0                /创建区域0/

network 1.1.1.2 0.0.0.0     /接口loop 0使能OSPF/

network 20.1.1.0 0.0.0.3    /接口s0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

 

【验证】

RouterA和RouterB可以通过OSPF学习到对方路由信息,并可以ping通对方网段。

RouterA路由表:

[RouterA]disp ip routing-table                                          

Routing Table: public net                                                     

Destination/Mask   Protocol Pre Cost        Nexthop         Interface         

1.1.1.1/32         DIRECT              127.0.0.1       InLoopBack0       

1.1.1.2/32         OSPF     10   1563        20.1.1.2        Serial0/0       

10.1.1.0/24        DIRECT              10.1.1.1        Ethernet0/0     

10.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.0/30        DIRECT              20.1.1.1        Serial0/0       

20.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.2/32        DIRECT              20.1.1.2        Serial0/0       

30.1.1.0/24      O_ASE   150 1         20.1.1.2       Serial0/0       

127.0.0.0/8        DIRECT              127.0.0.1       InLoopBack0       

127.0.0.1/32       DIRECT              127.0.0.1       InLoopBack0

 

【提示】

1、 建议将router id 指定和loopback 0接口地址一致。

2、 network中需要使用反掩码(wildcard bits)。

3、 第一种和第二种方法的区别在于:以太网接口地址的通告方法不同。

方法一在以太网上运行OSPF来通告路由,方法二通过引入直连接口的方式来通过路由。

4、关于ospf network-type的配置原则

Quidway路由器的网络类型缺省如下

 

OSPF网络类型
链路层协议

p2p
PPP、loopback

NBMA
fr,x25,HDLC

p2mp


broadcast
Ethernet

5、互连的路由器网络类型必须一致。

6、对于接口类型为NBMA的网络,由于无法通过广播Hello报文的形式发现相邻路由器,必须手工为其指定相邻路由器的IP地址:

[Quidway-ospf-1]peer 20.1.1.2

 

 

6.3.2    复杂些的多域OSPF配置
【需求】

在一个OSPF自治系统中ABR的配置情况。B为ABR,区域0为骨干区域,区域1为普通区域。

【组网图】

 

 

【配置脚本】

RouterA配置脚本

#

sysname RouterA

#

router id 1.1.1.1      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet0/0

ip address 10.1.1.1 255.255.255.0

#

interface Serial0/0

link-protocol ppp

ip address 20.1.1.1 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

#

ospf 1                           /启动ospf路由协议/

area 0.0.0.0                     /创建区域0/

network 1.1.1.1 0.0.0.0          /接口loop 0使能OSPF/

network 10.1.1.0 0.0.0.255       /接口e0/0使能OSPF/

network 20.1.1.0 0.0.0.3         /接口s0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

RouterB配置脚本

#

sysname RouterB

#

router id 1.1.1.2             /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Seria0/0

link-protocol ppp

ip address 20.1.1.2 255.255.255.252

#

interface Serial0/1

link-protocol ppp

ip address 30.1.1.1 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.2 255.255.255.255

#

ospf 1                           /启动ospf路由协议/

area 0.0.0.1                     /创建区域1/

network 30.1.1.0 0.0.0.3         /接口s0/1使能OSPF/

#

area 0.0.0.0                     /创建区域0/

network 1.1.1.2 0.0.0.0          /接口loop 0使能OSPF/

network 20.1.1.0 0.0.0.3         /接口s0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

RouterC配置脚本

#

sysname RouterC

#

router id 1.1.1.3      /配置router id和loopback0地址一致/

#

radius scheme system

#

domain system

#

interface Ethernet0/0

ip address 40.1.1.1 255.255.255.0

#

interface Serial0/0

link-protocol ppp

ip address 30.1.1.2 255.255.255.252

#

interface NULL0

#

interface LoopBack0

ip address 1.1.1.3 255.255.255.255

#

ospf 1                           /启动ospf路由协议/

area 0.0.0.1                     /创建区域1/

network 1.1.1.3 0.0.0.0          /接口loop 0使能OSPF/

network 30.1.1.0 0.0.0.3         /接口s0/0使能OSPF/

network 40.1.1.0 0.0.0.255       /接口e0/0使能OSPF/

#

user-interface con 0

user-interface vty 0 4

#

return

 

【验证】

各路由器可以通过OSPF学习到全网的路由信息,并可以ping通对方网段。

RouterA路由表:

[RouterA]disp ip routing-table                                          

Routing Table: public net                                                     

Destination/Mask   Protocol Pre Cost        Nexthop         Interface         

1.1.1.1/32         DIRECT              127.0.0.1       InLoopBack0       

1.1.1.2/32         OSPF     10   1563        20.1.1.2        Serial0/0       

1.1.1.3/32         OSPF     10   3125        20.1.1.2        Serial0/0       

10.1.1.0/24        DIRECT              10.1.1.1        Ethernet0/0     

10.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.0/30        DIRECT              20.1.1.1        Serial0/0       

20.1.1.1/32        DIRECT              127.0.0.1       InLoopBack0       

20.1.1.2/32        DIRECT              20.1.1.2        Serial0/0       

30.1.1.0/30        OSPF     10   3124        20.1.1.2        Serial0/0       

40.1.1.0/24        OSPF     10   3125        20.1.1.2        Serial0/0       

127.0.0.0/8        DIRECT              127.0.0.1       InLoopBack0       

127.0.0.1/32       DIRECT              127.0.0.1       InLoopBack0       

    

【提示】

只给出只包含骨干区域和一个普通区域的配置,包含更多区域的配置与此类似。

posted @ 2011-04-16 13:12  为极客而生  阅读(1169)  评论(0编辑  收藏  举报