際際滷

際際滷Share a Scribd company logo
OSPF

Open Shortest Path First
Introduction

Objectives:
- N畉m r探 c叩c kh叩i ni畛m c董 b畉n c畛a giao th畛c OSPF
- Hi畛u 動畛c ph動董ng ph叩p t狸m 動畛ng i c畛a OSPF
- C畉u h狸nh c董 b畉n v n但ng cao.
Introduction to OSPF

OSPF l giao th畛c 動畛c s畛 d畛ng ph畛 bi畉n nh畉t. Vi畛c n畉m
動畛c n坦 l m畛t i畛u r畉t quan tr畛ng.
G坦i tin OSPF:
- Data Link Frame:
- IP Packet:
    + 畛a ch畛 g畛i: multicast (224.0.0.5 (s畛 d畛ng cho all router) /
224.0.0.6 (s畛 d畛ng cho DR/BDR)).
    + Protocol Field = 89
- OSPF Packet Header:
   + Type code: Ch畛 ra lo畉i g坦i tin (Hello, Database Desc, Link
state Request, Link state Upate, Stae Ack.)
   + Router ID & Area ID: Ph但n bi畛t gi畛a c叩c router v khu v畛c
s畛 d畛ng.
OSPF Packet Types

1. Hello: Ph叩t hi畛n v t叩i ph叩t hi畛n c叩c router hng x坦m, thi畉t
l畉p m畛i quan h畛 adjacency.
2. Database Description (DBD): 畛ng b畛 c董 s畛 d畛 li畛u gi畛a
c叩c router. Trong m畛t area, c叩c router ph畉i c坦 m畛t csdl
(topology) gi畛ng h畛t nhau.
3. Link-state Request (LSR): Y棚u c畉u v畛 m畛t v湛ng m畉ng.
4. Link-state Update (LSD): g畛i tr畉 v竪 c叩c th担ng tin cho
request ho畉c c畉p nh畉t s畛 thay 畛i trong v湛ng m畉ng.
5. Link-state Acknowledgement (LSAck): 畉m b畉o vi畛c truy畛n
tin tin c畉y.
Hello Packet

- G坦i tin hello 動畛c trao 畛i gi畛a 2 con neighbor v畛i nhau
tr動畛c khi thi畉t l畉p m畛i quan h畛 adjency.
C叩c tr動畛ng th担ng tin:
- Type:
- Router ID:
- Area ID:
- Network Mask: subnet mask c畛a interface g畛i i
- Hello Interval: 10s vs 30s
- Router Priority: L畛a ch畛n router DR hay BDR trong c叩c v湛ng
m畉ng Broadcast multiaccess.
- Router Dead Interval: = 4 l畉n hello interval (t動董ng t畛 holdtime
c畛a EIGRP).
- Designated Router (DR):
- Backup DR (BDR):
- List of neighbor(s):
Link-state Upade Packet

LSU chia thnh 10 lo畉i g坦i tin kh叩c nhau, ph畛 thu畛c vo c叩c
lo畉i router:
Type Description
1         Router LSAs
2         Network LSA: g畛i b畛i router DR, li畛t k棚 c叩c router ID
         c畛a c叩c router trong v湛ng multiaccess.
3/4      Summary LSA: S畛 d畛ng 畛 c叩c router bi棚n, qu畉ng b叩
OSPF vo c叩c area kh叩c.
C畉u h狸nh c董 b畉n OSPF
OSPF Configuration
R(config)#router ospf <proccess_ID>
process_ID k担 c畉n ph畉i gi畛ng nhau. (kh叩c vs EIGRP)
--> R(config-router)#network <network_address>
<wildcard_mask> area <area_number>
Trong gi叩o tr狸nh CCNA, ta s畛 d畛ng 董n v湛ng n棚n
<area_number> = 0.
Gi叩 tr畛 ny ph畉i chung nh畉t.
VD:
R(config)#router ospf 1
                   network 172.16.1.16 0.0.0.15 area 0
C嘆n m畛t vi c叩ch lm kh叩c:
- Th畛c hi畛n summary lu担n c叩c v湛ng m畉ng sau 坦 qu畉ng b叩.
- Ko quan t但m 畉n 畛a ch畛 c叩c interface:
c但u l畛nh: network 0.0.0.0 255.255.255.255 area 0.
C畉u h狸nh chu畉n

Khuy畉n c叩o s畛 d畛ng c叩ch sau 但y:
Ch畛 ra ch鱈nh x叩c 畛a ch畛 c畛a interface v wildcard mask =
0.0.0.0
--> Gi叩m s叩t 動畛c vi畛c ch畉y ospf tr棚n interface no.
Ex:
Router(config-router)#network 192.168.1.17 0.0.0.0 area 0
Router ID

S畛 d畛ng 畛nh danh cho c叩c router trong 1 area.
- 畛 畛nh danh router id cho m畛t router s畛 d畛ng ospf, ta c坦 th畛
d湛ng c但u l畛nh router-id v畛i vi畛c s畛 d畛ng 1 d畉i ip 畛 畛nh danh:
(config-router)#router-id 1.1.1.1 (example - n坦 ch畛 l 1 畛a ch畛).
- Trong tr動畛ng h畛p tr棚n router ko thi畉t l畉p router id, router s畉
l畛a ch畛n interface loopback c坦 畛a ch畛 ip cao nh畉t lm router id
(nh畛 l loopback nh辿 :D) --> khuy畉n ngh畛
- Trong tr動畛ng h董p ko s畛 d畛ng router id v loopback, n坦 s畉 l畉y
畛a ch畛 cao nh畉t c畛a interface m ang ho畉t 畛ng (active) lm
router id (i畛u ny c坦 ngh挑a l interface 坦 ko nh畉t thi畉t xi
OSPF).--> f動董ng f叩p ny k担 khuy畉n ngh畛, do c畛ng v畉t l箪 c坦 th畛
h畛ng.
Ki畛m tra Router ID

#show ip protocols
Details:
- Router ID 192.168.10.5

S畛 d畛ng Loopback lm ID: ch畛 c畉n t畉o ra loopback v g叩n 畛a
ch畛 IP cho n坦.

Ki畛m tra ho畉t 畛ng c畛a OSPF:
#show ip ospf neighbor
(Nh動 EIGRP)
Details:
Router ID Pri State Dead Time        Address Interface
                                      (neighbor) (local)
Ki畛m tra OSPF

show ip ospf interface <type> <port>
show ip route
Metric c畛a OSPF

Metric: cost
畛i v畛i c叩c router c畛a cisco, cost c t鱈nh d畛a tr棚n ngh畛ch 畉o
c畛a bng th担ng. (10^8/bps)
ex:
Fast Ethernet 10^8/100,000,000 bps = 1
Ethernet         10^8/10,000,000 bps = 10.
v.v...
Default Bandwidth vs Actual Bandwidth

- OSPF s畛 d畛ng bng th担ng m畉c 畛nh, n棚n c坦 th畛 t鱈nh to叩n sai
so v畛i th畛c t畉. Do 坦 ta c畉n c畉u h狸nh l畉i.
(config-if)#bandwidth 64 (kbps)
ho畉c:
(config-if)#ip ospf cost 1562 (t鱈nh to叩n d畛a tr棚n bandwidth).
担i khi trong th畛c t畉, ta l畉i mu畛n "b畉 cong" gi叩 tr畛 ny so vs
th畛c t畉.
OSPF v Multiacess
OSPF Network Type

- Point - to - Point
- Broadcast Multiaccess
- Nonbroadcast Multiaccess. VD: Frame Relay
- Point - to - Multipoint
- Virtual links.
Challenges in multiaccess Network

- Adjacency c坦 j kh叩c neighbors?
DR v BDR.
Trong v湛ng m畉ng multiaccess s畉 b畉u ch畛n ra m畛t router l DR,
m畛t router s畉 l BDR.
DR v BDR s畉 thi畉t l畉p adjacency v畛i t畉t c畉 router c嘆n l畉i.
Sending & Receiving LSA
DR/BDR Election

L畛a ch畛n DR/BDR nh動 th畉 no?

- DR 動畛c l畉y t畛 router c坦 Priority cao nh畉t, ti畉p theo l BDR
N畉u c湛ng priority? S畛 d畛ng Router ID.
Thay 畛i Priority
      (config-if)#ip ospf priority {0 - 255}
Ch炭 箪:
- Qu叩 tr狸nh th畛c hi畛n l畛a ch畛n DR v BDR s畉 動畛c th畛c hi畛n
ngay khi router 畉u ti棚n ch畉y ospf.
- Khi DR c l畛a ch畛n, n坦 ti畉p t畛c lm cho 畉n khi x畉y ra:
   + DR fail.
   + OSPF ko c嘆n ch畉y tr棚n DR fail.
   + Interface ang k畉t n畛i vo v湛ng m畉ng multiaccess ko
ch畉y.
Force Election DR/BDR

T畉t h畉t interface i r畛i m畛 l畉i
shutdown
no shutdown
Ch畛n router c坦 priority cao nh畉t 畉u ti棚n.
Redistributing an OSPF Default route

t動董ng t畛 RIPv2:
(config-router)#default-information originate

Detail:
O*E2 (External Type 2).
Type 2: metric kh担ng thay 畛i.
Type 1: c畛ng th棚m cost c畛a 動畛ng link.
Reference Bandwidth

C坦 th畛 tng s畛 tham chi畉u (10^8) l棚n:
(config-router)#auto-cost reference-bandwidth 10000 (Mbps)
Modifying OSPF Timers

(config-if)#ip ospf hello-interval seconds
(config-if)#ip ospf dead-interval seconds

C叩c gi叩 tr畛 timer gi畛a hai neighbor ph畉i gi畛ng nhau, 畛 畉m
b畉o 畛ng b畛 topology gi畛a 2 router.
C畉u h狸nh n但ng cao
Authentication

1. Clear Text
(config-if)#ip ospf authentication-key <password>

ip ospf authentication

2. MD5
(config-if)#ip ospf message-digest-key <key-id> md5 <key>

(config-if)#ip ospf authentication message-digest
Redistribution

Qu畉ng b叩 gi畛a c叩c giao th畛c 畛nh tuy畉n kh叩c nhau: RIPv2,
EIGRP, OSPF.
1. Qu畉ng b叩 EIGRP, OSPF vo RIP
router rip
   redistribute eigrp 100 metric 1
   redistribute ospf 1 metric 1
2. Qu畉ng b叩 RIP, OSPF --> EIGRP
router eigrp 100
   redistribute ospf 1 metric 100000 100 255 1 1500
   redistribute rip metric 100000 100 255 1 1500
3. Qu畉ng b叩 RIP, EIGRP --> OSPF
router ospf 1(m畉c 畛nh nh畉n vo l metric = 20)
   redistribute rip [subnets] [metric-type 1] [metric 30]
   redistribute eigrp 100 ....

More Related Content

OSPF

  • 2. Introduction Objectives: - N畉m r探 c叩c kh叩i ni畛m c董 b畉n c畛a giao th畛c OSPF - Hi畛u 動畛c ph動董ng ph叩p t狸m 動畛ng i c畛a OSPF - C畉u h狸nh c董 b畉n v n但ng cao.
  • 3. Introduction to OSPF OSPF l giao th畛c 動畛c s畛 d畛ng ph畛 bi畉n nh畉t. Vi畛c n畉m 動畛c n坦 l m畛t i畛u r畉t quan tr畛ng. G坦i tin OSPF: - Data Link Frame: - IP Packet: + 畛a ch畛 g畛i: multicast (224.0.0.5 (s畛 d畛ng cho all router) / 224.0.0.6 (s畛 d畛ng cho DR/BDR)). + Protocol Field = 89 - OSPF Packet Header: + Type code: Ch畛 ra lo畉i g坦i tin (Hello, Database Desc, Link state Request, Link state Upate, Stae Ack.) + Router ID & Area ID: Ph但n bi畛t gi畛a c叩c router v khu v畛c s畛 d畛ng.
  • 4. OSPF Packet Types 1. Hello: Ph叩t hi畛n v t叩i ph叩t hi畛n c叩c router hng x坦m, thi畉t l畉p m畛i quan h畛 adjacency. 2. Database Description (DBD): 畛ng b畛 c董 s畛 d畛 li畛u gi畛a c叩c router. Trong m畛t area, c叩c router ph畉i c坦 m畛t csdl (topology) gi畛ng h畛t nhau. 3. Link-state Request (LSR): Y棚u c畉u v畛 m畛t v湛ng m畉ng. 4. Link-state Update (LSD): g畛i tr畉 v竪 c叩c th担ng tin cho request ho畉c c畉p nh畉t s畛 thay 畛i trong v湛ng m畉ng. 5. Link-state Acknowledgement (LSAck): 畉m b畉o vi畛c truy畛n tin tin c畉y.
  • 5. Hello Packet - G坦i tin hello 動畛c trao 畛i gi畛a 2 con neighbor v畛i nhau tr動畛c khi thi畉t l畉p m畛i quan h畛 adjency. C叩c tr動畛ng th担ng tin: - Type: - Router ID: - Area ID: - Network Mask: subnet mask c畛a interface g畛i i - Hello Interval: 10s vs 30s - Router Priority: L畛a ch畛n router DR hay BDR trong c叩c v湛ng m畉ng Broadcast multiaccess. - Router Dead Interval: = 4 l畉n hello interval (t動董ng t畛 holdtime c畛a EIGRP). - Designated Router (DR): - Backup DR (BDR): - List of neighbor(s):
  • 6. Link-state Upade Packet LSU chia thnh 10 lo畉i g坦i tin kh叩c nhau, ph畛 thu畛c vo c叩c lo畉i router: Type Description 1 Router LSAs 2 Network LSA: g畛i b畛i router DR, li畛t k棚 c叩c router ID c畛a c叩c router trong v湛ng multiaccess. 3/4 Summary LSA: S畛 d畛ng 畛 c叩c router bi棚n, qu畉ng b叩 OSPF vo c叩c area kh叩c.
  • 7. C畉u h狸nh c董 b畉n OSPF
  • 8. OSPF Configuration R(config)#router ospf <proccess_ID> process_ID k担 c畉n ph畉i gi畛ng nhau. (kh叩c vs EIGRP) --> R(config-router)#network <network_address> <wildcard_mask> area <area_number> Trong gi叩o tr狸nh CCNA, ta s畛 d畛ng 董n v湛ng n棚n <area_number> = 0. Gi叩 tr畛 ny ph畉i chung nh畉t. VD: R(config)#router ospf 1 network 172.16.1.16 0.0.0.15 area 0 C嘆n m畛t vi c叩ch lm kh叩c: - Th畛c hi畛n summary lu担n c叩c v湛ng m畉ng sau 坦 qu畉ng b叩. - Ko quan t但m 畉n 畛a ch畛 c叩c interface: c但u l畛nh: network 0.0.0.0 255.255.255.255 area 0.
  • 9. C畉u h狸nh chu畉n Khuy畉n c叩o s畛 d畛ng c叩ch sau 但y: Ch畛 ra ch鱈nh x叩c 畛a ch畛 c畛a interface v wildcard mask = 0.0.0.0 --> Gi叩m s叩t 動畛c vi畛c ch畉y ospf tr棚n interface no. Ex: Router(config-router)#network 192.168.1.17 0.0.0.0 area 0
  • 10. Router ID S畛 d畛ng 畛nh danh cho c叩c router trong 1 area. - 畛 畛nh danh router id cho m畛t router s畛 d畛ng ospf, ta c坦 th畛 d湛ng c但u l畛nh router-id v畛i vi畛c s畛 d畛ng 1 d畉i ip 畛 畛nh danh: (config-router)#router-id 1.1.1.1 (example - n坦 ch畛 l 1 畛a ch畛). - Trong tr動畛ng h畛p tr棚n router ko thi畉t l畉p router id, router s畉 l畛a ch畛n interface loopback c坦 畛a ch畛 ip cao nh畉t lm router id (nh畛 l loopback nh辿 :D) --> khuy畉n ngh畛 - Trong tr動畛ng h董p ko s畛 d畛ng router id v loopback, n坦 s畉 l畉y 畛a ch畛 cao nh畉t c畛a interface m ang ho畉t 畛ng (active) lm router id (i畛u ny c坦 ngh挑a l interface 坦 ko nh畉t thi畉t xi OSPF).--> f動董ng f叩p ny k担 khuy畉n ngh畛, do c畛ng v畉t l箪 c坦 th畛 h畛ng.
  • 11. Ki畛m tra Router ID #show ip protocols Details: - Router ID 192.168.10.5 S畛 d畛ng Loopback lm ID: ch畛 c畉n t畉o ra loopback v g叩n 畛a ch畛 IP cho n坦. Ki畛m tra ho畉t 畛ng c畛a OSPF: #show ip ospf neighbor (Nh動 EIGRP) Details: Router ID Pri State Dead Time Address Interface (neighbor) (local)
  • 12. Ki畛m tra OSPF show ip ospf interface <type> <port> show ip route
  • 13. Metric c畛a OSPF Metric: cost 畛i v畛i c叩c router c畛a cisco, cost c t鱈nh d畛a tr棚n ngh畛ch 畉o c畛a bng th担ng. (10^8/bps) ex: Fast Ethernet 10^8/100,000,000 bps = 1 Ethernet 10^8/10,000,000 bps = 10. v.v...
  • 14. Default Bandwidth vs Actual Bandwidth - OSPF s畛 d畛ng bng th担ng m畉c 畛nh, n棚n c坦 th畛 t鱈nh to叩n sai so v畛i th畛c t畉. Do 坦 ta c畉n c畉u h狸nh l畉i. (config-if)#bandwidth 64 (kbps) ho畉c: (config-if)#ip ospf cost 1562 (t鱈nh to叩n d畛a tr棚n bandwidth). 担i khi trong th畛c t畉, ta l畉i mu畛n "b畉 cong" gi叩 tr畛 ny so vs th畛c t畉.
  • 16. OSPF Network Type - Point - to - Point - Broadcast Multiaccess - Nonbroadcast Multiaccess. VD: Frame Relay - Point - to - Multipoint - Virtual links.
  • 17. Challenges in multiaccess Network - Adjacency c坦 j kh叩c neighbors? DR v BDR. Trong v湛ng m畉ng multiaccess s畉 b畉u ch畛n ra m畛t router l DR, m畛t router s畉 l BDR. DR v BDR s畉 thi畉t l畉p adjacency v畛i t畉t c畉 router c嘆n l畉i. Sending & Receiving LSA
  • 18. DR/BDR Election L畛a ch畛n DR/BDR nh動 th畉 no? - DR 動畛c l畉y t畛 router c坦 Priority cao nh畉t, ti畉p theo l BDR N畉u c湛ng priority? S畛 d畛ng Router ID. Thay 畛i Priority (config-if)#ip ospf priority {0 - 255} Ch炭 箪: - Qu叩 tr狸nh th畛c hi畛n l畛a ch畛n DR v BDR s畉 動畛c th畛c hi畛n ngay khi router 畉u ti棚n ch畉y ospf. - Khi DR c l畛a ch畛n, n坦 ti畉p t畛c lm cho 畉n khi x畉y ra: + DR fail. + OSPF ko c嘆n ch畉y tr棚n DR fail. + Interface ang k畉t n畛i vo v湛ng m畉ng multiaccess ko ch畉y.
  • 19. Force Election DR/BDR T畉t h畉t interface i r畛i m畛 l畉i shutdown no shutdown Ch畛n router c坦 priority cao nh畉t 畉u ti棚n.
  • 20. Redistributing an OSPF Default route t動董ng t畛 RIPv2: (config-router)#default-information originate Detail: O*E2 (External Type 2). Type 2: metric kh担ng thay 畛i. Type 1: c畛ng th棚m cost c畛a 動畛ng link.
  • 21. Reference Bandwidth C坦 th畛 tng s畛 tham chi畉u (10^8) l棚n: (config-router)#auto-cost reference-bandwidth 10000 (Mbps)
  • 22. Modifying OSPF Timers (config-if)#ip ospf hello-interval seconds (config-if)#ip ospf dead-interval seconds C叩c gi叩 tr畛 timer gi畛a hai neighbor ph畉i gi畛ng nhau, 畛 畉m b畉o 畛ng b畛 topology gi畛a 2 router.
  • 24. Authentication 1. Clear Text (config-if)#ip ospf authentication-key <password> ip ospf authentication 2. MD5 (config-if)#ip ospf message-digest-key <key-id> md5 <key> (config-if)#ip ospf authentication message-digest
  • 25. Redistribution Qu畉ng b叩 gi畛a c叩c giao th畛c 畛nh tuy畉n kh叩c nhau: RIPv2, EIGRP, OSPF. 1. Qu畉ng b叩 EIGRP, OSPF vo RIP router rip redistribute eigrp 100 metric 1 redistribute ospf 1 metric 1 2. Qu畉ng b叩 RIP, OSPF --> EIGRP router eigrp 100 redistribute ospf 1 metric 100000 100 255 1 1500 redistribute rip metric 100000 100 255 1 1500 3. Qu畉ng b叩 RIP, EIGRP --> OSPF router ospf 1(m畉c 畛nh nh畉n vo l metric = 20) redistribute rip [subnets] [metric-type 1] [metric 30] redistribute eigrp 100 ....

Editor's Notes

  • #6: 畛 畉m b畉o 2 con router l hng x坦m th狸 g坦i tin Hello 畛 2 con ph畉i c坦 nh畛ng tr動畛ng sau 但y l gi畛ng nhau: - Area ID; - Authentication type; - Network Mask: - Hello Interval ; - Router Dead Interval; - Router hi畛n t畉i f畉i th畉y m狸nh trong list of neighbor c畛a router hng x坦m. Ch炭 箪: Ch畛 c畉n sai kh叩c m畛t trong s畛 c叩c th担ng s畛 ny l ch畛u ch畉t!
  • #7: Trong OSPF, ta c坦 Area Backbone, c叩c area kh叩c s畉 k畉t n畛i v畛i area ny. Do 坦 t畛n t畉i kh叩c nhi畛u lo畉i router kh叩c nhau.
  • #9: T畉i sao l畉i l wildcard mask?