华为OSPF基本功能配置示例
首页 > HuaWei > 路由配置   作者:浙江思唯网络  2016年2月18日 17:13 星期四  字号:   评论:0 条
时间:2016-2-18 17:13   评论:0 条 

华为OSPF基本功能配置示例

1、组网需求

     OSPF基本功能组网示例图.png

    1 OSPF基本功能组网示例图

    如上图1所示,网络中有三台交换机。现在需要采用OSPF实现三台交换机之间能够互通,且以后能依据SwitchASwitchB为主要的业务设备来继续扩展整个网络。

 

2、配置思路

2.1、在各交换机的VLANIF接口上配置IP地址并配置各接口所属VLAN,实现网段内的互通。

2.2、在各交换机上配置OSPF基本功能,并且以SwitchAABROSPF网络划分为Area0Area1两个区域,实现后续以SwitchASwitchB所在区域为骨干区域来扩展整个OSPF网络。

 

3、操作步骤

3.1、配置各接口所属的VLAN

# 配置SwitchASwitchBSwitchC的配置与SwitchA类似。

<HUAWEI> system-view

[HUAWEI] sysname SwitchA

[SwitchA] vlan batch 10 20

[SwitchA] interface gigabitethernet 1/0/1

[SwitchA-GigabitEthernet1/0/1] port link-type trunk

[SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10

[SwitchA-GigabitEthernet1/0/1] quit

[SwitchA] interface gigabitethernet 1/0/2

[SwitchA-GigabitEthernet1/0/2] port link-type trunk

[SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 20

[SwitchA-GigabitEthernet1/0/2] quit

 

3.2、配置各VLANIF接口的IP地址

# 配置SwitchASwitchBSwitchC的配置与SwitchA类似。

[SwitchA] interface vlanif 10

[SwitchA-Vlanif10] ip address 192.168.0.1 24

[SwitchA-Vlanif10] quit

[SwitchA] interface vlanif 20

[SwitchA-Vlanif20] ip address 192.168.1.1 24

[SwitchA-Vlanif20] quit

 

3.3、配置OSPF基本功能

# 配置SwitchA

[SwitchA] ospf 1 router-id 10.1.1.1

[SwitchA-ospf-1] area 0

[SwitchA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

[SwitchA-ospf-1-area-0.0.0.0] quit

[SwitchA-ospf-1] area 1

[SwitchA-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255

[SwitchA-ospf-1-area-0.0.0.1] return

 

# 配置SwitchB

[SwitchB] ospf 1 router-id 10.2.2.2

[SwitchB-ospf-1] area 0

[SwitchB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

[SwitchB-ospf-1-area-0.0.0.0] return

 

# 配置SwitchC

[SwitchC] ospf 1 router-id 10.3.3.3

[SwitchC-ospf-1] area 1

[SwitchC-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255

[SwitchC-ospf-1-area-0.0.0.1] return

 

4、验证配置结果

# 查看SwitchAOSPF邻居。

<SwitchA> display ospf peer

 

          OSPF Process 1 with Router ID 10.1.1.1

                  Neighbors

 

 Area 0.0.0.0 interface 192.168.0.1(Vlanif10)'s neighbors

Router ID: 10.2.2.2      Address: 192.168.0.2

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 192.168.0.2  BDR: 192.168.0.1   MTU: 0

   Dead timer due in 36  sec

   Retrans timer interval: 5

   Neighbor is up for 00:15:04

   Authentication Sequence: [ 0 ]

 

                  Neighbors

 

 Area 0.0.0.1 interface 192.168.1.1(Vlanif20)'s neighbors

Router ID: 10.3.3.3       Address: 192.168.1.2

   State: Full  Mode:Nbr is  Master  Priority: 1

   DR: 192.168.1.2  BDR: 192.168.1.1   MTU: 0

   Dead timer due in 39  sec

   Retrans timer interval: 5

   Neighbor is up for 00:07:32

   Authentication Sequence: [ 0 ]

 

# 查看SwitchCOSPF路由信息。

<SwitchC> display ospf routing

 

          OSPF Process 1 with Router ID 10.3.3.3

                   Routing Tables

 

 Routing for Network

 Destination      Cost  Type         NextHop         AdvRouter       Area

 192.168.1.0/24    1    Transit      192.168.1.2     10.3.3.3        0.0.0.1

 192.168.0.0/24    2    Inter-area   192.168.1.1     10.1.1.1        0.0.0.1

 

 Total Nets: 2

 Intra Area: 1  Inter Area: 1  ASE: 0  NSSA: 0

    由以上回显可以看出,SwitchC有到192.168.0.0/24网段的路由,且此路由被标识为区域间路由。

 

# 查看SwitchB的路由表,并使用Ping测试SwitchBSwitchC的连通性。

<SwitchB> display ospf routing

 

          OSPF Process 1 with Router ID 10.2.2.2

                   Routing Tables

 

 Routing for Network

 Destination        Cost  Type       NextHop      AdvRouter       Area

 192.168.0.0/24     1     Transit    192.168.0.2  10.2.2.2        0.0.0.0

 192.168.1.0/24     2     Inter-area 192.168.0.1  10.1.1.1        0.0.0.0

 

 Total Nets: 2

 Intra Area: 1  Inter Area: 1  ASE: 0  NSSA: 0

    由以上回显可以看出,SwitchB有到192.168.1.0/24网段的路由,且此路由被标识为区域间路由。

 

# SwitchB上使用Ping测试SwitchBSwitchC之间的连通性。

<SwitchB> ping 192.168.1.2

  PING 192.168.1.2: 56  data bytes, press CTRL_C to break

    Reply from 192.168.1.2: bytes=56 Sequence=1 ttl=253 time=62 ms

    Reply from 192.168.1.2: bytes=56 Sequence=2 ttl=253 time=16 ms

    Reply from 192.168.1.2: bytes=56 Sequence=3 ttl=253 time=62 ms

    Reply from 192.168.1.2: bytes=56 Sequence=4 ttl=253 time=94 ms

    Reply from 192.168.1.2: bytes=56 Sequence=5 ttl=253 time=63 ms

 

  --- 192.168.1.2 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 16/59/94 ms

 

5、配置文件

5.1SwitchA的配置文件

#

sysname SwitchA

#

vlan batch 10 20

#

interface Vlanif10

 ip address 192.168.0.1 255.255.255.0

#

interface Vlanif20

 ip address 192.168.1.1 255.255.255.0

#

interface GigabitEthernet1/0/1

 port link-type trunk

 port trunk allow-pass vlan 10

#

interface GigabitEthernet1/0/2

 port link-type trunk

 port trunk allow-pass vlan 20

#

ospf 1 router-id 10.1.1.1

 area 0.0.0.0

  network 192.168.0.0 0.0.0.255

 area 0.0.0.1

  network 192.168.1.0 0.0.0.255

#

return

 

5.2SwitchB的配置文件

#

sysname SwitchB

#

vlan batch 10

#

interface Vlanif10

 ip address 192.168.0.2 255.255.255.0

#

interface GigabitEthernet1/0/1

 port link-type trunk

 port trunk allow-pass vlan 10

#

ospf 1 router-id 10.2.2.2

 area 0.0.0.0

  network 192.168.0.0 0.0.0.255

#

return

 

5.3SwitchC的配置文件

#

sysname SwitchC

#

vlan batch 20

#

interface Vlanif20

 ip address 192.168.1.2 255.255.255.0

#

interface GigabitEthernet1/0/1

 port link-type trunk

 port trunk allow-pass vlan 20

#

ospf 1 router-id 10.3.3.3

 area 0.0.0.1

  network 192.168.1.0 0.0.0.255

#

return

 您阅读这篇文章共花了: 
二维码加载中...
技术交流:欢迎在本文下方留言或加入QQ群:859273036 互相学习。     
本文地址:http://www.023wg.com/lypz/180.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

返回顶部    首页   
版权所有:Swiers思唯网络博客    浙江思唯网络