开放最短路径优先,是**一个开放标准的链路状态路由协议**(an open-standard Link State routing protocol)。所有链路状态路由协议都是对链路状态进行通告。当链路状态路由器开始在某条网络链路上运作时,逻辑网络的相关信息就被添加到路由器的**本地**链路状态数据库(Link State Database, LSDB)中。该本地路由器此时在其运作链路上,发出`Hello`数据包,以确定出是否有其它链路状态路由器也在其各自接口上运行着链路状态路由协议。**OSPF直接运行在 IP 协议上,使用 IP 下编号为`89`号的协议**。
紧接着数据库的交换, SPF 算法就运行起来,创建出到某个区域或网络主干中所有主机的最短路径树, SPF算法将执行运算的路由器,作为该树的根(Following the database exchange, the SPF algorithm runs and creates a shortest path tree to all hosts in an area or in the network backbone, with the router that is performing the calculation at the root of that tree)。在第 10 天中,对 SPF 算法进行了简要介绍。
OSPF是一种层次化的路由协议,将网络以逻辑方式,分为称作区域的众多子域。这种逻辑分段方法,用于限制链路状态通告在 OSPF 域中扩散的范围(OSPF is a hierarchical routing protocol that logically divides the network into subdomains referred to as areas. This logical segmentation is used to limit the scope of Link State Advertisements(LSAs) flooding throughout the OSPF domain)。 LSAs 是由运行 OSPF 的路由器发出的特殊类型数据包。在区域内和区域间用到不同类型的 LSAs 。通过限制一些类型的 LSAs 在区域间传播, OSPF 的层次化实现有效地减少了 OSPF 网络中路由协议流量的数量。
在多区域 OSPF 网络中,必须指定一个区域作为**骨干区域**, 或者叫`Area 0`。**OSPF骨干**就是此 OSPF 网络的**逻辑中心**。**其它非骨干区域都必须物理连接到骨干**。但因为在非骨干区域和骨干区域之间有着一条物理连接,并非总是可能或可行的,所以 OSPF 标准允许使用到骨干的虚拟连接。这些虚拟连接也就是常说的虚拟链路,但此概念是不包括在当前的 CCNA 大纲中的(In a multi-area OSPF network, one area must be designated as **the backbone area**, or `Area 0`. The OSPF backbone is **the logical centre** of the OSPF network. All other non-backbone areas must be connected physically to the backbone. However, because it is not always possible or feasible to have a physical connection between a non-backbone area and the backbone, the OSPF standart allows the use of virtual connections to the backbone. These virtual connections are known as virtual links, but this concept is not included in the current CCNA syllabus)。
OSPF骨干区域从 ABRs 接收到汇总路由信息。该路由信息被散布到 OSPF 网络中的所有其它非骨干区域。在网络拓扑发生变化时,变化信息就被散布到整个的 OSPF 域,令到所有区域中的所有路由器都有着网络的统一视图(The OSPF backbone area receives summarised routing informaiton from the ABRs. The routing informaiton is disseminated to all other non-backbone areas within the OSPF network. When a change to the network topology occurs, this informaiton is disseminated throughout the entire OSPF domain, allowing all routers in all areas to have a consistent view of the network)。下图12.1演示的网络拓扑,就是一个多区域 OSPF 部署的示例。
`R4`,也就是`2`号区域的 ABR ,从`0`号区域接收到`R3`通告出的汇总信息,并将其扩散到其**邻接区域**。这样做就令到`R5`和`R6`知悉位处其本地区域外、但仍在 OSPF 域内的那些路由了。同样概念也适用于`2`号区域内的路由信息(`R4`, the ABR for Area 2, receives the summary informaiton from Area 0 and floods it into its **adjacent area**. This allows routers `R5` and `R6` to know of the routes that reside outside of their local area but within the OSPF domain. The same concept would also be applicable to the routing informaiton within Area 2)。
总的来讲, ABRs 都维护着所有其各自连接区域的 LSDB 信息。而各个区域中的所有路由器,都有着属于其特定区域的详细拓扑信息。这些路由器交换着区域内的路由信息。 ABRs 则将所连接区域的汇总信息通告给其它 OSPF 区域,以实现域内各子域(区域)间的路由(In summation, the ABRs maintain LSDB informaiton for all the areas in which they are connected. All routers within each area have detailed topology informaiton pertaining to that specific area. These routers exchange intra-area routing informaiton. The ABRs advertise summary informaiton from each of their connected areas to other OSPF areas, allowing inter-area routing within the domain)。
一条点对点连接, 简单来说就是一条两个端点之间的连接。 P2P 连接的实例,包括采用 HDLC 及 PPP 封装的物理 WAN 接口,以及 FR 和 ATM 的点对点子接口。**OSPF点对点组网类型中,不会选举出 DR 和BDR**。在 P2P 类型网络上, OSPF 每`10`秒发出`Hello`数据包。在这些网络上,”死亡“间隔是`Hello`间隔的`4`倍,也就是`40`秒(A Point-to-Point(P2P) connection is simply a connection between two endpoints only. Examples of P2P connections include physical WAN interfaces using HDLC and PPP encapsulation, and Frame Relay(FR) and Asynchronous Transfer Mode(ATM) Point-to-Point subinterfaces. No DR or BDR is elected on OSPF Point-to-Point network types. By default, OSPF sends Hello packets out every 10 seconds on P2P network types. The "dead" interval on these network types is four times the Hello interval, which is 40 seconds)。下面的输出演示了在一条 P2P 链路上的`show ip ospf interface`命令的输出。
点对多点是**一种非默认 OSPF 组网类型**。也就是说,此种组网类型必须使用接口配置命令`ip ospf network point-to-point-multicast [non-broadcast]`手动进行配置。默认情况下,该命令默认应用于一个广播型点对多点类型网络的。此默认组网类型允许 OSPF 采用多播数据包来动态地发现其邻居路由器。此外在**广播型点对多点网络**类型上,不进行DR/BDR选举(Point-to-Multipoint is **a non-default OSPF network type**. In other words, this network type must be configured manually using the `ip ospf network point-to-multipoint [non-broadcast]` interface configuration command. By default, this command defaults to **a Broadcast Point-to-Multipoint network** type. This default network type allows OSPF to use Multicast packets to discover its neighbour routers. In addition, there is no DR/BDR election held on Broadcast Point-to-Multipoint network types)。
关键字`[non-broadcast]`将点对多点网络配置为**非广播点对多点网络**。这样做就要求**静态的 OSPF 邻居配置**,因为此时 OSPF 不会使用多播来动态地发现其邻居路由器。此外,这种网络类型不要求为指定网段进行 DR 及/或 BDR 选举。此种组网的主要用途,即允许分配邻居开销到邻居路由器,而非使用指定给接口的开销,作为那些自所有邻居处收到的路由的开销(The `[non-broadcast]` keyword configures the Point-to-Multipoint network type as **a Non-Broadcast Point-to-Multipoint network**. This requires **static OSPF neighbour configuration**, as OSPF will not use Multicast to discover dynamically its neighbour routers. Additionally, this network type does not require the election of a DR and/or a BDR router for the designated segment. The primary use of this network type is to allow neighbor costs to be assigned to neighbors instead of using the interface-assigned cost for routes received from all neighbors)。
点对多点组网类型,典型地用于**部分全通辐射状非广播多路访问网络**。不过此种组网类型也可指定给诸如广播多路访问网络(比如以太网)等的其它类型网络(The Point-to-Multipoint network type is typically used in **partial-mesh hub-and-spoke Non-Broadcast Multi-Access(NBMA)** networks. However, this network type can also be specified for other networks, such as Broadcast Multi-Access networks(e.g., Ethernet))。默认情况下,在点对多点网络上, OSPF 每`30`秒发出一个`Hello`数据包。默认死亡间隔是`Hello`间隔的`4`倍,也就是`120`秒。
在思科 IOS 软件早期版本中,如路由器上没有至少一个的接口配置了有效 IP 地址且处于`up/up`状态,就无法开启 OSPF 。此限制在当前版本思科 IOS 软件中去除了。假如路由器没有接口配置了有效 IP 地址且处于`up/up`状态,那么思科 IOS 将创建出一个接近数据库(a Proximity Database, PDB)并允许创建出进程。但是,要记住除非选定路由器 ID ,该进程就是非活动的进程,而**路由器 ID 的选定**,可通过下面两种方式完成。
与 EIGRP 不同, OSPF 强制使用反掩码且必须配置反掩码; 但与在 EIGRP 中的情况一样,反掩码提供了同样的功能,也就是匹配指定范围中的接口(unlike EIGRP, the wildcard is mandatory in OSPF and must be configured; however, as is the case with EIGRP, it serves the same function in that it matches interfaces within the range specified)。比如,语句`network 10.0.0.0 0.255.255.255 area 0`,就会对`10.0.0.1/30`、`10.5.5.1/24`, 甚至`10.10.10.1/25`这样的 IP 地址和子网掩码组合的接口,开启 OSPF 路由。基于该 OSPF 网络配置,这些接口都会被分配到 0 号区域。
> **注意:** OSPF反掩码可以与传统子网掩码同样格式敲入,比如`network 10.0.0.0 255.0.0.0 area 0`。在这种情况下,思科 IOS 软件就会将子网掩码翻转,将得到的反掩码输入到运行配置(the running configuration)。另外要记住**OSPF也支持使用全 1s 和全 0s 反掩码,来对某个指定接口开启OSPF**。这样的配置在某个特定接口上开启 OSPF ,但路由器通告配置在该接口自身的实际子网掩码(this configuration enables OSPF on a paricular interface but the router advertises the actual subnet mask configured on the interface itself)。
在决定 OSPF 路由器 ID 时,思科 IOS 选用所配置环回接口中最高的 IP 地址。如未曾配置环回接口,软件就会使用所有配置的物理接口中最高的 IP 地址,来作为 0SPF 路由器 ID 。思科 IOS 软件同样允许管理员使用**路由器配置命令`router-id [address]`**, 来手动指定路由器 ID 。
2. How does OSPF determine whether other Link State routers are operating on the interfaces as well?
3. When a `_______` routing protocol is enabled for a particular link, information associated with that network is added to the local Link State Database (LSDB).
4. OSPF utilises IP Multicast when sending and receiving updates on Multi-Access networks, such as Ethernet. True or false?
5. OSPF is a hierarchical routing protocol that logically divides the network into subdomains referred to as `_______`.
6. Name at least 4 OSPF network types.
7. Name the command used to enter OSPF configuration mode.
8. When determining the OSPF router ID, Cisco IOS selects the lowest IP address of the configured Loopback interfaces. True or false?
9. What command can you use to assign an interface to OSPF Area 2 (interface level command)?
10.`_______` can be described as interfaces over which no routing updates are sent.
沿用第`10`天的实验场景(两台直接连接的路由器,各自其上的环回接口),但取代配置 RIP 及对物理和环回接口进行通告的是,使用OSPF `0`号区域实现(but instead of configuring RIP and advertising the physical and Loopback interfaces, do this using OSPF `Area 0`)。