ospf在企业网中的应用

ospf原理

——OSPF路由协议是一种典型的链路状态(Link-state)的路由协议,一般用于同一个路由域内。在这里,路由域是指一个自治系统(Autonomous System),即AS,它是指一组通过统一的路由政策或路由协议互相交换路由信息的网络。在这个AS中,所有的OSPF路由器都维护一个相同的描述这个AS结构的数据库,该数据库中存放的是路由域中相应链路的状态信息,OSPF路由器正是通过这个数据库计算出其OSPF路由表的。

——作为一种链路状态的路由协议,OSPF将链路状态广播数据包LSA(Link State Advertisement)传送给在某一区域内的所有路由器,这一点与距离矢量路由协议不同。运行距离矢量路由协议的路由器是将部分或全部的路由表传递给与其相邻的路由器。

案例1

多区域配置

一、 实验拓扑

image

二、 实验要求

配置表

Router-A     

S1/1(DCE)

192.168.1.1

F0/0

192.168.0.1

Router-B     

S/1/0(DTE)

192.168.1.2

F0/0

192.168.2.1

Router-C

F0/0

192.168.2.2

E1/0

192.168.3.1

路由器B为ABR

三、 实验步骤

 

第一步:路由器A的配置

Router-A#conf

Router-A_config#router ospf 100

Router-A_config_ospf_100#network 192.168.0.0 255.255.255.0 area 1

Router-A_config_ospf_100#network 192.168.1.0 255.255.255.0 area 1

Router-A_config_ospf_100#^Z

第二步:路由器B的配置

Router-B#conf

Router-B_config#router ospf 100

Router-B_config_ospf_100#network 192.168.1.0 255.255.255.0 area 1 

Router-B_config_ospf_100#network 192.168.2.0 255.255.255.0 area 0

Router-B_config_ospf_100#^Z

第三步:路由器C的配置

Router-C#conf

Router-C_config#router ospf 100

Router-C_config_ospf_100#network 192.168.2.0 255.255.255.0 area 0

Router-C_config_ospf_100#network 192.168.3.0 255.255.255.0 area 0

Router-C_config_ospf_100#^Z

第四步:查看路由表

Router-A#sh ip route

Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected

       D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area

       ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2

       OE1 - OSPF external type 1, OE2 - OSPF external type 2

       DHCP - DHCP type

VRF ID: 0

C      192.168.0.0/24       is directly connected, FastEthernet0/0

C      192.168.1.0/24       is directly connected, Serial1/1

O IA   192.168.2.0/24       [110,1601] via 192.168.1.2(on Serial1/1)

O IA   192.168.3.0/24       [110,1611] via 192.168.1.2(on Serial1/1)

Router-B#sh ip route

Codes: C - connected, S - static, R - RIP, B - BGP, BC - BGP connected

       D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area

       ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2

       OE1 - OSPF external type 1, OE2 - OSPF external type 2

       DHCP - DHCP type

VRF ID: 0

O      192.168.0.0/24       [110,1601] via 192.168.1.1(on Serial1/0)

C      192.168.1.0/24       is directly connected, Serial1/0

C      192.168.2.0/24       is directly connected, FastEthernet0/0

O      192.168.3.0/24       [110,11] via 192.168.2.2(on FastEthernet0/0)

Router-C#sh ip route

Codes: C - connected, S - static, R - RIP, B - BGP

       D - DEIGRP, DEX - external DEIGRP, O - OSPF, OIA - OSPF inter area

       ON1 - OSPF NSSA external type 1, ON2 - OSPF NSSA external type 2

       OE1 - OSPF external type 1, OE2 - OSPF external type 2

O IA 192.168.0.0/24     [110,1602] via 192.168.2.1(on  FastEthernet0/0)

O IA 192.168.1.1/32     [110,1601] via 192.168.2.1(on  FastEthernet0/0)

O IA 192.168.1.2/32     [110,3201] via 192.168.2.1(on  FastEthernet0/0)

C    192.168.2.0/24     is directly connected,  FastEthernet0/0

C    192.168.3.0/24     is directly connected,  Ethernet1/0

 

 

案例2

 

 

  如果:配置ospf多区域。F1和F2配置rip,其他路由器配置ospf。采用路由引入实现全网互通。然后再在area2区域配置末节网络和完全末节网络,观察路由表项。

二:实验拓扑:

wps_clip_image-6137

三:配置

R2

[R2]int s 0

[R2-Serial0]ip add 192.168.2.2 24

[R2-Serial0]int s1

[R2-Serial1]ip add 192.168.3.1 24

[R2-Serial1]int e 0

[R2-Ethernet0]ip add 192.168.6.1 24

[R2-Ethernet0]qu

[R2]ospf en

  Start OSPF task...

  OSPF enabled

[R2-ospf]qu

[R2]int ser 0

[R2-Serial0]shut

[R2-Serial0]un shut

[R2-Serial0]ospf en area 1

[R2-Serial0]int ser 1

[R2-Serial1]ospf en area 0

[R2-Serial1]qu

[R2]rip

    waiting...

  RIP is running

[R2-rip]netwo 192.168.6.0

[R2]ospf

[R2-rip]import ospf cost 2

[R2-ospf]import direct

[R2-ospf]qu           

[R2]rip

[R2-rip]import direct cost 2

wps_clip_image-4536

R3

[R3]int s1

[R3-Serial1]ip add 192.168.3.2 24

[R3-Serial1]shut

[R3-Serial1]un shut

[R3-Ethernet0]ip add 192.168.4.1 24

[R3-Ethernet0]qu

[R3]ospf en

  Start OSPF task...

  OSPF enabled

[R3]int ser 1

[R3-Serial1]ospf en area 0

[R3-Serial1]int e 0

[R3-Ethernet0]ospf en area 2

[R3-Ethernet0]qu

[R3]ospf

[R3-ospf]stub cost 100 area 2

[R3-ospf]undo stub cost 100 area 2

[R3-ospf] stub cost 100 area 2 no-summary

wps_clip_image-19724

S12

[s12]vlan 10

[s12-vlan10]port e 0/24

[s12]int vlan 10

[s12-Vlan-interface10]ip add 192.168.4.2 255.255.255.0

[s12-Vlan-interface10]int loo 1

[s12-LoopBack1]ip add 192.168.5.1 255.255.255.0

[s12-LoopBack1]qu

[s12]ospf

[s12-ospf]area 2

[s12-ospf-area-0.0.0.2]net 192.168.4.0 0.0.0.255

[s12-ospf-area-0.0.0.2]net 192.168.5.0 0.0.0.255

[s12-ospf-area-0.0.0.2]qu

[s12]ospf

[s12-ospf]area 2

[s12-ospf-area-0.0.0.2]stub

wps_clip_image-2890

R1

[R1]int e 0

[R1-Ethernet0]ip add 192.168.1.1 24

[R1-Ethernet0]loop

[R1-Ethernet0]qu

[R1-Serial0]int e0

[R1-Ethernet0]ip add 192.168.1.1 24

[R1-Ethernet0]loop

[R1-Ethernet0]int ser 0

[R1-Serial0]ip add 192.168.2.1 24

[R1-Serial0]qu

[R1]ospf enab

  Start OSPF task...

  OSPF enabled

[R1]int e 0

[R1-Ethernet0]ospf en area 1

[R1-Ethernet0]qu            

[R1]int s 0

[R1-Serial0]ospf en area 1

[R1-Serial0]qu

wps_clip_image-528

F1

[F1]fire zone trust

[F1-zone-trust]add int eth 0/1

[F1-zone-trust]qu

[F1]int eth 0/1

[F1-Ethernet0/1]ip add 192.168.7.1 24

[F1-Ethernet0/1]int  eth 0/0

[F1-Ethernet0/0]ip add 192.168.6.2 24

[F1-Ethernet0/0]qu

[F1]rip

[F1-rip]network 192.168.6.0

[F1-rip]network 192.168.7.0

wps_clip_image-17070

[fw-2]

[fw-2]int  et0/0

[fw-2-Ethernet0/0]ip add 192.168.7.2 24

[fw-2-Ethernet0/0]int eth 0/1                                

[fw-2-Ethernet0/1]ip add 192.168.8.1 24

[fw-2-Ethernet0/1]loop

[fw-2-Ethernet0/1]qu

[fw-2]firew zone trust

[fw-2-zone-trust]add int eth 0/1

[fw-2-zone-trust]qu    

[fw-2]rip

[fw-2-rip]net 192.168.7.0

[fw-2-rip]net 192.168.8.0

[fw-2-rip]qu

wps_clip_image-9648

末节域

wps_clip_image-4869

完全末节区域

wps_clip_image-14631

你可能感兴趣的:(路由表,数据包,的)