IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    简单聊 OSPF

    Teacher Du发表于 2024-11-01 03:51:26
    love 0

    之前我们学习了 RIP 动态路由协议。针对多个区域,RIP 因跳数限制无法满足使用需求,这时我们需要思科另外一种动态路由技术,叫 OSPF,今天杜老师就来简单聊一下。

    实验拓扑

    实验拓扑如图:

    实验方案

    在上面拓扑中不难看出,我们将几个路由分隔开,划成不同区域,为什么要这么做呢?

    我们知道,RIP 是通过宣告网段,让其它路由器通过学习,了解路由走向。而宣告出去的数据,会通过链路传递到网络中的各个设备,网络愈加庞大,要传播的数据也就越多,这样无疑加大了网络的耗损。

    这时我们可以通过 OSPF 来划分区域,让路由宣告的数据只在区域内部传递,这样就可以减少网络的耗损。

    下面我们通过一个实验,简单了解一下 OSPF 的配置流程。

    方案步骤

    • Router0 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Continue with configuration dialog? [yes/no]: no
    Router>enable
    Router#configure terminal
    Router(config)#interface fastEthernet 0/0
    Router(config-if)#ip address 192.168.1.1 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#interface fastEthernet 0/1
    Router(config-if)#ip address 192.168.2.1 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#router ospf 1111
    Router(config-router)#network 192.168.1.0 0.0.0.255 area 0
    Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
    • Router1 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Continue with configuration dialog? [yes/no]: no
    Router>enable
    Router#configure terminal
    Router(config)#interface fastEthernet 0/0
    Router(config-if)#ip address 192.168.2.2 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#interface fastEthernet 0/1
    Router(config-if)#ip address 192.168.3.1 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#router ospf 1111
    Router(config-router)#network 192.168.2.0 0.0.0.255 area 0
    Router(config-router)#network 192.168.3.0 0.0.0.255 area 1
    • Router2 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Continue with configuration dialog? [yes/no]: no
    Router>enable
    Router#configure terminal
    Router(config)#interface fastEthernet 0/0
    Router(config-if)#ip address 192.168.3.2 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#interface fastEthernet 0/1
    Router(config-if)#ip address 192.168.4.1 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#router ospf 1111
    Router(config-router)#network 192.168.3.0 0.0.0.255 area 1
    Router(config-router)#network 192.168.4.0 0.0.0.255 area 1
    • Router3 路由器:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Continue with configuration dialog? [yes/no]: no
    Router>enable
    Router#configure terminal
    Router(config)#interface fastEthernet 0/0
    Router(config-if)#ip address 192.168.4.2 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#interface fastEthernet 0/1
    Router(config-if)#ip address 192.168.5.1 255.255.255.0
    Router(config-if)#no shutdown
    Router(config-if)#exit
    Router(config)#router ospf 1111
    Router(config-router)#network 192.168.4.0 0.0.0.255 area 1
    Router(config-router)#network 192.168.5.0 0.0.0.255 area 1

    方案测试

    配置完成之后,我们测试一下:

    测试成功之后,我们查看下路由表信息:



沪ICP备19023445号-2号
友情链接