企业网络架构:ospf

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了企业网络架构:ospf相关的知识,希望对你有一定的参考价值。

技术分享图片

属于同一个区域的路由器他们的ospf数据库是完全一致的



[R1]int g 0/0/0                                                    进入0口

[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 255.255.255.0          配置IP

Jan 17 2018 11:27:26-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.                                                          这个ip协议应用到0口

[R1-GigabitEthernet0/0/0]un sh                                     激活端口

Info: Interface GigabitEthernet0/0/0 is not shutdown.              信息:开启0口

[R1-GigabitEthernet0/0/0]quit                                      退出

[R1]int LoopBack 0                                                 进入虚拟回环测试口

[R1-LoopBack0]ip add 10.10.1.1 255.255.255.0                       配置ip

[R1-LoopBack0]quit                                                 退出

[R1]ospf 1 router-id 1.1.1.1                                       创建第一个ospf 路由ID 1.1.1.1 

Info: The configuration succeeded. You need to restart the OSPF process to validate the new router ID.

信息:这个配置成功,你需要重启ospf进程

[R1-ospf-1]area 0                                                  进入区域0

[R1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0                指定ip

[R1-ospf-1-area-0.0.0.0]network 10.10.1.1 0.0.0.0                  制定IP

[R1-ospf-1-area-0.0.0.0]quit                                       退出

<R1>reset ospf process                                             重新启用ospf进程

Warning: The OSPF process will be reset. Continue? [Y/N]:y         注意:ospf 将要重启。配置吗?y

<R1>ping 10.10.4.4

  PING 10.10.4.4: 56  data bytes, press CTRL_C to break

    Reply from 10.10.4.4: bytes=56 Sequence=1 ttl=253 time=40 ms

    Reply from 10.10.4.4: bytes=56 Sequence=2 ttl=253 time=40 ms

    Reply from 10.10.4.4: bytes=56 Sequence=3 ttl=253 time=40 ms

    Reply from 10.10.4.4: bytes=56 Sequence=4 ttl=253 time=50 ms

    Reply from 10.10.4.4: bytes=56 Sequence=5 ttl=253 time=40 ms


  --- 10.10.4.4 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 40/42/50 ms

============================================================================================================


[R2]int g 0/0/0

[R2-GigabitEthernet0/0/0]ip add 192.168.1.2 255.255.255.0

Jan 17 2018 11:28:04-08:00 R2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 

[R2-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R2-GigabitEthernet0/0/0]quit

[R2]int LoopBack 0 

[R2-LoopBack0]ip add 10.10.2.2 255.255.255.0

[R2-LoopBack0]quit

[R2]ospf 1 router-id 2.2.2.2  

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]ne    

[R2-ospf-1-area-0.0.0.0]network 192.168.1.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0]network 10.10.2.2 0.0.0.0

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

[R2]int g 0/0/2 

[R2-GigabitEthernet0/0/2]ip add 192.168.100.1 255.255.255.0

Jan 17 2018 11:32:18-08:00 R2 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. 

[R2-GigabitEthernet0/0/2]un sh

Info: Interface GigabitEthernet0/0/2 is not shutdown.

[R2-GigabitEthernet0/0/2]quit

[R2]ospf 1

[R2-ospf-1]area 34

[R2-ospf-1-area-0.0.0.34]network 192.168.100.1 0.0.0.0

[R2-ospf-1-area-0.0.0.34]quit

[R2-ospf-1]quit


==================================================================================================================================


[R3]int g 0/0/2

[R3-GigabitEthernet0/0/2]ip add 192.168.100.2 255.255.255.0

Jan 17 2018 11:34:28-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. 

[R3-GigabitEthernet0/0/2]un sh

Info: Interface GigabitEthernet0/0/2 is not shutdown.

[R3-GigabitEthernet0/0/2]quit

[R3]int LoopBack 0

[R3-LoopBack0]ip add 10.10.3.3 255.255.255.0

[R3-LoopBack0]quit

[R3]ospf router-id 3.3.3.3

Info: The configuration succeeded. You need to restart the OSPF process to validate the new router ID.

[R3-ospf-1]area 34

[R3-ospf-1-area-0.0.0.34]network 192.168.100.2 0.0.0.0

[R3-ospf-1-area-0.0.0.34]network 10.10.3.3 0.0.0.0

[R3-ospf-1-area-0.0.0.34]network 192.168.200.1 0.0.0.0

[R3-ospf-1-area-0.0.0.34]quit

[R3-ospf-1]quit

[R3]int g 0/0/0

[R3-GigabitEthernet0/0/0]ip add 192.168.200.1 255.255.255.0

Jan 17 2018 11:37:04-08:00 R3 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 

[R3-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R3-GigabitEthernet0/0/0]quit


=============================================================================================


[R4]int g 0/0/0

[R4-GigabitEthernet0/0/0]ip add 192.168.200.2 255.255.255.0

Jan 17 2018 11:37:30-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 

[R4-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[R4-GigabitEthernet0/0/0]quit

[R4]int LoopBack 0

[R4-LoopBack0]ip add 10.10.4.4 255.255.255.0

[R4-LoopBack0]quit

[R4]ospf 1 router-id 4.4.4.4

[R4-ospf-1]area 34

[R4-ospf-1-area-0.0.0.34]network 192.168.200.2 0.0.0.0                   

[R4-ospf-1-area-0.0.0.34]network 10.10.4.4 0.0.0.0


==============================================================================================

连接完成

<R1>ping 192.168.200.2

  PING 192.168.200.2: 56  data bytes, press CTRL_C to break

    Reply from 192.168.200.2: bytes=56 Sequence=1 ttl=253 time=50 ms

    Reply from 192.168.200.2: bytes=56 Sequence=2 ttl=253 time=20 ms

    Reply from 192.168.200.2: bytes=56 Sequence=3 ttl=253 time=30 ms

    Reply from 192.168.200.2: bytes=56 Sequence=4 ttl=253 time=40 ms

    Reply from 192.168.200.2: bytes=56 Sequence=5 ttl=253 time=40 ms


  --- 192.168.200.2 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 20/36/50 ms



===================================================================================

一、OSPF建立邻居:

   display ospf peer brief

二、验证了邻居表和路由表

   display ospf peer brief

   display ip routing-table

三、查看和更改loopback 0 的网络类型:

   display ospf interface loopback 0

四、查看OSPF 路由的细分类型

   display ospf routing

五、验证ASE类型的路由-引出类“路由宣告”方式:network/import-route

六、在R4上配置静态路由,然后import-route,在其他路由上查看

   R4:

     ip rout-static 100.1.1.0 255.255.255.0 null 0

     ospf 1 

         import-route重分发 static

   R3:

     display ip routing-table

     display ospf routing


以上是关于企业网络架构:ospf的主要内容,如果未能解决你的问题,请参考以下文章

大型企业网络构建——OSPF路由原理详解

企业网络入门-抓包ospf数据包

中小型企业网络构建 OSPF 多区域配置

精通企业网络当中网红协议OSPF协议

精通企业网络当中网红协议OSPF协议---进阶篇

中型企业网络构建——OSPF区域划分(特殊域)