OSPF CƠ BẢN
Transcript of OSPF CƠ BẢN
-
8/7/2019 OSPF C BN
1/11
OSPF C BNI. Gii thiu- OSPF L giao thc nh tuyn nhm link-state, thng c trin khai trong cc hthng mng phc tp. Giao thc OSPF t xy dng nhng c ch ring cho mnh ,t bo
m nhng quan h ca chnh mnh vi cc router khc. N c th d tm nhanh chng sthay ca topology (cng nh li ca cc interface ) v tnh ton li nhng route mi sauchu k hi t. Chu k hi t ca OSPF rt ngn v cng tn rt t lu lng ng truyn.- OSPF kh thun tin v ph bin v cc tnh nng ca mnh v v n l chun m trongthc t OSPF c s dng kh nhiu trong cc m hnh mng va v ln. Nhc imca giao thc ny l B vi l ca Router phi mnh cng nh cc yu cu v phn cngkhc kh cao.II. M hnh
III. Yu cu1. Cu hnh khi to cho cc thit b mng.- t tn- cu hnh Banner mote- cu hnh password cho console, telnet, Privileged.Password console:itnPassword telnet:itnPassword Privileged: itn2. Cu hnh cc interface ca router.
- cu hnh a ch IP- cu hnh description- cu hnh enable cc interface3. Cu hnh nh tuyn- cu hnh nh tuyn dng OSPF- khi to giao thc nh tuyn OSPF- xc nh cc mng connect v cac area
-
8/7/2019 OSPF C BN
2/11
-
8/7/2019 OSPF C BN
3/11
Router1(config-if)#ip address 192.168.2.1 255.255.255.0
Router1(config-if)#description ket noi toi router 2
Router1(config-if)#clock rate 64000
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#interface fastEthernet 2/0
Router1(config-if)#ip address 192.168.1.1 255.255.255.0
Router1(config-if)#description ket noi toi lan
Router1(config-if)#no sh
Router1(config-if)#exit1.1.2 Router 2
- Cu hnh t tnRouter>enableRouter#configure terminal
Router(config)#hostname Router2
Router2(config)#- cu hnh Banner mote Router2(config)#banner motd " Router_2 "- cu hnh console
Router2(config)#line console 0Router2(config-line)#password itn
Router2(config-line)#login
Router2(config-line)#exit- cu hnh telnetRter2(config)#line vty 0 4
Router2(config-line)#password itn
Router2(config-line)#login
Router2(config-line)#exit- cu hnh password privilegedRouter2(config)#enable secret itn- Cu hnh cc interface ca routerRouter2(config)#interface serial 1/0
-
8/7/2019 OSPF C BN
4/11
Router2(config-if)#ip address 192.168.2.2 255.255.255.0
Router2(config-if)#description ket noi toi router 1
Router2(config-if)#clock rate 64000
Router2(config-if)#no shutdown
Router2(config-if)#exit
Router2(config)#interface fastEthernet 2/0
Router2(config-if)#ip address 192.168.3.1 255.255.255.0
Router2(config-if)#description ket noi toi lan
Router2(config-if)#no sh
Router2(config-if)#exit
1.2 Kim tra cc tuyn trong bng nh tuyn ca cc Router trc khi cu hnh nhtuyn
Router1- Kim tra trng thi v a ch IP ca cc interface s dng cu lnhRouter1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
Serial1/0 192.168.2.1 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
FastEthernet2/0 192.168.1.1 YES manual up up
- kim tra xem cc cu hnh bn trn ng cha s dng cu lnhRouter1#show running-config
Building configuration...
Current configuration : 898 bytes
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
hostname Router1
boot-start-marker
boot-end-marker
!
enable secret itn
interface Serial1/0
description Ket noi toi Router2
-
8/7/2019 OSPF C BN
5/11
ip address 192.168.2.1 255.255.255.0
serial restart-delay 0
clock rate 64000
interface FastEthernet2/0
description Ket noi toi Lan
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
no keepalive
line con 0
line aux 0
line vty 0 4
password itn
login
!end.- kim tra bng nh tuyn s dng Router1# show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet2/0
C 192.168.2.0/24 is directly connected,Serial1/0
//hin thi trong bng nh tuyn ch c hai mng connect c k hiu l ch C trong bngnh tuyn mng 192.168.3.0/24 cha c trong bng nh tuyn v cha c giao thc nh tuynno c Enable trong mng.Kim tra tng t i vi Router2
-
8/7/2019 OSPF C BN
6/11
2. Cu hnh nh tuyn s dng OSPF2.1 Router1khi to giao thc inh tuyn ospfRouter1(config)#ospf 100
qung b cc mng connectRouter1(config-router)#network 192.168.1.0 0.0.0.255 area 1
Router1(config-router)#network 192.168.2.0 0.0.0 255 area 0
Router1(config-router)#exit2.2 Router2khi to giao thc inh tuyn ospfRouter2(config)#router ospf 100qung b cc mng connect
Router2(config-router)#network 192.168.3.0 0.0.0.255 area 2Router2(config-router)#network 192.168.2.0 0.0.0.255 area 0
Router2(config-router)#end//khi qung b cc mng connect ch cc area khc 0 cn kt ni trc tip n area 0 cn goi larea Backbone cc router gia hai area l router boder n c thng tin nh tuyn ca c haiarea3. Kim tra nh tuyn
3.1 kim tra neighbor- kim tra xem hai Router thit lp neighbor vi nhau cha ta s dng cu lnh:3.1.1 Router1Router1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.1 0 FULL/ - 00:00:38 192.168.2.2 Serial1/03.1.2 Router2Router2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.2.1 0 FULL/ - 00:00:31 192.168.2.1 Serial1/0- trn cho thy hai Router thit lp Neighbor vi nhau tip theo ta kim tra n qutrnh nh tuyn.
-
8/7/2019 OSPF C BN
7/11
3.2 Kim tra bng nh tuyn3.2.1 Router1- Sau khi qu trnh inh tuyn hon tt cc ng i n cc mng khng connect s clu trong bng nh tuyn vi k t l ch O:Router1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet2/0
C 192.168.2.0/24 is directly connected, Serial1/0
O IA 192.168.3.0/24 [110/65] via 192.168.2.2, 00:00:15, Serial1/0 //Sau khi c cu hnh nh tuyn ng i ti mng 192.168.3.0/24 c trong bng nhtuyn vi k t trong bng nh tuyn l ch O.Tng t i vi Router2
3.3 Kim tra thng mng- ng t cc lan ping sang cc mng khng connect va kim tra kt qu3.3.1 ng trn Router1Router1#ping 192.168.3.0Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.0, timeout is 2 seconds:
.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 288/746/1848 ms 3.3.2 ng trn Router2Router2#ping 192.168.1.0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.0, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 332/588/1248 ms
-
8/7/2019 OSPF C BN
8/11
- Dng lnh clear ip route * xo ton b route t bng nh tuyn.Router1# clear ip route *- Dng lnh clear ip ospf process hoc reload kch hot li qu trnh nh tuyn ospf. Router1#clear ip ospf process
4 cu hnh Authentication- OSPF h tr Authentication v Authentication c t trn cc interface khi cu hnhchng thc th c th bt tay v xy dng bng inh tuyn cc interface phi c cuhnh Authentication ng b password v encapsulation vi nhau, vic ny ng vai trquan trng trong v vn bo mt cho mng.Trn Router1- Cu hnh:Router1(config-if)#interface Serial 1/0
Router1(config-if)#ip ospf authenticationRouter1(config-if)#ip ospf authentication-key itn
- Kim traNgay sau khi cu hnh Authentication trn Router1 hai router s khng cn c th bt taythit lp neighbor c na .Router1#show ip ospf neighbor
Router1#*Mar 1 23 11.154: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.3.1 on
Serial1/0 from FULL to DOWN, Neighbor Down: Dead timer expired
- Tin hnh cu lnh Debug ip ospf events kim tra nguyn nhn .Router1#debug ip ospf events
OSPF events debugging is on
Router1#
*Mar 1 23 50.434: OSPF: Rcv pkt from 192.168.2.2, Serial1/0 : Mismatch Authentication
type. Input packet specified type 0, we use type 1
*Mar 1 23 51.682: OSPF: Send hello to 224.0.0.5 area 1 on FastEthernet2/0 from
192.168.1.1
*Mar 1 23 52.750: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from 192.168.2.1
*Mar 1 23 00.518: OSPF: Rcv pkt from 192.168.2.2, Serial1/0 : Mismatch Authentication
type. Input packet specified type 0, we use type 1
*Mar 1 23 01.686: OSPF: Send hello to 224.0.0.5 area 1 on FastEthernet2/0 from
192.168.1.1
*Mar 1 23 02.754: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from
-
8/7/2019 OSPF C BN
9/11
192.168.2.1ungdeb all
// Cu lnh Debug cho thy hai Router khng th thit lp neighbor l v qu trnh Authenticationkhng c match vi nhau. hai Router c th thit lp li neighbor v hon thnh qu trnhnh tuyn ta cn phi cu hnh Authentication trn Router2
4.3 Trn Router2// khi cu hnh authentication trong ospf cn ch qu trnh bt tay gia hai router hon thnhth password v encapsulation cn ging nhau.- Cu hnhRouter1(config-if)#interface Serial 1/0
Router2(config-if)#ip ospf authentication
Router2(config-if)#ip ospf authentication-key itn
- Kim traSau khi cu hnh Authentication trn Router2 tin hnh kim tra cc gi tin bng cu lnhDebug ip ospf eventsRouter1#debug ip ospf events
OSPF events debugging is on
Router1#
*Mar 1 23 11.806: OSPF: Send hello to 224.0.0.5 area 1 on FastEthernet2/0 from
192.168.1.1
*Mar 1 23 12.782: OSPF: Send hello to 224.0.0.5 area 0 on Serial1/0 from 192.168.2.1
*Mar 1 23 13.482: OSPF: Rcv hello from 192.168.3.1 area 0 from Serial1/0 192.168.2.2
*Mar 1 23 13.486: OSPF: End of hello processing// trn cho thy qu trnh gi gi tin thit lp neighbor hon thnh tip tuc kim tra neighborca hai Router vi cu lnh Show ip ospf neighborRouter1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.1 0 FULL/ - 00:00:30 192.168.2.2 Serial1/0
Router2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.2.1 0 FULL/ - 00:00:32 192.168.2.1 Serial1/0
- nh vy sau khi tin hnh cu hnh ng nht Authentication trn c hai Router hai
-
8/7/2019 OSPF C BN
10/11
Router thit lp neighbor tr li vi nhau. By gi th kim tra bng nh tuyn vi culnhShow ip RouteRouter1Router1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet2/0
C 192.168.2.0/24 is directly connected, Serial1/0
O IA 192.168.3.0/24 [110/65] via 192.168.2.2, 00:00:15, Serial1/0 Trn Router2Router2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O IA 192.168.1.0/24 [110/65] via 192.168.2.1, 00:01:04, Serial1/0
C 192.168.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, FastEthernet2/0// mng nh tuyn bnh thng chng t Authentication hon tt ta tin hnh lu cu hnhvo NVRam.V. lu cu hnh vo NVRamSau khi mi cu hnh hon tt tin hnh lu cu hnh hin thi vo NVRam
-
8/7/2019 OSPF C BN
11/11
Router1#copy running-config startup-config
Router1#copy running-config startup-config