Tuesday, February 16, 2016

OSPF


Link State

Router ID


  • use "config-router# router-id" command
  • use highest up/up loopback address
  • use highest up/up non-loopback address

Multicast Addresses


  • 224.0.0.5 - All OSPF Routers
  • 224.0.0.6 - OSPF DRs

Messages


  • Hello - discover neighbors; heartbeat
  • Database Description (DD) - exchange brief LSA headers
  • Link-state Request (LSR) - request full details of LSAs
  • Link-state Update (LSU) - contains fully detailed LSAs
  • Link-state Acknowledgement (LSAck) - confirm LSU

Requesting, Getting and Acknowledging LSAs


  • After DD exchange of LSA headers, router will request full copies of LSAs that it needs
    • compares sequence numbers in local LSADB with headers in DD
    • sequence numbers start with 0x80000001, wrap around to 0x7FFFFFFF and re-flood at 0x80000000
  • Acknowledgements

    • sends the same packet back
    • LSAck Message - list of LSA headers that be acknowledged

DR Election


  • occurs after routers have become neighbors, before DD packets
  • if Hello says DR is 0.0.0.0 (means no DR has been elected yet)
    • then routers wait a little longer for others to initialize (OSPF wait time; same value as dead timer)
  • Rules

    • if priority is set, routers put their own RID in their Hello messages
    • others examine Hellos, look at the priority
    • if a router receives better priority, it replaces the RID in it's Hello messages with the better one
    • highest priority is considered better
    • if a router doesn't want to be a DR but still have a high priority, then it will become a BDR
    • late routers don't count
    • if a DR fails, its replaces by the BDR and a election for a new BDR starts

Network Types


  • Broadcast - DR & BDR; hello 10; 3+ hosts
  • Point-to-Point - No DR or BDR, only 224.0.0.5; hello 10
  • NonBroadcast-MultiAccess (NBMA) - Neighbors configured statically (unicast); hello 30; 3+ hosts
  • Point-to-Multipoint - No DR or BDR (multicast & broadcast); hello 30; 3+ hosts
  • Point-to-point Nonbroadcast - hello 30; neighbor command; 3+ hosts

NBMA


  • Troubleshooting

    • Hello/Dead timers
    • All expect or don't expect DR
    • DR must have PVC to every other router in the subnet
    • If one router has static neighbor command, the other router shouldn't need it, but it is recommended

Area Types


  • Backbone - Area 0
  • Stub - Blocks external routes (no LSA type 5; ABR is default gateway)
    • area <area-id> stub
  • Totally Stubby - Blocks external routes and routes of other areas (no LSA type 3,5; ABR is default gateway)
    • area <area-id> nssa no-summary
  • Not-so-stubby (NSSA) - no LSA type 5; can create type 7
    • area <area-id> nssa
  • Totally NSSA - no LSA type 3, 5; can create type 7
    • area <area-id> stub no-summary

LSA Types


  • 1 - router - one per router; listing RID and all interface ip addresses; also represents stub networks
  • 2 - network - one per transit network; created by DR on subnet; represents the subnet and router interfaces
  • 3 - net summary - created by ABRs; represent area's type 1 & 2 LSAs into another area
  • 4 - ASBR summary - like type 3; advertises host route to reach each ASBR
  • 5 - AS external - created by ASBR; for externals routes injected into OSPF
  • 6 - group membership - defined for MOSPF; not supported by Cisco
  • 7 - not-so-stubby-area external - created by ASBRs inside NSSA area instead of type 5
  • 8 - external attributes - not implemented in Cisco routers
  • 9-11 - opaque - used as generic LSAs for future expansion

External Route Types


  • E2 - LSA type 5; only external metric is considered by SPF; ASBR injects
  • E1 - Floods type 5; creates type 4 with metric to ASBR that created type 5; both external and internal metrics are added together to compute the metric

Best Type of Paths


  1. Intra-area routes
  2. Interarea routes
  3. E1 routes
  4. E2 routes

Loop Prevention


  • ABR will not advertise LSAs from other ABRs into the backbone area
  • ABR will ignore LSAs created by other ABRs when learned through the backbone when calculating least-cost paths

Filtering (not with redistribution)


  • Distribute Lists

    • doesnt filter inbound LSA; filters routes added to routing table
    • incoming interface param - incoming interface chacked as if its the outgoing interface for the routes

config# ip prefix-list WORD seq 5 deny 10.4.8.0/24
config# ip prefix-list WORD seq 10 permit 0.0.0.0/0 le 32
config-router# distribute-list prefix WORD in Serial0.2

config# route-map WORD deny 10 (sequence number)
config-route-map# match ip address 1 (acl)
config-route-map# match ip route-source 2 (acl)
config# route-map WORD permit 20 (sequence number)
config-router# distribute-list route-map WORD in

  • ABR LSA Type 3 Filtering


config-router# area 3 filter-list prefix WORD out
config-router# area 3 range 10.3.2.0 255.255.254.0 no-advertise

Stub Router


  • prevent router from becoming transit router
  • non-transit only forward to and from locally attached subnets
  • will advertise as infinite metric routes

config-router# max-metric router-lsa on-startup <time>
config-router# max-metric router-lsa on-startup wait-for-bgp (or 10 minutes)


Configuration



Basic


config# router ospf 1
config-router# log-adjacency-changes detail
config-router# ip ospf priority 255
config-router# router-id 1.1.1.1
config-router# network 172.16.2.0 0.0.0.255 area 0 (any interface that matches the ip address will run ospf)
config-router# area 0 range 172.16.0.0 255.255.0.0 (ABR injects internal router summaries)
config-router# summary-address 172.30.0.0 255.255.0.0 (configured an ABR for external router summaries)
config-router# area 2 stub (configures an ABR and Internal Routers for a stub area)
config-router# area 3 stub no-summary (configures an ABR in a totally stubby area, internal routers should be configured as stub)

Alternative to Network Command

config-if# ip ospf 1 area 3 (ospf AS and area number on each interface)

RIP Redistribute


config# router ospf 1
config-router# network 172.30.0.0
config-router# redistribute rip metric 1000 metric-type [1|2] subnets (1= metric increments; 2 = no increment)
config# router rip
config-router# redistribute ospf 1 metric 10

NonBroadcast MultiAccess Mode


config-subif# ip ospf priority 0...255 (0 = not DR/BDR; 255 = DR/BDR)
config-router# neighbor 170.100.100.2 (need to configure only one direction; used when nonbroadcast)
config-if# frame-relay map ip 170.100.100.3 201 broadcast (need to configure on both ABRs to communicate even though routes have been learned)

Point-to-Multipoint


config-subif# ip ospf network point-to-multipoint (need to configure on both directions)

Timer Configuration


config-subif# ip ospf hello-interval 30
config-subif# ip ospf dead-interval 30
config-subif# ip ospf dead-timer minimal hello-multiplier 4
config-subif# ip ospf retransmit-interval

Virtual Links


  • for areas not directly connected to backbone
  • middle router becomes ABR with full copy of area 0's LSDB

config-router# area 1 virtual-link 1.1.1.1 (use router id; links two ABRs)

Redistribution Using Tags and ACLs


config# route-map eigrp2ospf
config-route-map# match ip address 20 (ACL 20 to allow)
config-route-map# set tag 10 (sets a tag of 10 to whatever matches this route map)
config# router ospf 1
config-router# redistribute eigrp 10 metric 100 subnets route-map eigrp2ospf
config# router eigrp 10
config-router# redistribute ospf 1 metric 1500 0 255 1 1500 route-map ospf2eigrp
config# route-map ospf2eigrp
config-route-map# match tag 5
config# route map ospf2eigrp 20 (sequence number 20; start is 10)
config-route-map# match route-type internal

Inject Default Route into OSPF Domain


config-router# default-information originate always (configure this router as the gateway of last resort)

Authentication and VirtualLinks


config-router# area 0 authentication message-digest
config-subif# ip ospf message-digest-key 1 md5 WORD
config-router# area 1 virtual-link 6.6.6.6 message-digest-key 1 md5 WORD

View/Debug Commands


show ip ospf interface
show ip ospf database
show ip ospf database network (lsa type 2) 
show ip ospf database router (lsa type 1) 
show ip ospf database summary (lsa type 3)
show ip ospf database asbr-summary (lsa type 4)
show ip ospf database external (lsa type 5)
show ip ospf database nssa-external (lsa type 7)
show ip ospf virtual-links
show ip ospf border-routers
show ip ospf statistics
debug ip ospf hello
debug ip ospf adj


OSPF  - propagetes LSA rather than Routing table updates
LSA   -  (Link State Advertisements)  Floods All OSPF routers in the Area
OSPF Link State database is pieced together LSA generated by by the OSPF routers
SPF algorithm to calculate the shortest path to destination based by
LINK = router interface
STATE = description of an interface and its relationship to neighboring routers

OSPF Hierarchical routing consist of AREAs and Autonomous systems AS
it minimized routing update traffic
SPF Shortest Path First algorithm places each router at the root of a tree and calculate the shortest path to each destinations based on cumulative cost
Cost = 10^8/Bandwidth (bps)

Advertised Loopback interfaces is in routing table, can ping and uses address space
Router-ID number by which router is known by OSPF
Default the highest IP address on the active interface at the moment of OSPF process startup
overwritten by loopback interface: highest IP address of any active loopback interface.

Configuring Single Area OSPF
Router(config)#router ospf process-id
Router(config-router)#network address mas area area-ID

Defines OSPF as the IP routing protocols

Assigns networks to a specific OSPF area


Key Characteristics
Type: Link State
Algorithm: Dijkstra’s (Shortest Path First) Algorithm
Standard: RFC 2328
Administrative Distance: 110
Metric: Cost
Protocol/Protocol Number: IP/89
Authentication: Yes (MD5 and Plain Text)
Supports VLSM and Route Summarization
Support for IPv6 (RFC 2740)
Fast Convergence

Router ID (RID)
Router ID must be configured before an OSPF process could be started.
Cisco Routers uses the following criteria to select a router ID:
1. RID configured with “router-id” command
2. If manual RID not configured, select the highest number IP address on any loopback interface in “up/up” state
3. If loopback interfaces not configured, select the highest number IP address on any non-loopback interface in “up/up” state

Metric Calculation
Cost = 100 Mbps / Link Speed
OSPF cost can be modified in three ways:
1. (config-if)#ip ospf cost
2. (config-if)#bandwidth
3. (config-router)#auto-costreference-bandwidth

Router Types
Internal Router: whose (all) interfaces resides within the same area
Backbone Router: A router that resides in the backbone area
Area Border Router: an ABR connect two or more Areas
ASBR: Autonomous System Boundary Router or an
ASBR connects an external routing domain to an OSPF routing domain


Neighbor Process
To become neighbors OSPF routers must be agree on the following parameters
1. Area ID
2. Same subnet
3. Authentication (if used)
4. Hello Interval and Dead Interval
5. Area Type (Stub, NSSA)
6. Router IDs must be unique


OSPF Neighbor States
Down: Previously known neighbor has failed
Init: an interim state in which Hello has been heard from the neighbor but that Hello does not list the local router’s RID
Two-way: the neighbor has sent a Hello that lists the local router’s RID in the list of seen routers
Full: Both routers complete the database exchange process and have identical LSDB. Fully adjacent


Route Types and Preference
Intra-Area Routes: A route to a network in the same
area as the router. Denoted by “O” in the routing table.
Inter-Area Routes: A route to a network in another area
as the router. Denoted by “O IA” in the routing table
External Route: A route to network that is external to
the OSPF routing domain. Denoted by ‘E1’ or ‘E2’ in the
routing table.

Routes Preference:
1. Intra-Area (O) > Inter-Area (O IA)
2. Inter-Area (O IA) > External Type-1 (E1)
3. External Type-1 (E1) > External Type-2 (E2)

Areas
OSPF runs SPF algorithm and requires a lot of processing power and memory. If the size of network is too large this could cause slower convergence and can lead to following problems:
1. more memory is required to maintain the link state database
2. more processing power is required to process the link state database
3. the links state database grows exponentially with the size of OSPF domain
4. a single change in network topology (for example: link up/down) would trigger all routers to re-run the SPF (again) to calculate the shortest path

To cope with these problems, areas are configured. There are two basic types:
1. Backbone Area or Area 0: All other area must be connected to area 0
2. Non-backbone Area: any other area with area-id other than zero


Timers
Hellos are sent to multicast address: 224.0.0.5 (ALLSPFRouters)
Broadcast Multi-access = 10 seconds
Point-to-Point & NBMA = 30 seconds
Dead Timer = Four Times the hello interval
Broadcast = 40 seconds
NBMA and P2P = 120 seconds
To change hello and dead intervals use the command ‘config-if)# ip ospf hello-interval seconds’ and
‘config-if)# ip ospf dead-interval seconds’


Designated Router (DR) / Backup DR (BDR) Election
There are two problems with multi-access networks:
1. For “N” routers, it requires “N(N-1)/2” adjacencies
2. Flooding of this excess LSAs would be chaotic itself for the network
DR/BDR addresses the challenge of adjacency creation and LSA flooding on multi-access networks only No election on P2P and P2MP network type

The following criteria is used for DR/BDR election:
1. Router with highest interface priority is elected as DR
2. Any other router with second highest priority is elected as BDR
3. If priority is equal, highest RID is used as tie-breaker
4. The DR/BDR election is held between two or more neighbors who reach the TWO-WAY state

The priority ranges from 0-to-255 and default value is 1
Priority of 0 means that router will not take part in DR and BDR election
DR is never preempted even if a router with better priority is present. Manual reset is required for preemption If a router becomes active and it checks for an active DR and BDR on the network. If there already is an active DR and BDR on the segment, the new router simply accepts them. If there is not, then an election is held for DR/BDR selection After the DR/BDR have been elected, the other router known as DROthers establish adjacencies with DR and BDR only Neighbors are still tracked on multicast address: 224.0.0.5 but DROthers multicast updates to AllDRRouters address: 224.0.0.6.
Only DR and BDR listen to this address and DR in-turn flood updates to DROthers on 224.0.0.5
DR/BDR is property of a router’s interface not the router itself

Virtual Links
It is link through non-backbone area to backbone area.

Used to connect:
1. an area to backbone area through non-backbone area
2. a partitioned backbone area through non-backbone area

Rules:
1. A virtual link can only be configured between ABRs
2. The transit area must have full routing information and it cannot be stub


Configuration Example



Single Area
Router R1:
interface loopback 0
ip address 10.1.1.1 255.255.255.255
!
interface serial 0/0
ip address 192.168.12.1 255.255.255.0
!
router ospf 100
router-id 1.1.1.1
network 192.168.12.0 0.0.0.255 area 0
network 10.1.1.1 0.0.0.0 area 0


Router R2:
interface loopback 0
ip address 10.2.2.2 255.255.255.255
!
interface serial 0/0
ip address 192.168.12.2 255.255.255.0
!
router ospf 100
router-id 2.2.2.2
network 192.168.12.0 0.0.0.255 area 0
network 10.2.2.2 0.0.0.0 area 0


R2# show ip route | begin Gateway
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.2.2.0/24 is directly connected, Loopback0
O 10.1.1.1/32 [110/65] via 192.168.12.1, 00:00:02, Serial0/0


Example 2





Multi-Area
Router R1:
interface loopback 0
ip address 10.1.1.1 255.255.255.255
!
interface serial 0/0
ip address 192.168.12.1 255.255.255.0
!
interface serial 0/1
ip address 192.168.13.1 255.255.255.0
!
router ospf 100
router-id 1.1.1.1
network 192.168.12.1 0.0.0.0 area 0
network 192.168.13.1 0.0.0.0 area 1
network 10.1.1.1 0.0.0.0 area 0



Router R2:
interface loopback 0
ip address 10.2.2.2 255.255.255.255
!
interface serial 0/0
ip address 192.168.12.2 255.255.255.0
!
router ospf 100
router-id 2.2.2.2
network 192.168.12.2 0.0.0.0 area 0
network 10.2.2.2 0.0.0.0 area 0


Router R3:
interface serial 0/0
ip address 192.168.13.3 255.255.255.0
!
interface loopback 0
ip address 10.3.3.3 255.255.255.255
!
router ospf 100
router-id 3.3.3.3
network 192.168.13.3 0.0.0.0 area 1
network 10.1.1.3 0.0.0.0 area 1


R2# show ip route | begin Gateway
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial0/0
O IA 192.168.13.0/24 [110/128] via 192.168.12.1, 00:00:03, Serial0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA 10.3.3.3/32 [110/129] via 192.168.12.1, 00:00:12, Serial0/0
C 10.2.2.0/24 is directly connected, Loopback0
O 10.1.1.1/32 [110/65] via 192.168.12.1, 00:00:12, Serial0/0
OSPF Troubleshooting Command
1. show ip protocols
2. show ip ospf [<process-id>]
3. show ip route [ospf]
4. show ip ospf interface [brief | <interface-id>]
5. show ip ospf neighbor
6. show ip ospf database
7. debug ip ospf [hello | adjacency | events]






Verify and changing the OSFP RID (RID - Router ID)

Topology
R1- Hub
R2 - spoke
R3 - spoke

R1# show ip osfp neighbor

Nighbor ID Pri State Dead Time Address
3.3.3.3 0 Full/Drother 00:01:41 172.12.123.3
200.200.200.2 0 Full/Drother 00:01:30 172.12.123.2
R1#

R2# show ip osfp
   Routing Process "ospf 1" with ID 200.200.200.1


R2# show ip osfp neighbor
Nighbor ID Pri State Dead Time Address
172.12.123.1 1 Full/DR 00:01:47 172.12.123.1


To change the "address 172.12.123.1" the router ID (RID)

R1#
R1#conf t
R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1

Reload or use "clear ip ospf process" command for this to take effect


Note


RULE 1
If there are no loopback on a router, then
the highest ip address on any interface on the router
will be used as the OSPF RID even if the address is asssigned to an interface
that is not OSPF enabled

RULE 2
if there is a loopback interface on a router, if there is a single one
then that IP is going to be used as the OSPF RID by default.

If you have multiple loopbacks, the highest IP address assigned to the loopback will be
be the OSFP RID. but again, as we see in router 2,
The interface IP address be used as the OSFP RID does not have to be OSFP enabled.



If we have a loopback address as in R3

R2# show run
 interface Loopback0
  ip address 3.3.3.3 255.255.255.0

No comments:

Post a Comment