OSPF: open shortest path first protocol(a kind of interior gateway)use to distrubute routing information within a single autonomous system OSPF cost=带宽/100M(也可以强行设置 ip ospf cost) OSPF中area0作为 backbone routes that are generated from within an area( the destination belongs to the area) are called intra-area routes 这类路由在路由表中用O表示 routes that originate from other areas are called inter-area or summary routes 这类路由在路由表中用OIA表示 routes that originate from other routing protocols(or different ospf process )and that are inject into ospf via redistribution are called external routes 这类路由在路由表中用OE1或OE2表示 E1、E2( external typel& external type2)是计算cost的两种方法,E2只计算 ASBR与外部之间的cost,El还要加上ospf内部的cost),缺省为E2 1. Enable ospf on router router OSPF network (mask contain wild card bits where 0 is match and 1 is"don 't care"bit) 例: router 100 nework l92.213.0.00.0.255.255aea0.0.0.0 nework 128. 213. .10.0.0.0 area 23 2. OSPF Authentication Null authentication, simple password authentication message digest authentication(MD5) (1)Simple Authentication: ip ospf authentica tion-key (this go under the specif ic interface) router ospf ) 例 interface Ethernet 0 ip address0.10.10.10255.25255.0 ip ospf authentication-key mypassword router ospf 100 network 10.10.000.0.255 255 area 0 0 authentication (2)MD5 authentication: ip ospf message-digest-key md5 (use
⚫ OSPF : open shortest path first protocol(a kind of interior gateway) use to distrubute routing information within a single autonomous system ⚫ OSPF cost=带宽/100M (也可以强行设置 ip ospf cost ) ⚫ OSPF 中 area 0 作为 backbone ⚫ routes that are generated from within an area ( the destination belongs to the area) are called intra-area routes. 这类路由在路由表中用 O 表示 ⚫ routes that originate from other areas are called inter-area or summary routes. 这类路由在路由表中用 O IA 表示 ⚫ routes that originate from other routing protocols (or different ospf process ) and that are inject into ospf via redistribution are called external routes. 这类路由在路由表中用 O E1 或 O E2 表示 E1、E2(external type1&external type 2)是计算 cost 的两种方法,E2 只计算 ASBR 与外部之间的 cost,E1 还要加上 ospf 内部的 cost), 缺省为 E2 1. Enable OSPF on router router OSPF network (mask contain wild card bits where 0 is match and 1 is "don't care" bit) 例: router ospf 100 network 192.213.0.0 0.0.255.255 area 0.0.0.0 network 128.213.1.1 0.0.0.0 area 23 2. OSPF Authentication Null authentication 、 simple password authentication 、 message digest authentication(MD5) (1)Simple Authentication: ip ospf authentication-key (this go under the specific interface) area authentication (this go under "router ospf ) 例: interface Ethernet 0 ip address 10.10.10.10 255.255.255.0 ip ospf authentication-key mypassword router ospf 100 network 10.10.0.0 0.0.255.255 area 0 area 0 authentication (2)MD5 authentication: ip ospf message-digest-key md5 (use
under the interface) area authen tica tion message-digest(use under router ospf ) 例: interface ethernet 0 ip address0.10.10.10255.255.25.0 ip ospf message-digest-key 10 md5 mypassword router ospf 100 network 10.10.000.0.255 255 area 0 area 0 authentication message-digest 3. virtuallink (use for two purpose: a link an area that does not have a physical connection to the backbar b. patching the backbone in case discontinuity of area 0 occurs) area virtual-linkarea-id是作为传输的area号,即做 virtua link的两个area之间的area,RID是做 virtual link的两个路由器的id,一般是路由 器上最大的 ip address或最大的 loopback地址) 例 路由器RTA地址为1.1.1.1在area1中,路由器RIB地址为2222在 area0中 area0和 areal通过area2做 virtual link RTA# outer ospf 100 area 2 virtual-link 2.2.2.2 RTB# router ospf 100 area 2 virtual-link l.L. .I 4. Adjacencies ip ospf hello-interval ip ospf dead-interval ip ospf priority ( value值缺省为1,设为0则该路由器不为DR、BDR) sh ip ospf interface , sh ip ospf neighbor y2 ilE neighbor Priority l Ipoll-interval (E 前已较少使用) 5. NBMA (1) point to point subinterface 在物理口上开若干逻辑口实现点对点互连 例:
under the interface) area authentication message-digest (use under "router ospf ) 例: interface ethernet 0 ip address 10.10.10.10 255.255.255.0 ip ospf message-digest-key 10 md5 mypassword router ospf 100 network 10.10.0.0 0.0.255.255 area 0 area 0 authentication message-digest 3. virtual link (use for two purpose : a. link an area that does not have a physical connection to the backbone b. patching the backbone in case discontinuity of area 0 occurs) area virtual-link (area-id 是作为传输的 area 号,即做 virtual link 的两个 area 之间的 area, RID 是做 virtual link 的两个路由器的 id ,一般是路由 器上最大的 ip address 或最大的 loopback 地址) 例: 路由器 RTA 地址为 1.1.1.1 在 area 1 中, 路由器 RTB 地址为 2.2.2.2 在 area 0 中, area0 和 area1 通过 area 2 做 virtual link. RTA# router ospf 100 area 2 virtual-link 2.2.2.2 RTB# router ospf 100 area 2 virtual-link 1.1.1.1 4. Adjacencies: ip ospf hello-interval ip ospf dead-interval ip ospf priority (value 值缺省为 1,设为 0 则该路由器不为 DR、BDR) sh ip ospf interface , sh ip ospf neighbor 验证 neighbor [priority ] [poll-interval ] (目 前已较少使用) 5. NBMA: (1) point to point subinterface 在物理口上开若干逻辑口实现点对点互连 例:
RTA# interface serial 0 no ip addres. encapsulation frame-relay nterface serial0. I point-to-point ip address128.213.63.6255.25.252.0 frame-relay interface-dlci 20 erface seria10. 2 pe ip address I28.213.64625.255.252.0 frame-relay interface-dlci 30 router ospf10 netork l28.213.0.00.0.255.255 area l RTB# interface serial0 no ip address encapsulation frame-relay interface serial0. I point-to-point ip address128.213.63.5255.255.252.0 frame-relay interface-dlci 40 interface serial I p address I28.212..1255.255.255.0 ospf 10 netork l28.213.0.00.0.255.255 area l netork l28.212.0.00.0.255.255amea0 (2)Select interface network type ip ospf network broadcast non-broadcastpoint-to-multipointy RTa#. interface loopback 0 ip address200.200.10.1255.255.25.0 interface serial 0 ip addres128.213.10.1255.255.252.0 encapsulation frame-relay ip ospf netw ork point-to-multipoint
RTA#: interface serial 0 no ip address encapsulation frame-relay interface serial0.1 point-to-point ip address 128.213.63.6 255.255.252.0 frame-relay interface-dlci 20 iterface serial0.2 point-to-point ip address 128.213.64.6 255.255.252.0 frame-relay interface-dlci 30 router ospf 10 network 128.213.0.0 0.0.255.255 area 1 RTB#: interface serial 0 no ip address encapsulation frame-relay interface serial0.1 point-to-point ip address 128.213.63.5 255.255.252.0 frame-relay interface-dlci 40 interface serial 1 ip address 128.212.1.1 255.255.255.0 router ospf 10 network 128.213.0.0 0.0.255.255 area 1 network 128.212.0.0 0.0.255.255 area 0 (2) Select interface network type: ip ospf network {broadcast|non-broadcast|point-to-multipoint} 例: RTA#: interface loopback 0 ip address 200.200.10.1 255.255.255.0 interface serial 0 ip address 128.213.10.1 255.255.252.0 encapsulation frame-relay ip ospf network point-to-multipoint
router ospf 10 network I28.213.0.00.0.255.255 area l RTB# interface serial 0 p address I28.213.10.225.255.25.0 encapsulation frame-relay ip ospf network point-to-multipoint nterface serial I ip address I23.212.1.125.255.25.0 router ospf 10 network I28.213.0.00.0.255.255 area l network I23.212.0.00.0.255.255amea0 6. OSPF and route summarization (1)Inter-area route summarization(done on ABrs area range (2)External route summarization (effective only on ASBRs summary-address 例 RTa#. summan- address128.213.64.0255.255.224.0 redistribute bgp 50 metric 1000 subnets summar- address28.2l3.90.0255.255.2240 edistribute bgp 20 metric 1000 subnets 7. Stub area area stub no summary area defaul-cost metric-type l route-map subnets metric default is 20, except bgp is 1, metric-type default is 2) route-map [ deny llsequence-numberll 例:RTC作为ASBR,RTE为ospf内部路由器,两者通过 serial口互连,RTC 通过E0口连外部的16.16.160/24,12821300/16
router ospf 10 network 128.213.0.0 0.0.255.255 area 1 RTB#: interface serial 0 ip address 128.213.10.2 255.255.255.0 encapsulation frame-relay ip ospf network point-to-multipoint interface serial 1 ip address 123.212.1.1 255.255.255.0 router ospf 10 network 128.213.0.0 0.0.255.255 area 1 network 123.212.0.0 0.0.255.255 area 0 6. OSPF and route summarization (1) Inter-area route summarization (done on ABRs) area range (2) External route summarization (effective only on ASBRs) summary-address 例: RTA#: summary-address 128.213.64.0 255.255.224.0 redistribute bgp 50 metric 1000 subnets RTB#: summary-address 128.213.96.0 255.255.224.0 redistribute bgp 20 metric 1000 subnets 7. Stub Area area stub [no summary] area defaul-cost (cost default is 1) 8. Redistribute routes into OSPF redistribute [metric ] [metric-type ] [route-map ] [subnets] ( metric default is 20,except bgp is 1;metric-type default is 2) route-map [[permit]|[deny] |[sequence-number]] 例: RTC 作为 ASBR,RTE 为 ospf 内部路由器,两者通过 serial 口互连,RTC 通过 E0 口连外部的 16.16.16.0/24,128.213.0.0/16
RTC interface Ethernet 0 ip address203.250.l4.225.255.25.0 interface serial I ip address203.250.l5.1255.255.25.252 router ospf 10 redistribute static netork203.250.l5.00.0.0.255area2 network203.250.l4.00.0.0.255amea0 mull6.l6.160255.25.255.0 ethernet0 p route l28.213.0.025.255.0.0 ethernet0 RTE interface serial 0 ip address203.250.l5.2255.255.25.252 router ospf 10 network203.250.15.00.0.0.255amea2 当 sh ip route时,可看到只有128.213.00路由在表中。这是因为l6.l6.16.0 为一个A类地址,并被划为子网,当没有用 subnet参数时,不被 redistribute RTC配置若改为 redistribute static metric 50 metric-type I subnets oute-map STOPUPDATE access-list I permit 128. 213.0.00.0.255.255 route-map STOPUPDATE permit 10 match ip address I 这时只有1282130.0被 red istrubute into OSPF 9. distribute ospf into other protocols distribute-list in distribute-list out 10. injecting defaults into ospf default-information originate always [metric limetric-type [route-map 11. ospf design tips:
RTC: interface Ethernet 0 ip address 203.250.14.2 255.255.255.0 interface serial 1 ip address 203.250.15.1 255.255.255.252 router ospf 10 redistribute static network 203.250.15.0 0.0.0.255 area 2 network 203.250.14.0 0.0.0.255 area 0 ip route 16.16.16.0 255.255.255.0 ethernet0 ip route 128.213.0.0 255.255.0.0 ethernet0 RTE: interface serial 0 ip address 203.250.15.2 255.255.255.252 router ospf 10 network 203.250.15.0 0.0.0.255 area 2 当 sh ip route 时,可看到只有 128.213.0.0 路由在表中。这是因为 16.16.16.0 为一个 A 类地址,并被划为子网,当没有用 subnet 参数时,不被 redistribute. RTC 配置若改为: redistribute static metric 50 metric-type 1 subnets route-map STOPUPDATE access-list 1 permit 128.213.0.0 0.0.255.255 route-map STOPUPDATE permit 10 match ip address 1 这时只有 128.213.0.0 被 redistrubute into OSPF 9. distribute ospf into other protocols passive-interface distribute-list in distribute-list out 10. injecting defaults into ospf default-information originate [always] [metric ] [metric-type ] [route-map ] 11. ospf design tips :
(1)experience show that 40-50 routers per area is the upper bound for ospf (2) try to avoid have the same router to be dr on more than one segament ()it's better to have each ABR connect to two area only 12 SHOW FULL OSPF DATABASE sh ip ospf database router sh ip ospf database network sh ip ospf database summary sh ip ospf database asbr-summary sh ip ospf database external APPENDIX 1. ROUTER SUB COMMANDS network Area Area stub(no-summary Area authentication Area default cost Area virtual link Area range 2. INTERFACE SUBCOMMANDS ip ospf cost ip ospf priority ip ospf dead-interval ip ospf authentication-key ip ospf retransmit-interval router ospf 100 network200.2004.000.0.3area0 red istribute connected subnets 使其他路由器可以看到 loopback地址 ospf log-adjacency-changes 当相邻的路由器发生变化时可以在 本地路由器上看到相关信息 sh ip route sh ip ospf sh ip ospf interface sh ip ospf neighbor sh ip ospf database
(1) experience show that 40-50 routers per area is the upper bound for ospf (2) try to avoid have the same router to be DR on more than one segament (3) it's better to have each ABR connect to two area only 12 SHOW FULL OSPF DATABASE sh ip ospf database router sh ip ospf database network sh ip ospf database summary sh ip ospf database asbr-summary sh ip ospf database external APPENDIX: 1.ROUTER SUB_COMMANDS network Area Area stub {no-summary} Area authentication Area default_cost Area virtual_link .... Area range 2. INTERFACE SUBCOMMANDS ip ospf cost ip ospf priority ip ospf hello-interval ip ospf dead-interval ip ospf authentication-key ip ospf retransmit-interval Example: router ospf 100 network 200.200.4.0 0.0.0.3 area 0 redistribute connected subnets 使其他路由器可以看到 loopback 地址 ospf log-adjacency-changes 当相邻的路由器发生变化时可以在 本地路由器上看到相关信息 sh ip route sh ip ospf sh ip ospf interfaace sh ip ospf neighbor sh ip ospf database