OSPF  在企业网中的应用

 ospfOpen Shortest Path First(开放昀短路由优先协议)的缩写。它是 IETF组织开发的一个基于链路状态的自治系统内部路由协议。现在普遍使用的是版本 2RFC1583),ospf有以下主要特性:

1.     适应范围:支持各种规模的网络,昀多可支持几千台路由器。

2.     快速收敛:在网络的拓扑结构发生变化后立即发送更新报文,使这一变化在自治系统中同步。

3.      无自环: OSPF根据收集到的链路状态用昀短路径树算法计算路由,从算法上本身保证了不会生成自环路由。

4.     区域划分:允许自治系统的网络被划分成区域来管理,区域间传送的路由信息被进一步抽象,从而减少了占用的网络带宽。。

5.     OSPF路由协议支持路由验证,只有互相通过路由验证的路由器之间才能交换路由信息,提高网络的安全性,

6.     OSPF路由协议对负载分担的支持性能较好。     

7.     以组播地址发送报文,动态路由协议为了能够自动找到网络中的邻居,通常都是以广播的地址来发送。RIP使用广播报文来发送给网络上所有的设备,所以在网络上的所有设备受到此报文后都需要做相应的处理,但是在实际应用中,并不是所有的设备都需要接受这种报文。因此,这种周期性以广播形式发送报文的形式对它就产生了一定的干扰。同时,由于这种报文会定期的发送,在一定程度上也占用了宝贵的带宽资源。后来,随着各种技术的不断提升和发展,出现了以组播地址来发送协议报文的形式。比如: OSPF使用224.0.0.5来发送,EIGRP使用224.0.0.2来发送。所以,OSPF采用组播地址来发送,只有运行OSPF协议的设备才会接受发送来的报文,其他设备不参与接收。

由于ospf有以上特性,因此,被应用于绝大多数企业网络中。下面我们通过一个案例,来了解ospf在企业网络中的应用。     

案例

 

 

R1 : 运行截图、  配置

 



 

[R1]dis cu

  Now create configuration...

  Current configuration

  !

    version 1.74

    local-user user1 service-type administrator password simple 123

    sysname R1

    firewall enable

    aaa-enable

    aaa accounting-scheme optional

  !

  interface Aux0

    async mode flow

    link-protocol ppp

  !

  interface Ethernet0

    loopback

    ip address 192.168.1.1 255.255.255.0

    ospf enable area 0.0.0.1

  !

  interface Serial0

    link-protocol ppp

    ip address 192.168.2.1 255.255.255.0

    ospf enable area 0.0.0.1

  !                                      

  interface Serial1

    link-protocol ppp

  !

  interface LoopBack1

    ip address 192.168.8.1 255.255.255.0

  !

  quit

  rip

    network 192.168.8.0

    network 192.168.7.0

  !

  quit

  !

  ospf enable

  !

  quit

  !

  return

 R2  :  运行截图、  配置

 


[r2]dis cu

  Now create configuration...

  Current configuration

  !

    version 1.74

    local-user user1 service-type administrator password simple 123

    sysname r2

    undo pos-server addr-switch

    firewall enable

    aaa-enable

    aaa accounting-scheme optional

  !

  interface Aux0

    async mode flow

    link-protocol ppp

  !

  interface Ethernet0

    ip address 192.168.6.1 255.255.255.0

  !

  interface Ethernet1

  !

  interface Serial0

    clock DTECLK1

    link-protocol ppp

    ip address 192.168.2.2 255.255.255.0 

    ospf enable area 0.0.0.1

  !

  interface Serial1

    clock DTECLK1

    link-protocol ppp

    ip address 192.168.3.1 255.255.255.0

    ospf enable area 0.0.0.0

  !

  interface Async0

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async1

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async2

    physical-mode async

    async mode protocol

    link-protocol ppp

  !                                      

  interface Async3

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async4

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async5

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async6

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async7

    physical-mode async

    async mode protocol                  

    link-protocol ppp

  !

  interface LoopBack1

    ip address 192.168.5.1 255.255.255.0

  !

  interface Null0

  !

  quit

  rip

    network 192.168.6.0

    import-route static cost 1

  !

  quit

  !

  ospf enable

    import-route direct

    import-route rip

  !

  quit

  !

  quit

  ip route-static 0.0.0.0 0.0.0.0 Null 0 preference 60

  !

  return

 

R3  运行截图、  配置

 

 

int s 1

ip add 192.168.3.2 24

shutdown

undo shutdown

quit

 

int s 0

ip add 192.168.4.1 24

shutdown

undo shutdown

quit

 

ospf enable

quit

 

int s 1

ospf enable area 0

quit

 

int s 0

ospf enable area 2

quit

 

ospf

stub cost 100 area 2 no-summary

quit

 

 

R10 运行截图、  配置

 


int s 1

ip add 192.168.4.2 24

shutdown

undo shutdown

quit

 

int eth 0

ip add 192.168.5.1 24

loopback

quit

 

ospf enable

quit

 

int s 1

ospf enable area 2

quit

 

int eth 0

ospf enable area 2

quit

 

ospf

stub cos 100 area 2

quit

 

R5 运行截图、  配置


dis cu

  Now create configuration...

  Current configuration

  !

    version 1.74

    local-user user1 service-type administrator password simple 123

    sysname R5

    undo pos-server addr-switch

    firewall enable

    aaa-enable

    aaa accounting-scheme optional

  !

  controller e1 0

  !

  interface Aux0

    async mode flow

    link-protocol ppp

  !

  interface Ethernet0

    ip address 192.168.6.2 255.255.255.0

  !

  interface Ethernet1

    ip address 192.168.7.1 255.255.255.0

  !

  interface Serial0

    link-protocol ppp                    

    ip address 192.168.3.1 255.255.255.0

    shutdown

  !

  interface Serial1

    link-protocol ppp

  !

  quit

  rip

    network 192.168.7.0

    network 192.168.6.0

  !

  quit

  !

  return

R6 : 运行截图、  配置


]dis cu

  Now create configuration...

  Current configuration

  !

    version 1.74

    sysname R6

    firewall enable

    aaa-enable

    aaa accounting-scheme optional

  !

  interface Aux0

    async mode flow

    link-protocol ppp

  !

  interface Ethernet0

    ip address 192.168.7.2 255.255.255.0

  !

  interface Ethernet1

    ip address 192.168.5.2 255.255.255.0

  !

  interface Serial0

    link-protocol ppp

    ip address 192.168.6.1 255.255.255.0

  !

  interface Serial1

    link-protocol ppp                    

  !

  interface Async0

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async1

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async2

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async3

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async4

    physical-mode async                  

    async mode protocol

    link-protocol ppp

  !

  interface Async5

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async6

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async7

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async8

    physical-mode async

    async mode protocol

    link-protocol ppp

  !                                       

  interface Async9

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async10

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async11

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async12

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async13

    physical-mode async

    async mode protocol                  

    link-protocol ppp

  !

  interface Async14

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  interface Async15

    physical-mode async

    async mode protocol

    link-protocol ppp

  !

  quit

  rip

    network 192.168.7.0

    network 192.168.5.0

    network 192.168.6.0

  !

  quit

  !

  return

 

原创、请勿转载!!!