29
OSPF 路路路路路路 路路路

OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Embed Size (px)

Citation preview

Page 1: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF 路由交換協定

王振生

Page 2: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Overview

‣ A link state protocol that is based on open standards

‣ Fast convergence‣ Supports VLSM/CIDR‣ Require less network bandwidth‣ Require more computing power and

memory‣ Use the concept of areas to implement

hierarchical routing

Page 3: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Distance Vector vs. Link-State

Protocol Examples Characteristics

Distance Vector

RIP v1 and RIP v2

Interior Gateway Routing Protocol (IGRP)

‣Copies routing tables to neighbors‣Updates frequently‣RIP v1 / v2 use hop count as metric‣Views the network from the perspective of the neighbors‣Slow to converge‣Susceptible to routing loops‣Easy to configure and administer‣Consumes a lot of bandwidth

Link-state Open Shortest Path First (OSPF)

Intermediate-System to Intermediate-System (IS-IS)

‣Uses shortest path‣Updates are event triggered‣Sends link-state packets to all network routers‣Has common view of network‣Fast to converge‣Not as susceptible to routing loops‣Harder to configure‣Requires more memory and processing power than distance vector

‣Consumes less bandwidth than distance vector

Page 4: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Terminology‣Link — interface on a router‣Area — a group of routers identified with a unique ID; all routers in the same area share the same link-state database.‣Cost — the speed of network‣SPF Algorithm (Dijkstra) — calculated by each router to choose the lowest-cost path ‣link-state — is a link “up” or “down”‣LSA — a link state advertisement‣Adjacencies Database — keeps track of all directly connected neighbors‣Link-State Database — also known as the Topology database; picture of who is connected to what; all routers should have the same L-S DB‣Forwarding Database — known as the Routing table where the lowest-cost paths are installed‣Designated Router/Backup Designated Router (DR/BDR) — routers that are elected on multiaccess networks to be the focal point for routing updates.

Page 5: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Link and Link State

‣ Link - Interface on a router‣ Link state - Description of an interface

and of its relationship to its neighboring routers, including:

– IP address/mask of the interface, – The type of network it is connected to– The routers connected to that network– The metric (cost) of that link

‣ The collection of all the link-states would form a link-state database.

Page 6: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Router ID

‣ Router ID – Used to identify the routers in the OSPF network– IP address configured with the OSPF router-id command (extra)– Highest loopback address (configuration coming)– Highest active IP address (any IP address)

‣ Loopback address has the advantage of never going down, thus diminishing the possibility of having to re-establish adjacencies. (more in a moment)

Page 7: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Area

‣ An area is a collection of networks and routers that has the same area identification

‣ Each router within an area has the same link-state information‣ All routers will be configured in a single area, the convention is

to use area 0‣ If OSPF has more than one area, it must have an area 0

Or “OSPF Routing Domain”

Single Area OSPF uses only one area, usually Area 0

Page 8: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Cost (Bandwidth)

Cisco default interface costs:

‣ 56-kbps serial link = 1785

‣ 64-kbps serial link = 1562 128-kbps serial link = 781

‣ T1 (1.544-Mbps serial link) = 64

‣ E1 (2.048-Mbps serial link) = 48

‣ 4-Mbps Token Ring = 25

‣ Ethernet = 10

‣ 16-Mbps Token Ring = 6

‣ Fast Ethernet = 1

‣ Problem: Gigabit Ethernet and faster = 1?

Cost = 100,000,000/Bandwidth

Page 9: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Hello Packets

‣ Each router multicasts hello packets to keep track of the state of the neighbor routers.

Page 10: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Network Types

show ip ospf interface

Network Type Characteristics DR election?

Broadcast multiaccess

Ethernet, Token Ring, or FDDI Yes

Nonbroadcast multiaccess (NBMA)

Frame Relay, X.25, SMDS Yes

Point-to-point PPP, HDLC No

Point-to-multipoint Configured by an administrator No

OSPF interfaces automatically recognize three types of networks

Page 11: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Electing the DR and BDR

‣ Without a DR, the formation of an adjacency between every attached router would create many unnecessary LSA (Link State Advertisements), n(n-1)/2 adjacencies.

‣ Flooding on the network itself would be chaotic.

• DR - Designated Router

• BDR – Backup Designated Router

• DR’s serve as collection points for Link State Advertisements (LSAs) on multi-access networks

• A BDR back ups the DR.

• If the IP network is multi-access, the OSPF routers will elect one DR and one BDR

• On multi-access, broadcast links (Ethernet), a DR and BDR (if there is more than one router) need to be elected.

Page 12: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Hello Protocol

‣ OSPF routers send Hellos on OSPF enabled interfaces:–Default every 10 seconds on multi-access and point-to-point segments–Default every 30 seconds on NBMA segments (Frame Relay, X.25, ATM)–Most cases OSPF Hello packets are sent as multicast to 224.0.0.5 (All OSPF Routers)

‣ HelloInterval - Cisco default = 10 seconds or 30 seconds and can be changed with the command ip ospf hello-interval.

‣ RouterDeadInterval - The period in seconds that the router will wait to hear a Hello from a neighbor before declaring the neighbor down.

–Cisco uses a default of four-times the HelloInterval (4 x 10 sec. = 40 seconds, 120 secconds for NBMA) and can be changed with the command ip ospf dead-interval.

‣ Note: For routers to become adjacent, the Hello, DeadInterval and network types must be identical between routers or Hello packets get dropped!

Page 13: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Steps to OSPF Operation

Page 14: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Steps in the Operation of OSPF

Discover neighbors

Page 15: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Shortest-Path First (Dijkstra) Algorithm

Start

Page 16: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Shortest-Path First (Dijkstra) Algorithm

Page 17: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Steps in the Operation of OSPF

Elect DR and BDR on Multi Access Network

Page 18: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Steps in the Operation of OSPF

Selecting the Best Route

Page 19: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Networking Scheme

Taipei/3620192.168.12.0/26

Taichung/1721192.168.12.96/28

Tainan/1721192.168.12.112/28

Kaohsiung/1721192.168.12.64/27

WAN 1 192.168.12.128/30

S1/0 .129

S1/.130

S1/2 .133

S1/1 .137WAN 2

192.168.12.132/30

WAN 3 192.168.12.136/30

S1/.138

F0/.65F0/.113F0/.97

E0/0 .1

S1/.134

Page 20: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Enabling OSPF

Rtr(config)# router ospf process-id

‣ process-id: 1 - 65,535‣ Cisco feature, which allows you to run multiple, different OSPF

routing processes on the same router. (But don’t!)‣ Process-id is locally significant, and does not have to be the

same number on other routers (they don’t care).‣ This is different than the process-id used for IGRP and EIGRP

which must be the same on all routers sharing routing information.

‣ Extra: FYI - Cisco IOS limits the number of dynamic routing processes to 30. This is because it limits the number of protocol descriptors to 32, using one for connected route sources, one for static route sources, and 30 for dynamic route sources.

Page 21: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Configuring the Network Command

Rtr(config)# router ospf process-id

Rtr(config-router)#network address wildcard-mask area area-id

‣ Tells OSPF which interfaces to enable OSPF on (send and receive updates), matching the address and wildcard mask.

‣ Also, tells OSPF to include this network in its routing updates‣ Wildcard is necessary because OSPF supports CIDR and VLSM‣ Most of the time you can just use an inverse-mask (like

access-lists) as the network wildcard mask.Rtr(config-if)#ip address 10.5.1.1 255.255.255.0

Rtr(config)# router ospf 10

Rtr(config-router)#network 10.5.1.0 0.0.0.255 area 0

Page 22: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Configuring a Loopback Address

Rtr(config)# interface loopback 0

Rtr(config-if)# ip add 10.1.1.1 255.255.255.255

‣ Automatically are “up” and “up”‣ Very useful in setting Router IDs as they never go down.‣ RouterID is used to identify the routers in the OSPF network

– IP address configured with the Router-ID command (extra)– Highest loopback address– Highest active IP address

‣ Important for DR/BDR elections unless you use the ip ospf priority command (next)

‣ Extra: Also, useful to configure “virtual” networks that you can ping and route as if they were attached networks.

(loopback interface)

Host mask

Page 23: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Setting OSPF Priority

The priorities can be set to any value from 0 to 255. A value of 0 prevents that router from being elected. A router with the highest OSPF priority will win the election for DR.

Page 24: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Modifying OSPF Cost Metric

Page 25: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Configuring OSPF Authentication

Router(config-if)# ip ospf authentication-key passwordRouter(config-router)# area area-number authentication

Page 26: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

Configuring OSPF Timers

Page 27: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF - Propagating a Default Route

Router(config)# ip route 0.0.0.0 0.0.0.0 [interface | next-hop address ]Router(config-router)# default-information originate

Page 28: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Configuration Commands - Review

Required Commands:Rtr(config)# router ospf process-idRtr(config-router)#network address wildcard-mask area area-id

Optional Commands:Rtr(config-router)# default-information originate (Send default)Rtr(config-router)# area area authentication (Plain authen.)Rtr(config-router)# area area authentication message-digest (md5 authen.)Rtr(config)# interface loopback number (Configure lo as RtrID)Rtr(config)# interface type slot/portRtr(config-if)# ip ospf priority <0-255> (DR/BDR election)Rtr(config-if)# bandwidth kbps (Modify default bandwdth)RTB(config-if)# ip ospf cost cost (Modify inter. cost)Rtr(config-if)# ip ospf hello-interval seconds (Modify Hello)Rtr(config-if)# ip ospf dead-interval seconds (Modify Dead)Rtr(config-if)# ip ospf authentication-key passwd (Plain/md5authen)Rtr(config-if)# ip ospf message-digest-key key-id md5 password

Page 29: OSPF 路由交換協定 王振生. OSPF Overview ‣ A link state protocol that is based on open standards ‣ Fast convergence ‣ Supports VLSM/CIDR ‣ Require less network

OSPF Show Commands - Review

Router# show ip route

Router# show ip ospf

Router# show ip ospf interface

Router# show ip ospf neighbor

Router# show ip ospf database

Router# debug ip ospf adj

Router# debug ip ospf events (Report all OSPF events)

(Report OSPF adjacency events)

(topological database)