Académique Documents
Professionnel Documents
Culture Documents
2010-2011
Mohamed EL-Ansary
OSPF C/Cs
Overview
1- Open Standard link state routing protocol 2- Send partial triggered updates called LSA at start up and at changes 3- Updates is sent on multicast (224.0.0.5 or 224.0.0.6 / unicast addresses) 4- While convergence period a LSDB (Link State DataBase) refreshment updates is sent every 30min. 5- LSDB entries expires after 60 min. (maxage) without refreshment 6- Symbol in routing table is O 7- Administrative Distance = 110
8- Metric is cost = 108/BW of interface , BW of interface is T1(1.54Mbps) by default, and can be controlled using , (config-if)#bandwidth <BW in units of Kbps> Max hop count for networks is undefined
9- Support equal load sharing with default of 4 paths and maximum of 6 paths 10- Support Hierarchical design
Mohamed EL-Ansary
3 OSPF tables: 1- Neighbor table (adjacency table) - List of all neighbors (a neighbor is direct connected & understands the same protocol) #show ip ospf neighbors
2- Topology table (Link State Data Base - LSDB) Contains all routers and their attached links in the area or network, or in other way all routes to all destination networks. All routers within an area has identical copy of it. #show ip ospf database
3- Routing table (forwarding database) - Best routes to all destination networks. #show ip route [ospf]
Mohamed EL-Ansary
OSPF topologies: 1- BMA (Broadcast Multiple Access) Ex: Ethernet & Token ring links
2- Point to point A network that joins a single pair of routers. Ex: Interfaces running PPP or HDLC or point to point sub interfaces ATM & Frame Relay 3- NBMA (Non Broadcast Multiple Access) A network that interconnects more than two routers but that has no broadcast capability. Ex: Multipoint ATM, Frame Relay & X.25
OSPF autodetects the interface type, so it can detect how the operation will work.
Mohamed EL-Ansary
Conditions of OSPF routers to be neighbors: 1- Same area ID. 2- Same hello & dead intervals. 3- Same authentication password. 4- Same Stub area flag.
So B will never reply with a hello until these conditions matches with its values
Mohamed EL-Ansary
Hello packet:
Version Type RID Area ID Check sum authentication type Password Password packet length
Hello interval
router priority
The hello packet is encapsulated into IP packet with protocol field in IP packet indicating OSPF payload encapsulated
Mohamed EL-Ansary
Note: The Two way state is the final state between Drothers.
Mohamed EL-Ansary
2- Election of DR & BDR (if not exist) - DR (Designated Router) is the router having the highest : a- First router that is ready for OSPF operation (already booted up & has complete configuration) b-OSPF priority (0 255) on interface facing the BMA segment, default = 1, priority=0 mean can neither be DR nor BDR c- Router ID -Defined value through configuration -Highest IP address for a logical loopback interface - Highest IP address for a physical active interface BDR is a Backup DR and it has the second highest priority or RID. The remaining routers are called Drothers. The DR election is non-preemptive (no one can take DR place, even if it has a better priority or RID, unless DR fails)
Note: the rest of operation will be completed between each router and their DR and BDR only
Mohamed EL-Ansary
3- Routes discovery:
10
Mohamed EL-Ansary
LSA Operation
11
Mohamed EL-Ansary
Creation of Adjacencies
RouterA# debug ip ospf adj *Feb 17 18:41:51.242: OSPF: Interface Serial0/0/1 going Up *Feb 17 18:41:51.742: OSPF: Build router LSA for area 0, router ID 10.1.1.1, seq 0x80000013 *Feb 17 18:41:52.242: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/1, changed state to up *Feb 17 18:42:01.250: OSPF: 2 Way Communication to 10.2.2.2 on Serial0/0/1, state 2WAY *Feb 17 18:42:01.250: OSPF: Send DBD to 10.2.2.2 on Serial0/0/1 seq 0x9B6 opt 0x52 flag 0x7 len 32 *Feb 17 18:42:01.262: OSPF: Rcv DBD from 10.2.2.2 on Serial0/0/1 seq 0x23ED opt0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Feb 17 18:42:01.262: OSPF: NBR Negotiation Done. We are the SLAVE *Feb 17 18:42:01.262: OSPF: Send DBD to 10.2.2.2 on Serial0/0/1 seq 0x23ED opt 0x52 flag 0x2 len 72 *Feb 17 18:42:01.294: OSPF: Rcv DBD from 10.2.2.2 on Serial0/0/1 seq 0x23EE opt0x52 flag 0x3 len 72 mtu 1500 state EXCHANGE *Feb 17 18:42:01.294: OSPF: Send DBD to 10.2.2.2 on Serial0/0/1 seq 0x23EE opt 0x52 flag 0x0 len 32 *Feb 17 18:42:01.294: OSPF: Database request to 10.2.2.2 *Feb 17 18:42:01.294: OSPF: sent LS REQ packet to 192.168.1.102, length 12 *Feb 17 18:42:01.314: OSPF: Rcv DBD from 10.2.2.2 on Serial0/0/1 seq 0x23EF opt0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE *Feb 17 18:42:01.314: OSPF: Exchange Done with 10.2.2.2 on Serial0/0/1 *Feb 17 18:42:01.314: OSPF: Send DBD to 10.2.2.2 on Serial0/0/1 seq 0x23EF opt 0x52 flag 0x0 len 32 *Feb 17 18:42:01.326: OSPF: Synchronized with 10.2.2.2 on Serial0/0/1, state FULL *Feb 17 18:42:01.330: %OSPF-5-ADJCHG: Process 10, Nbr 10.2.2.2 on Serial0/0/1 from LOADING to FULL, Loading Done *Feb 17 18:42:01.830: OSPF: Build router LSA for area 0, router ID 10.1.1.1, seq 0x80000014
12
Mohamed EL-Ansary
Creation of Adjacencies
RouterA# debug ip ospf adj
13
Ethernet interface coming up: Election %LINK-3-UPDOWN: Interface ethernet0, changed state to up OSPF: Interface ethernet0 going Up OSPF: Rcv hello from 192.168.0.11 area 0 from Serial1 10.1.1.2 OSPF: End of hello processing OSPF: Build router LSA for area 0, router ID 192.168.0.10 OSPF: send hello to 192.168.0.11 on ethernet0 seq 0x20C4 opt 0x2 flag 0x7 len 32 state INIT OSPF: OSPF: OSPF: OSPF: OSPF: 2 Way Communication to 192.168.0.11 on Ethernet0, state 2WAY end of Wait on interface Ethernet0 DR/BDR election on Ethernet0 Elect BDR 192.168.0.12 Elect DR 192.168.0.12 DR: 192.168.0.12 (Id) BDR: 192.168.0.12 (Id) OSPF: Rcv DBD from 172.16.1.1 on FastEthernet0/0 seq 0x14B 7 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART OSPF: First DBD and we are not SLAVE <>
Mohamed EL-Ansary
14 4 Choosing routes: Each router in the area places itself into the root of the tree that is built. The best path is calculated with respect to the lowest total cost of links to a specific destination. Forming the routing table by applying the SPF algorithm (Dijkstra algorithm) on the LSDB to form the RTG table.
Mohamed EL-Ansary
15
Operation of OSPF in point to point - The same operation of BMA but no DR & BDR exists.
Mohamed EL-Ansary
16
At convergence : - No further updates unless the LSDB time expires (30 min.)
- periodic keepalive hellos are sent, dead interval is 4*hello. Hello/dead=10/40 sec for BMA & P-P, 30/120 sec for NBMA multipoint.
- Each link-state entry also has a maximum age of 60 minutes. If a linkstate entry has not been refreshed within 60 minutes, it is removed from the LSDB.
Mohamed EL-Ansary
At change:
17
Mohamed EL-Ansary
Convergence stability : To solve the flapping link problem, OSPF uses the convergence stability rules (timers).
18
1- SPF delay time: (5sec.) - Time to wait after hearing last update so as the router can perform the SPF calculation. 2- SPF hold time: (10sec.) - Delay between two SPF calculations.
Mohamed EL-Ansary
- Basic configuration: (config)# router ospf <process id> ! process id = 1-65535 & can never be 0, a maximum of 32 process could be supported by ospf
19
Or
Router(config-if)# ip ospf process-id area area-id ! Optional method to enable OSPF explicitly on an interface
Mohamed EL-Ansary
20
or or
00
Mohamed EL-Ansary
21
Define the router ID: (config-router)# router-id <ip address> Loopback interface: (config)# int loopback 0 (config-if)# ip address <ip> <mask>
Router#clear ip ospf process ! This command will clear process which will help the router to use the new RID
Mohamed EL-Ansary
Optional configuration: - Defining router priority: (config)# int e0/0 (config-if)# ip ospf priority <no.> - Defining interface cost: 1- (config-if)# ip ospf cost <no.> 2- (config-if)# bandwidth <no. in kbps> 3- (config-router)# ospf auto-cost reference-bandwidth <no.>
22
- Ospf timers: (config-router)# timer spf <spf delay time> <spf hold time> (config-if)# ip ospf hello-interval <no. in sec> (config-if)# ip ospf dead-interval <no. in sec>
- Defining the no. of paths for load sharing: (config-router)# maximum-paths <no.>
Mohamed EL-Ansary
OSPF Router Authentication OSPF supports 2 types of authentication: Simple password (or plain text) authentication MD5 authentication
Configuring OSPF Password Authentication Router(config-if)# ip ospf authentication-key password ! Assigns a simple password to be used with neighboring routers or Router(config-if)#ip ospf message-digest-key key-id md5 key ! Assigns a hash based password to be used with neighboring routers Activate the authentication on interface: Router(config-if)#ip ospf authentication [message-digest | null]
23
24
Mohamed EL-Ansary
25
Mohamed EL-Ansary
Troubleshooting
#show ip route
RouterA# show ip route ospf
26
Codes:
C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP, D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP, i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
Gateway of last resort is not set 10.0.0.0 255.255.255.0 is subnetted, 2 subnets O 10.2.1.0 [110/10] via 10.64.0.2, 00:00:50, Ethernet0
Pri 1 1
Mohamed EL-Ansary
Troubleshooting
#show ip ospf interface
RouterA# show ip ospf interface e0 Ethernet0 is up, line protocol is up Internet Address 10.64.0.1/24, Area 0 Process ID 1, Router ID 10.64.0.1, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 10.64.0.2, Interface address 10.64.0.2 Backup Designated router (ID) 10.64.0.1, Interface address 10.64.0.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:02 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 10.64.0.2 (Designated Router) Suppress hello for 0 neighbor(s)
27
Mohamed EL-Ansary
#show ip ospf
RouterB# show ip ospf Routing Process "ospf 1" with ID 10.2.1.1 Supports only single TOS(TOS0) routes SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Number of DCbitless external LSA 0 Number of DoNotAge external LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Area BACKBONE(0) (Active) Number of interfaces in this area is 2 Area has no authentication SPF algorithm executed 10 times Area ranges are Link State Update Interval is 00:30:00 and due in 0:07:16 Link State Age Interval is 00:20:00 and due in 00:07:15 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0
28
Mohamed EL-Ansary
29
Link count 2 2 2
#show ip protocols
- To let any changes appear on the CLI in a live manner: (config-router)#log-adjacency-changes #debug ip ospf adjacency #debug ip ospf packet
RouterC# debug ip ospf packet OSPF: rcv. v:2 t:1 l:48 rid:10.64.0.2 aid:0.0.0.0 chk:6AB2 aut:0 auk:
Mohamed EL-Ansary
30 OSPF operation in NBMA networks Due to based on layer 3 concepts all devices on NBMA segment must be in the same subnet, so OSPF (layer 3 protocol) need to treat them as direct neighbors, on the other hand using layer 2 concepts they may not be directly connected (no PVC between all of them) they are not next hops to each others, but OSPF can treat them in some cases as direct neighbors as in the case of NBMA mode.
Mohamed EL-Ansary
31
or partial mesh
Mohamed EL-Ansary
Configuration for NBMA networks: (config)# int s0/0 (config-if)# ip ospf network { non-broadcast / broadcast / point-tomultipoint [non-broadcast]/ point-to-point}
32
- To define the neighbor statically: (config-router)# neighbor <ip> [priority <no.>] [database-filter all]
Note : The default mode for main interface & multipoint subinterface is non-broadcast and for point to point sub interface is point to point.
Mohamed EL-Ansary
33
ospf 100 network 130.130.0.0 0.0.255.255 area 0 network 140.140.0.0 0.0.255.255 area 0 neighbor 140.140.1.2 priority 0 neighbor 140.140.1.3 priority 0
Priority 0 , tells the local router that it is the DR (all its neighbors have 0 priority), this method is used to define DR statically
RouterA# show ip ospf neighbor
Neighbor ID 130.130.1.1 201.23.13.1 192.100.1.1 Pri 1 0 0 State full/ full/drother full/drother Dead Time 0:00:35 0:00:36 0:00:34 Mohamed EL-Ansary Address 128.12.1.2 140.140.1.2 140.140.1.3 Interface s0 s1 s1
34
130.130.1.2 S0
RouterA(config)# router ospf 100 RouterA(config-router)# network 140.140.0.0 0.0.255.255 area 0 RouterA(config-router)# network 130.130.0.0 0.0.255.255 area 0 RouterA(config)# interface serial 0 RouterA(config-if)# encapsulation hdlc RouterA(config-if)# ip address 130.130.1.2 255.255.255.0 RouterA(config)# interface serial 1 RouterA(config-if)# encapsulation frame-relay RouterA(config-if)# ip address 140.140.1.1 255.255.255.0 RouterA(config-if)# ip ospf network point-to-multipoint RouterB(config)# router ospf 100 RouterB(config-router)# network 140.140.0.0 0.0.255.255 area 0 RouterB(config)# interface serial 0 RouterB(config-if)# ip address 140.140.1.2 255.255.255.0 RouterB(config-if)# encapsulation frame-relay RouterB(config-if)# ip ospf network point-to-multipoint
RouterA# show ip ospf interface s1 Serial1 is up, line protocol is up Internet Address 140.140.1.1/24, Area 1 Process ID 100, Router ID 120.120.1.1, Network Type Point-To-Multipoint, Cost: 64 Transmit Delay is 1 sec, State: Point_To_Multipoint Timer intervals configured,Hello 30, Dead 120, Wait 120, Retransmit 5 Hello due in 00:00:11 Neighbor count is 2, Adjacent neighbor count is 2 Adjacent with neighbor 140.140.1.2 Adjacent with neighbor 140.140.1.3
Mohamed EL-Ansary
35
130.130.1.2 S0
RouterA(config)# router ospf 100 RouterA(config-router)# network 140.140.0.0 0.0.255.255 area 0 RouterA(config-router)# network 130.130.0.0 0.0.255.255 area 0 RouterA(config)# interface serial 0 RouterA(config-if)# encapsulation ppp RouterA(config-if)# ip address 130.130.1.2 255.255.255.0 RouterA(config)# interface serial 1.1 point-to-point RouterA(config-subif)# frame-relay interface-dlci 101 RouterA(config-subif)# ip address 140.140.1.1 255.255.255.0 RouterA(config-subif)#interface serial 1.2 point-to-point RouterA(config-subif)# frame-relay interface-dlci 102 RouterA(config-subif)# ip address 140.140.2.1 255.255.255.0
RouterA# show ip ospf interface s1 Serial1 is up, line protocol is up Internet Address 140.140.1.1/24, Area 1 Process ID 100, Router ID 120.120.1.1, Network Type Point-To-point, Cost: 64 Transmit Delay is 1 sec, State: Point_To_point Timer intervals configured,Hello 30, Dead 120, Wait 120, Retransmit 5 Hello due in 00:00:11 Neighbor count is 2, Adjacent neighbor count is 2 Adjacent with neighbor 140.140.1.2 Adjacent with neighbor 140.140.1.3
Mohamed EL-Ansary