OSPF routing protocol
OSPF Routing Protocol Overview
And Interior Gateway Protocol Exterior Gateway Protocol
- Autonomous systems (
AS
): each region is an autonomous system - Interior Gateway Protocol (
IGP
): protocol within each region called Interior Gateway Protocol - Exterior Gateway Protocol (
EGP
): network connection protocol between the region is called exterior gateway protocol
OSPF
(Open Shortest Path First) is an interior gateway protocol (referred to IGP
), for (a single autonomous systems AS
) routing the decision. It is a link state routing protocol implemented under the Interior Gateway Protocol ( IGP
), so that the internal operation of the autonomous system.
OSPF working process
- Neighbor List
- Link state data table
- Routing Table
Establishes adjacencies ⟶ link state database (learning link status information) ⟶ shortest path tree ( Dijkstra
algorithm) ⟶ routing table
OSPF area
- To accommodate large networks
OSPF
inAS
the plurality of divided regions - Each
OSPF
route is only maintains a complete link-state information in your area
Area ID
- Region
ID
can be expressed as a decimal number - It can also be expressed as a
IP
AREA 0 (backbone area)
-
Area 0
Belong to the core (backbone area), the backbone area and only one, each region and connected to the backbone area - Responsible for routing information dissemination between regions
Router ID
OSPF
Uniquely identifying the region routerIP
address
Router ID selection rule
- Select router
loopback
highest value on the interfaceIP
address - If there is no
loopback
interface to select the physical ports kindsIP
highest address - You can also use
router-id
the command to specifyRouter ID
DR and BDR
-
DR
: Responsible for sending information to all otherOSPF
routers BDR
: Responsible for monitoring the status of the backup DR, and the currentDR
take over its role in the event of failure-
DR
FailureBDR
to replaceDR
- Other routers (
DRothers
) only withDR
, andBDR
adjacent with
DR and BDR election method
- Automatic election
DR
andBDR
- On the segment
Router ID
's largest router will be elected asDR
the second largest will be electedBDR
- On the segment
- Manually select
DR
andBDR
- Priority range
0~255
, the larger the number, the higher priority, the default is me - If the priorities are the same, you need to compare
Router ID
- If the router priority is set
0
, it will not participateDR
andDBR
elections
- Priority range
DR and BDR election process
- Router priority can affect an election process, but it can not force the replacement of existing
DR
orBDR
router
OSPF multicast address
- 224.0.0.5: responsible for sending information to the following router
- 224.0.0.6: responsible for receiving information on the following routes
OSRF metric value COST
COST=10的8次方/BW
(100M / bandwidth)- The shortest path is based on the cost assigned to the interface (
cost
) calculated
OSPF datagram type
OSPF packet
- Carried in
IP
the packet, a protocol ID89
OSPF packet types
OSPF The packet type |
description |
---|---|
Hello package |
It used to discover and maintain neighbor relations, elections DR andBDR |
Database description packets DBD ( ) |
For transmitting the summary information to the neighbor link state database synchronization |
Link state request packet LSR ( ) |
The router receives the information containing the new DBD information transmission, a request for more detailed |
Link state update packets LSU ( ) |
After receiving LSR sends a link state advertisement ( LAS ), a LSU packet may contain severalLSA |
Link state acknowledgment packet LSAck ( ) |
Confirmation has been received LSU , each LSA needs to be confirmed separately |
The first stage is to start using OSPF Hello packets to establish two-way communication process
Down
Status: inactive status, information exchange, activated
Init
Status: initialization state, the transmission information is exchanged
2-Way
Status: information exchange, and to elect DR
and BDR
single not confirmed DR
andBDR
The second stage of the boot is built entirely adjacency
ExStart
Status: Start quasi-state, and confirmed DR
and BDR
;
Exchange
Status: the status switching, transmission DBD
, and LSAck
packets
Loading
Status: transport LSR
, LSU(LSA)
, LSAck
packet
Full
Status: steady state convergence
OSPF network is divided into four types
- Point to point network
Point-to-Point
( ) - Broadcast multi-access network (
Broadcast Multiaccess,BMA
) - Non-Broadcast Multiple Access Network (
None Broadcast Multiaccess,NBMA
) - Multipoint networks
Point-to-Multipoint
( )
Consider using OSPF from the following aspects
- Network size
- Network topology
- Other special requirements
- Routers own requirements
OSPF features
- Can accommodate large-scale network
- Routing convergence speed change block
- No routing loop
- Support for variable length subnet mask VLSM
- Support zoning
- Support protocol packets sent to a multicast address
Comparison of OSPF and RIP's
OSPF |
RIP v1 |
RIP v2 |
---|---|---|
Link-state routing protocol | Distance vector routing protocol | Distance vector routing protocol |
There is no limit on the number of hops | RIP The 15 hop limit, than 15 jump |
The route is considered unreachable |
Support for variable length subnet mask(VLSM) |
It does not support variable length subnet mask(VLSM) |
Support for variable length subnet mask(VLSM) |
Convergence speed block | Slow convergence | Slow convergence |
Multicast transmission link state update | Updating the entire routing table periodically broadcasted | Updating the entire routing table periodically broadcasted |
OSPF configuration commands
Start OSPF routing process
router ospf process-id
Interface and the area where the specified OSPF protocol runs
network address inverse-mask area area-id
(Inverted)
Priority modify the interface
ip ospf priority priority
Cost modified values interface
ip ospf cost cpst
View the routing table
show ip route
View a list of neighbors and their status
show ip ospf neighbor
View OSPF configuration
show ip ospf
View the data structure of the OSPF interface
show ip ospf interface type number
Which reality scene which first started doing DR
OSPF multi-zone principle and configuration
The Reasons for multiple OSPF areas
- Improve network scalability
- Fast Convergence
Three traffic OSPF
Zone traffic
- Exchange of traffic between the packets constituting a single routing area
Inter-domain traffic ( ABR
routing)
- Exchanging packets constituting traffic router between different regions
External traffic ( ASBR
routing)
OSPF
Domain router andOSPF
an outer region between the other routers in the autonomous system to exchange data or packet traffic constituted
OSPF routing type
- Area Border Router
ABR
- Autonomous system boundary router
ASBR
OSPF area types
- Backbone area
Area 0
-
Non-backbone area - depending on the type of routing can learn to distinguish
- Standard area
- Peripheral region
(stub)
- Totally peripheral
(Totally stubby)
area - Non-stubby area
(NSSA)
- Different regions of the tip is run except that
LSA
Composition OSPF link-state database
- Each router creates a database by each interface corresponding to adjacent nodes and interfaces consisting of speed
- No link state database entries called
LSA
(LSA), there are six commonLSA
types
Link state advertisement (LSA) type
Type Code | description | use |
---|---|---|
Type 1 |
routerLSA |
Issued by the routers in the area (all routers are emitted) (interactive link status) |
Type 2 |
The internetLSA |
(Declared network state information) is sent from the DR in the region (12, and each region has a) |
Type 3 |
Network SummaryLSA |
ABR Issued aggregated link advertised other regions (inter-area routing information collection, transmission across the area) |
Type 4 |
ASBR GatherLSA |
ABR Issued for an ASBR information (tell other routing ASBR position) |
Type 5 |
AS OutsideLSA |
ASBR Issued to advertise external route (advertise external route information network, the external network to collect information) |
Type 7 |
NSSA OutsideLSA |
NSSA In the region ASBR emitted from, for external routes advertised in the region of the connection (only in the NSSA memory region) |
Each region types allowed LSA flooding
Area Type | 1&2 |
3 |
4&5 |
7 |
---|---|---|---|---|
The backbone area (area 0 ) |
allow | allow | allow | Not allowed |
Non-backbone area, the non-peripheral region | allow | allow | allow | Not allowed |
Peripheral region | allow | allow | Not allowed | Not allowed |
Totally peripheral area | allow | Not allowed* |
Not allowed | Not allowed |
NSSA |
allow | allow | Not allowed | allow |
OSPF common view commands
command | Features |
---|---|
show ip route |
Check the routing table (direct / learning) |
show ip route ospf |
View only OSPF learned routes |
show ip protocol |
View OSPF protocol configuration information |
show ip ospf |
To see OSPF how it is configured and ABR information |
show ip ospf database |
View LSDB all within the LSA data |
show ip ospf interface |
View on the interface OSPF information configuration |
show ip ospf neighbor |
View OSPF neighbors and adjoining states |
show ip ospf neighbor detail |
View OSPF detailed neighbor information (including DR/BDR ) |
debug ip ospf adj |
View Router "adjacency" of the entire process |
debug ip ospf packet |
View each OSPF information packet |
clear ip route |
Empty routing table |
Router route selection entry
- Routers only the best route to add entries to the routing table
-
Routing entries based on
- Administrative distance
- metric
- Load balancing routing entries
Peripheral areas and complete peripheral region
-
Region satisfies the following conditions
- Only as a default route to export their area
- As the area can not cross the region virtual link
Stub
No area in the autonomous system boundary routerASBR
- Not the backbone area
Area 0
-
Peripheral region
- No
LSA4、5、7
notice
- No
- Totally peripheral area
- In addition to the default route advertised a LSA3, without
LSA3、4、5、7
notice
- In addition to the default route advertised a LSA3, without
OSPF advanced configuration
Understand routing redistribution
- A single
IP
routing protocol is to manage the networkIP
of choice for routing scheme Cisco IOS
Capable of performing a plurality of routing protocols, each routing protocol and the routing protocols and services belong to the same autonomous systemCisco IOS
Use redistribution routing features to exchange routing information created by different protocols
Routing redistribution considerations
- Metric (bandwidth)
- Administrative distance
Redistributed into the OSPF domain route path type
- The type of external path 1 (
Type 1 external path, E1
) - Type external path 2 (
Type 2 external path, E2
)
A router has two paths to the exterior of the destination network 10.1.2.0
-
E1 type
- 路径
A-B-D
的代价是25(20+5)
(优先) - 路径
A-C-D
代价为48(18+30)
- 路径
- E2类型
- 路径
A-B-D
的代价是20
- 路径
A-C-D
的代价为18
(优先)
- 路径
路由重分发配置命令
redistribute protocol [metric metric-value] [metric-type type-value] [subnets]
NSSA区域
NSSA区域是OSPF RFC的补遗
- 定义了特殊的
LSA
类型7
- 提供类似
stub area
和totally stubby area
的优点 - 可以包含
ASBR
OSPF链路状态通告
LSA(NSSA EXternal LSA,NSSA外部LSA)
NSSA区域重分发路由类型
N1
、N2
- 经过
NSSA
区域ABR
后转换为E1
、E2
(7
变成5
)
配置NSSA区域命令
area area-id nssa [no-summary]
OSPF的路径类型
- 区域内路径
- 区域外路径
- 类型1的外部路径
- 类型2的外部路径
OSPF的路径类型的优先级
- 区域内路径: 优先级
1
- 区域间路径: 优先级
2
- E1外部路径: 优先级
3
- E2外部路径: 优先级
4
1
表示最高的优先级,4
表示最低的优先级
OSPF虚链路
-
虚链路
- 值一条通过一个非骨干区域连接到骨干区域的链路
-
虚链路的目的
- 通过一个非骨干区域连接一个区域到骨干区域
- 通过一个非骨干区域连接一个分段的骨干区域
-
配置虚链路的规则及特点
- 虚链路必须配置在两台
ABR
路由器之间 - 传送区域不能是一个末梢区域
- 虚链路的稳定性取决于其经过的区域的稳定性
- 虚链路有助于提供逻辑冗余
- 虚链路必须配置在两台
- 虚链路的配置命令
area area-id vrtual-link router-id
总结:
OSPF域中路由的路径类型
- E1(N1)
- E2(N2)
OSPF的四种路由类型
- DR
- BDR
- ABR
- ASBR
OSPF的五大区域
- 骨干区域
- 标准区域
- 末梢区域
- 存末梢区域
- 非存末梢区域
OSPF的五大数据包类型
- hello
- DBD
- LSR
- LSU(LSA)
- LSACK
OSPF的六种LSA
- 路由器LSA
- 网络LSA
- 网络汇总LSA
- ASBR汇总LSA
- AS外部LSA
- NSSA外部LSA
OSPF的七种状态
- Down
- init
- 2-Way
- Exstart
- Exchange
- loading
- ful