You are on page 1of 52

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Chng 3 -

OSPF Open Shortest Path First

Bi 3.1 Single-Area OSPF Link Costs v Interface Priorities 3.1.1 S lun l

Lo0 S0/3/1
.0 / 24

R2 Fa0/0

10 .1

.1

00

10.1.200.0/24

S0/3/0 Gi0/0 Fa0/0

R1 Lo0 10.1.1.0/24

10.2.2.0/24

R3 Lo0 10.3.3.0/24

Hnh 3.1.1-1: Hnh v s lun l

3.1.2

Mc tiu ca bi thc hnh Cu hnh OSPF n vng, chnh sa gi tr cost trn link Xt u tin trn cc interface ca cc router ospf xem xt qu trnh bnh chn DR v BDR

3.1.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn cho R1, R2, R3

72

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1 Router(config)#hostname R1 R1(config)#enable password cisco R1(config)#no ip domain-lookup R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/3/0 R1(config-if)#ip address 10.1.100.1 255.255.255.0 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface gigabitEthernet 0/0 R1(config-if)#ip address 10.1.200.1 255.255.255.0 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4 R2(config-line)# password cisco R2(config-line)# login R2(config)#interface serial 0/3/1 R2(config-if)#ip address 10.1.100.2 255.255.255.0

73

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface fastEthernet 0/0 R2(config-if)#ip address 10.1.200.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 10.2.2.2 255.255.255.0 R2(config-if)#exit R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)#interface fastEthernet 0/0 R3(config-if)#ip address 10.1.200.3 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)# ip address 10.3.3.3 255.255.255.0 R3(config-if)#exit Bc 2: Cu hnh single-area OSPF trn router Cu hnh single area OSPF trn R1 R1(config)#interface loopback 0 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#network 10.1.100.1 0.0.0.0 area 0 R1(config-router)#network 10.1.1.1 0.0.0.0 area 0 R1(config-router)#exit Cu hnh single area OSPF trn R2
74

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config)#interface loopback 0 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#network 10.1.100.2 0.0.0.0 area 0 R2(config-router)#network 10.2.2.2 0.0.0.0 area 0 R2(config-router)#exit Cu hnh single area OSPF trn R3 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#network 10.3.3.3 0.0.0.0 area 0 R3(config-router)#exit Bc 3: Qung b cc fast-ethernet interfaces vo OSPF. Cu hnh trn R1 R1(config)#router ospf 1 R1(config-router)#network 10.1.200.1 0.0.0.0 area 0 R1(config-router)#exit Cu hnh trn R2 R2(config)#router ospf 1 R2(config-router)#network 10.1.200.2 0.0.0.0 area 0 R2(config-router)#exit Cu hnh trn R3 R3(config)#router ospf 1 R3(config-router)#network 10.1.200.3 0.0.0.0 area 0 R3(config-router)#exit Bc 4: Kiem tra OSPF adjacencies.

Hnh 3.1.3-1: Show ip ospf neighbor trn R1

Hnh 3.1.3-2: Show ip ospf neighbor trn R2

75

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.1.3-3: Show ip ospf neighbor trn R3

Bc 5 : Kiem tra OSPF routing information exchange.

Hnh 3.1.3-4: Show ip route trn R1

Hnh 3.1.3-5: Show ip route trn R2

Hnh 3.1.3-6: Show ip route trn R3

76

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bc 6 : Modify OSPF link costs. Chnh s cost trn R1 R1(config)#interface gigabitEthernet 0/0 R1(config-if)#ip ospf cost 50 R1(config-if)#exit Chnh s cost trn R2 R2(config)#interface fastEthernet 0/0 R2(config-if)#ip ospf cost 50 R2(config-if)#exit Chnh s cost trn R3 R3(config)#interface fastEthernet 0/0 R3(config-if)#ip ospf cost 50 R3(config-if)#exit Kim tra cu hnh

Hnh 3.1.3-7: Show ip route sau khi modify cost trn R1

Hnh 3.1.3-8: Show ip route sau khi modify cost trn R2

77

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.1.3-9: Show ip route sau khi modify cost trn R3

Bc 7 : Change interface priorities. Kim tra trc cu hnh

Hnh 3.1.3-10: Show ip ospf detail ca neighbor 10.2.2.2 trn R1

Hnh 3.1.3-11: Show ip ospf detail ca neighbor 10.3.3.3 trn R1

78

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.1.3-12: Show ip ospf interface trn R1

Hnh 3.1.3-13: Show ip ospf interface trn R2

Hnh 3.1.3-14: Show ip ospf interface trn R3

79

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Cu hnh trn R1 R1(config)#interface gigabitEthernet 0/0 R1(config-if)#ip ospf priority 10 R1(config-if)#exit Cu hnh trn R3 R3(config)#interface fastEthernet 0/0 R3(config-if)#ip ospf priority 5 R3(config-if)#exit Kim tra cu hnh

Hnh 3.1.3-15: Show ip ospf interface trn R1 sau khi sa priority

Hnh 3.1.3-16: Show ip ospf interface trn R2 sau khi sa priority

80

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.1.3-17: Show ip ospf interface trn R3 sau khi sa priority

81

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bi 3.2 Multi-Area OSPF with Stub Areas and Authentication 3.2.1 S lun l

Lo0 R2 S0/3/1 S0/3/0

/2

00 .0

10.2.2.0/24
10 20 .1 .
Area 0

10

.1

.1

0 .0

Lo1 : 172.16.10.0/24

Area 10 NSSA S0/3/0

/2 4
S0/0/1 R3 Lo0 10.3.3.0/24

R1

Lo0: 10.1.1.0/24

Hnh 3.2.1-1: Hnh v s lun l

3.2.2

Mc tiu bi thc hnh Thc thi OSPF a vng Cu hnh cc kiu Stub Areas trong OSPF Chng thc trong OSPF gia R1 v R2

3.2.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn R1, R2, R3

R1 Router(config)#hostname R1 R1(config)#enable password cisco R1(config)#no ip domain-lookup


82

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/3/0 R1(config-if)#ip address 10.1.100.1 255.255.255.0 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)#exit R1(config)#interface loopback 1 R1(config-if)#ip address 172.16.10.1 255.255.255.0 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4 R2(config-line)# password cisco R2(config-line)# login R2(config)#interface Serial 0/3/0 R2(config-if)#ip address 10.1.200.1 255.255.255.0 R2(config-if)#clock rate 64000 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface serial 0/3/1 R2(config-if)#ip address 10.1.100.2 255.255.255.0

83

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 10.2.2.2 255.255.255.0 R2(config-if)#exit R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)#interface Serial 0/0/1 R3(config-if)#ip address 10.1.200.2 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)# ip address 10.3.3.3 255.255.255.0 R3(config-if)#exit Bc 2: Cu hnh Ospf trn cc router. Cu hnh OSPF trn R1 R1(config)#interface loopback 0 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 10.1.1.1 R1(config-router)#network 10.1.100.1 0.0.0.0 area 10 R1(config-router)#network 10.1.1.1 0.0.0.0 area 10 R1(config-router)#exit Cu hnh OSPF trn R2 R2(config)#interface loopback 0 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit
84

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config)#router ospf 1 R2(config-router)#router-id 10.2.2.2 R2(config-router)#network 10.1.100.2 0.0.0.0 area 10 R2(config-router)#network 10.1.200.1 0.0.0.0 area 0 R2(config-router)#network 10.2.2.2 0.0.0.0 area 0 R2(config-router)#exit Cu hnh OSPF trn R3 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 10.3.3.3.3 R3(config-router)#network 10.1.200.2 0.0.0.0 area 0 R3(config-router)#network 10.3.3.3 0.0.0.0 area 0 R3(config-router)#exit Bc 3: Kiem tra multiple-area behavior.

Hnh 3.2.3-1: Show ip route ospf trn R1

Hnh 3.2.3-2: Show ip route ospf trn R2

Hnh 3.2.3-3: Show ip route ospf trn R3

Bc 4: Cu hnh OSPF stub, totally stubby, and not-so-stubby areas. Cu hnh Stub Area v kim tra R1(config)#router ospf 1 R1(config-router)#area 10 stub R1(config-router)#exit R2(config)#router ospf 1 R2(config-router)#area 10 stub R2(config-router)#exit

85

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.2.3-4: Show ip ospf trn R1

Hnh 3.2.3-5: Show ip route ospf trn R1

Cu hnh Totally Stubby Area v kim tra R2(config)#router ospf 1 R2(config-router)#area 10 stub no-summary R2(config-router)#exit

Hnh 3.2.3-6: Show ip ospf database trn R1

Hnh 3.2.3-7: Show ip route ospf trn R1

Cu hnh Not-So-Stubby Area (NSSA) v kim tra R1(config)#router ospf 1 R1(config-router)#no area 10 stub R1(config-router)#area 10 nssa R1(config-router)#redistribute connected subnets R1(config-router)#exit

86

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config)#router ospf 1 R2(config-router)#no area 10 stub R2(config-router)#area 10 nssa R2(config-router)#area 10 nssa default-information-originate R2(config-router)#exit

Hnh 3.2.3-8: Show ip route ospf trn R1

Hnh 3.2.3-9: Show ip ospf trn R2

Hnh 3.2.3-10: Show ip route ospf trn R2

Hnh 3.2.3-11: Show ip route ospf trn R3

Bc 5: Cu hnh authentication. R1(config)#interface serial 0/3/0 R1(config-if)#ip ospf authentication message-digest R1(config-if)#ip ospf message-digest-key 1 md5 cisco R1(config-if)#exit R2(config)#interface S0/3/1

87

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#ip ospf authentication message-digest R2(config-if)#ip ospf message-digest-key 1 md5 cisco R2(config-if)#exit

Hnh 3.2.3-12: Show ip ospf interface Serial 0/3/0 trn R1

Hnh 3.2.3-13: Show ip ospf interface Serial 0/3/1 trn R2

88

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bi 3.3 Virtual Links v Area Summarization 3.3.1 S lun l

10.2.2.0/24

Lo0 R2 S0/3/1 S0/3/0 Area 10


17 2.1

6 .1

.0/ 3

Area 0
2 .1

6 .2 .0 /

17

30

S0/3/0 10.1.1.0/24 Lo0 R1 Lo1

S0/0/1 Lo0 R3 Area 20 10.3.3.0/24

Internet 172.30.30.0/30

Lo1 : 192.168.10.0/24 Lo2 : 192.168.20.0/24 Lo3 : 192.168.30.0/24

Hnh 3.3.1-1: Hnh v s lun l

3.3.2

Mc tiu bi thc hnh Cu hnh OSPF virtual link Summarize mt area v Phn phi mt default route vo OSPF

3.3.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn R1, R2, R3

R1 Router(config)#hostname R1 R1(config)#enable password cisco R1(config)#no ip domain-lookup

89

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/3/0 R1(config-if)#ip address 172.16.1.1 255.255.255.252 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)#exit R1(config)#interface loopback 1 R1(config-if)#ip address 172.30.30.1 255.255.255.252 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4 R2(config-line)# password cisco R2(config-line)# login R2(config)#interface Serial 0/3/0 R2(config-if)#ip address 172.16.2.1 255.255.255.252 R2(config-if)#clock rate 64000 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface serial 0/3/1 R2(config-if)#ip address 172.16.1.2 255.255.255.252

90

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 10.2.2.2 255.255.255.0 R2(config-if)#exit R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)#interface Serial 0/0/1 R3(config-if)#ip address 172.16.2.2 255.255.255.252 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)# ip address 10.3.3.3 255.255.255.0 R3(config-if)#exit R3(config)#interface loopback 1 R3(config-if)# ip address 192.168.10.1 255.255.255.0 R3(config-if)#exit R3(config)#interface loopback 2 R3(config-if)# ip address 192.168.20.1 255.255.255.0 R3(config-if)#exit R3(config)#interface loopback 3 R3(config-if)# ip address 192.168.30.1 255.255.255.0 R3(config-if)#exit Bc 2: Cu hnh multi-area OSPF on a router. Cu hnh OSPF trn R1 R1(config)#interface loopback 0 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit
91

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1(config)#interface loopback 1 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 10.1.1.1 R1(config-router)#network 172.16.1.1 0.0.0.0 area 0 R1(config-router)#network 10.1.1.1 0.0.0.0 area 0 R1(config-router)#exit Cu hnh OSPF trn R2 R2(config)#interface loopback 0 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 10.2.2.2 R2(config-router)#network 172.16.1.2 0.0.0.0 area 0 R2(config-router)#network 172.16.2.1 0.0.0.0 area 10 R2(config-router)#network 10.2.2.2 0.0.0.0 area 0 R2(config-router)#exit Cu hnh OSPF trn R3 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#interface loopback 1 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#interface loopback 2 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#interface loopback 3 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 10.3.3.3.3 R2(config-router)#network 172.16.2.2 0.0.0.0 area 10 R3(config-router)#network 10.3.3.3 0.0.0.0 area 10 R3(config-router)#network 192.168.10.1 0.0.0.0 area 20 R3(config-router)#network 192.168.20.1 0.0.0.0 area 20 R3(config-router)#network 192.168.30.1 0.0.0.0 area 20 R3(config-router)#exit

92

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bc 3: to mt OSPF virtual link. R2(config)#router ospf 1 R2(config-router)#area 10 virtual-link 10.2.2.2 R2(config-router)#exit R3(config)#router ospf 1 R3(config-router)#area 10 virtual-link 10.2.2.2 R3(config-router)#exit

Hnh 3.3.3-1: Show ip ospf interface trn R2

Hnh 3.3.3-2: Show ip route ospf trn R2

Bc 4: Summarize mt area. R3(config)#router ospf 1 R3(config-router)#area 20 range 192.168.0.0 255.255.224.0 R3(config-router)#exit

Hnh 3.3.3-3: Show ip route ospf trn R2

93

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.3.3-4: Show ip route ospf trn R3

Bc 5: Phn phi mt default route vo OSPF. R1(config)#router ospf 1 R1(config-router)#default-information originate always R1(config-router)#exit

Hnh 3.3.3-5: Show ip route trn R2

Hnh 3.3.3-6: Show ip route trn R3

94

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bi 3.4 OSPF over Frame Relay 3.4.1 S lun l


10.1.1.0/24 Lo0 R1 .1 S0/3/1

103

102

S0/0 FR S0/2 301 .2 S0/3/0 172.16.1.0/24 201 .3 S0/0/0

S0/1

R2 Lo0 10.1.2.0/24
Hnh 3.4.1-1: Hnh v s lun l

R3 Lo0 10.1.3.0/24

3.4.2

Mc tiu bi thc hnh Thc thi OSPF trn mi trng Frame Relay

3.4.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn R1, R2, R3. Cu hnh Frame Relay

R1 Router(config)#hostname R1 R1(config)#enable password cisco

95

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1(config)#no ip domain-lookup R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/3/1 R1(config-if)#encapsulation frame-relay R1(config-if)#ip address 172.16.1.1 255.255.255.0 R1(config-if)#frame-relay map ip 172.16.1.2 102 R1(config-if)#frame-relay map ip 172.16.1.3 103 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4 R2(config-line)# password cisco R2(config-line)# login R2(config)#interface serial 0/3/0 R2(config-if)#encapsulation frame-relay R2(config-if)#ip address 172.16.1.2 255.255.255.0 R2(config-if)#frame-relay map ip 172.16.1.1 201 R2(config-if)#frame-relay map ip 172.16.1.3 201 R2(config-if)#clock rate 64000 R2(config-if)#no shutdown

96

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 10.2.2.2 255.255.255.0 R2(config-if)#exit R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)#interface Serial 0/0/0 R3(config-if)#encapsulation frame-relay R3(config-if)#ip address 172.16.1.3 255.255.255.0 R3(config-if)#frame-relay map ip 172.16.1.1 301 R3(config-if)#frame-relay map ip 172.16.1.2 301 R3(config-if)#clock rate 64000 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)# ip address 10.3.3.3 255.255.255.0 R3(config-if)#exit FR Router(config)#hostname FR FR (config)#enable password cisco FR (config)#no ip domain-lookup FR (config)#banner motd ^C R3^C FR (config)#line console 0 FR (config-line)# logging synchronous FR (config-line)# password cisco FR (config-line)# login FR (config)#line vty 0 4 FR (config-line)# password cisco FR (config-line)# login

97

Gio trnh thc hnh BSCI

Chng 3 - OSPF

FR(config)#frame-relay switching FR(config)#interface Serial 0/0 FR(config-if)#encapsulation frame-relay FR(config-if)#frame-relay intf-type dce FR(config-if)#frame-relay route 102 interface Serial 0/1 201 FR(config-if)#frame-relay route 103 interface Serial 0/2 301 FR(config-if)#clock rate 64000 FR(config-if)#no shutdown FR(config-if)#exit FR(config)#interface Serial 0/1 FR(config-if)#encapsulation frame-relay FR(config-if)#frame-relay intf-type dce FR(config-if)#frame-relay route 201 interface Serial 0/0 102 FR(config-if)#no shutdown FR(config-if)#exit FR(config)#interface Serial 0/2 FR(config-if)#encapsulation frame-relay FR(config-if)#frame-relay intf-type dce FR(config-if)#frame-relay route 301 interface Serial 0/0 103 FR(config-if)#no shutdown FR(config-if)#exit Bc 2: Cu hnh OSPF trn FR Cu hnh OSPF trn R1 R1(config)#interface loopback 0 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#network 172.16.1.1 0.0.0.0 area 0 R1(config-router)#network 10.1.1.1 0.0.0.0 area 0 R1(config-router)#neighbor 172.16.1.2 R1(config-router)#neighbor 172.16.1.3 R1(config-router)#exit Cu hnh OSPF trn R2 R2(config)#interface loopback 0 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#network 172.16.1.2 0.0.0.0 area 0
98

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-router)#network 10.2.2.2 0.0.0.0 area 0 R2(config-router)#neighbor 172.16.1.1 R2(config-router)#exit Cu hnh OSPF trn R3 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#network 172.16.1.3 0.0.0.0 area 0 R3(config-router)#network 10.3.3.3 0.0.0.0 area 0 R3(config-router)#neighbor 172.16.1.1 R3(config-router)#exit Kim tra cu hnh OSPF trn Frame Relay

Hnh 3.4.3-1: Show ip ospf neighbor trn R1

Hnh 3.4.3-2: Show ip route trn R1

99

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.4.3-3: Show ip ospf interface trn R1

Hnh 3.4.3-4: Show ip ospf neighbor trn R2

Hnh 3.4.3-5: Show ip route trn R2

Hnh 3.4.3-6: Show ip ospf interface trn R2

100

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.4.3-7: Show ip ospf neighbor trn R3

Hnh 3.4.3-8: Show ip route trn R3

Hnh 3.4.3-9: Show ip ospf interface trn R3

Bc 3: Dng broadcast v point-to-multipoint OSPF network types Cu hnh dng point-to-multipoint OSPF network type trn R1 R1(config)#interface Serial 0/3/1 R1(config-if)#frame-relay map ip 172.16.1.2 102 broadcast R1(config-if)#frame-relay map ip 172.16.1.3 103 broadcast R1(config-if)#ip ospf network point-to-multipoint R1(config-if)#exit Cu hnh dng point-to-multipoint OSPF network type trn R2 R2(config)#interface Serial 0/3/0 R2(config-if)#frame-relay map ip 172.16.1.1 201 broadcast R2(config-if)#frame-relay map ip 172.16.1.3 201 broadcast R2(config-if)#ip ospf network point-to-multipoint

101

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#exit Cu hnh dng point-to-multipoint OSPF network type trn R3 R3(config)#interface Serial 0/0/0 R3(config-if)#frame-relay map ip 172.16.1.1 301 broadcast R3(config-if)#frame-relay map ip 172.16.1.2 301 broadcast R3(config-if)#ip ospf network point-to-multipoint R3(config-if)#exit

Hnh 3.4.3-10: Show ip ospf interface trn R1

Hnh 3.4.3-11: Show ip ospf interface trn R2

102

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.4.3-12: Show ip ospf interface trn R3

103

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bi 3.5 OSPF Network non-Broadcast 3.5.1 S lun l

Lo0: 172.16.2.1/24 S0/0 R2 S0/1 172.16.23.0/24 S0/1 R3 S0/0

Lo0: 172.16.3.1/24

172.16.12.0/24

OSPF Area 0

172.16.34.0/24

OSPF Area 34

Lo0: 172.16.1.1/24

S0/0 R1

S0/1 R4 Lo0: 172.16.4.1/24

OSPF Area 40

Hnh 3.5.1-1: Hnh v s lun l

3.5.2

Mc tiu cu hnh Tt c cc router phi tham gia vo OSPF. Khng s dng static routes, default routes, hoc giao thc nh tuyn khc. Tt c cc IP trong topology phi ping c vi nhau Cc OSPF network type gia R2 v R3 l nonbroadcast.

3.5.3

Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn cho R1, R2, R3, R4


104

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1 Router(config)#hostname R1 R1(config)#enable password cisco R1(config)#no ip domain-lookup R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/0 R1(config-if)#ip address 172.16.12.1 255.255.255.0 R1(config-if)#bandwidth 64 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 172.16.1.1 255.255.255.0 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4 R2(config-line)# password cisco R2(config-line)# login R2(config)# interface Loopback0 R2(config-if)# ip address 172.16.2.1 255.255.255.0 R2(config-if)#end R2(config)# interface Serial0/1 R2(config-if)# ip address 172.16.12.2 255.255.255.0

105

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-if)#bandwidth 64 R2(config-if)#end R2(config)# interface Serial0/0 R2(config-if )ip address 172.16.23.2 255.255.255.0 R2(config-if)#bandwidth 64 R2(config-if)#clock rate 64000 R2(config-if)#end R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)# interface Loopback0 R3(config-if)# ip address 172.16.3.1 255.255.255.0 R3(config-if)#end R3(config)# interface Serial0/1 R3(config-if)# ip address 172.16.23.3 255.255.255.0 R3(config-if)#bandwidth 64 R3(config-if)#end R3(config)# interface Serial0/0 R3(config-if ) ip address 172.16.34.3 255.255.255.0 R3(config-if)#bandwidth 64 R3(config-if)#clock rate 64000 R3(config-if)#end R4 Router(config)#hostname R4 R4(config)#enable password cisco R4(config)#no ip domain-lookup R4(config)#banner motd ^C R4^C R4(config)#line console 0 R4(config-line)# logging synchronous R4(config-line)# password cisco

106

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R4(config-line)# login R4(config)#line vty 0 4 R4(config-line)# password cisco R4(config-line)# login R4(config)# interface Loopback0 R4(config-if)# ip address 172.16.4.1 255.255.255.0 R4(config-if)#end R4(config)# interface Serial0/1 R4(config-if)# ip address 172.16.34.4 255.255.255.0 R4(config-if)#bandwidth 64 R4(config-if)#end Bc 2: Cu hnh OSPF Area 0. Cu hnh OSPF trn R1 R1(config)#router ospf 1 R1(config-router)network 172.16.1.0 0.0.0.255 area 0 R1(config-router)network 172.16.12.0 0.0.0.255 area 0 R1(config-router)#exit Cu hnh OSPF trn R2 R2(config)#router ospf 1 R2(config-router)# network 172.16.2.0 0.0.0.255 area 0 R2(config-router)# network 172.16.12.0 0.0.0.255 area 0 R2(config-router)# network 172.16.23.0 0.0.0.255 area 0 R2(config-router)#exit Cu hnh OSPF trn R3 R3(config)#router ospf 1 R3(config-router)#network 172.16.3.0 0.0.0.255 area 34 R3(config-router)#network 172.16.23.0 0.0.0.255 area 0 R3(config-router)#network 172.16.34.0 0.0.0.255 area 34 R3(config-router)#exit Cu hnh OSPF trn R4 R4(config)#router ospf 1 R4(config-router)#network 172.16.4.0 0.0.0.255 area 40 R4(config-router)#network 172.16.34.0 0.0.0.255 area 34 R4(config-router)#exit

107

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Kim tra cu hnh

Hnh 3.5.3-1: Show ip route trn R1

Hnh 3.5.3-2: Show ip route trn R2

Hnh 3.5.3-3 Show ip route trn R3

108

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.5.3-4: Show ip route trn R4

Bc 3: Cu hnh OSPF network type gia R2 v R3 l nonbroadcast Cu hnh OSPF trn R2 R2(config)# interface Serial0/0 R2(config-if)# ip ospf network non-broadcast R2(config)#router ospf 1 R2(config-router)# neighbor 172.16.23.3 Cu hnh OSPF trn R3 R3(config)# interface Serial0/1 R3(config-if)# ip ospf network non-broadcast Kim tra cu hnh

Hnh 3.5.3-5: Show ip route trn R2

Hnh 3.5.3-6: Show ip ospf neighbor trn R2

109

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bc 4: Cu hnh virtual-link gia R3 v R4 R3(config)#router ospf 1 R3(config-router)# area 34 virtual-link 172.16.4.1 R4(config)#router ospf 1 R4(config-router)# area 34 virtual-link 172.16.3.1 Kim tra cu hnh

Hnh 3.5.3-7: Show ip route trn R1

Hnh 3.5.3-8: Ping 172.16.4.1 trn R1

110

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Bi 3.6 Tng hp OSPF 3.6.1 S lun l


OSPF Area 23 S0/0 R2 S0/1 172.16.23.0/24 S0/3/1 R3 S0/3/0

OSPF Area 20 Lo0 : 172.16.2.2/27 Lo1 : 172.16.2.33/27 Lo2 : 172.16.2.65/27 Lo3 : 172.16.2.97/27

Lo0: 172.16.3.3/24

172.16.34.0/24

172.16.12.0/24

OSPF Area 0 S0/3/0 S0/0/1

OSPF Area 34 R4

R1 Lo0: 172.16.1.1/24

Lo0: 172.16.4.4/24

Hnh 3.6.1-1: Hnh v s lun l

3.6.2

Mc tiu bi thc hnh Cu hnh OSPF vi s trn Cu hnh R2 summarize cho area 20 Cu hnh link gia R1 v R2 s dng network type l broadcast. Vi R1 l DR Cu hnh R1 lun l Default route Chnh sa Hello timers v Dead timers gp i gi tr mc nh link gia R2 v R3 Chnh sa cost gia R2 v R3 l 500

111

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Cu hnh Virtual link cho area 34 v cu hnh area 34 l totally stubby area S dng MD5 Authentication vi keyword l cisco link gia R3 v R4 3.6.3 Cu hnh v hnh v minh ha Bc 1: Cu hnh c bn R1, R2, R3, R4 R1 Router(config)#hostname R1 R1(config)#enable password cisco R1(config)#no ip domain-lookup R1(config)#banner motd ^C R1^C R1(config)#line console 0 R1(config-line)# logging synchronous R1(config-line)# password cisco R1(config-line)# login R1(config)#line vty 0 4 R1(config-line)# password cisco R1(config-line)# login R1(config)#interface Serial 0/3/0 R1(config-if)#ip address 172.16.12.1 255.255.255.0 R1(config-if)#clock rate 64000 R1(config-if)#no shutdown R1(config-if)#exit R1(config)#interface loopback 0 R1(config-if)#ip address 172.16.1.1 255.255.255.0 R1(config-if)#exit R2 Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#no ip domain-lookup R2(config)#banner motd ^C R2^C R2(config)#line console 0 R2(config-line)# logging synchronous R2(config-line)# password cisco R2(config-line)# login R2(config)#line vty 0 4

112

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R2(config-line)# password cisco R2(config-line)# login R2(config)#interface serial 0/0 R2(config-if)#ip address 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 64000 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface serial 0/1 R2(config-if)#ip address 172.16.12.2 255.255.255.0 R2(config-if)#no shutdown R2(config-if)#exit R2(config)#interface loopback 0 R2(config-if)#ip address 172.16.2.2 255.255.255.224 R2(config-if)#exit R2(config)#interface loopback 1 R2(config-if)#ip address 172.16.2.33 255.255.255.224 R2(config-if)#exit R2(config)#interface loopback 2 R2(config-if)#ip address 172.16.2.65 255.255.255.224 R2(config-if)#exit R2(config)#interface loopback 3 R2(config-if)#ip address 172.16.2.97 255.255.255.224 R2(config-if)#exit R3 Router(config)#hostname R3 R3(config)#enable password cisco R3(config)#no ip domain-lookup R3(config)#banner motd ^C R3^C R3(config)#line console 0 R3(config-line)# logging synchronous R3(config-line)# password cisco R3(config-line)# login R3(config)#line vty 0 4 R3(config-line)# password cisco R3(config-line)# login R3(config)#interface Serial 0/3/0 R3(config-if)#ip address 172.16.34.3 255.255.255.0

113

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R3(config-if)#clock rate 64000 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface Serial 0/3/1 R3(config-if)#ip address 172.16.23.3 255.255.255.0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface loopback 0 R3(config-if)# ip address 172.16.3.3 255.255.255.0 R3(config-if)#exit R4 Router(config)#hostname R4 R4(config)#enable password cisco R4(config)#no ip domain-lookup R4(config)#banner motd ^C R4^C R4(config)#line console 0 R4(config-line)# logging synchronous R4(config-line)# password cisco R4(config-line)# login R4(config)#line vty 0 4 R4(config-line)# password cisco R4(config-line)# login R4(config)#interface Serial 0/0/1 R4(config-if)# ip address 172.16.34.4 255.255.255.240 R4(config-if)#no shutdown R4(config-if)#exit R4(config)#interface loopback 0 R4(config-if)# ip address 172.16.4.4 255.255.255.0 R4(config-if)#exit Bc 2: Cu hnh OSPF Cu hnh OSPF trn R1 R1(config)#interface loopback 0 R1(config-if)#ip ospf network point-to-point R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 172.16.1.1 R1(config-router)#network 172.16.1.1 0.0.0.0 area 0 R1(config-router)#network 172.16.12.1 0.0.0.0 area 0
114

Gio trnh thc hnh BSCI

Chng 3 - OSPF

R1(config-router)#exit Cu hnh OSPF trn R2 R2(config)#interface loopback 0 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#interface loopback 1 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#interface loopback 2 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#interface loopback 3 R2(config-if)#ip ospf network point-to-point R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 172.16.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 20 R2(config-router)#network 172.16.12.2 0.0.0.0 area 0 R2(config-router)#network 172.16.23.2 0.0.0.0 area 23 R2(config-router)#exit Cu hnh OSPF trn R3 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 172.16.3.3 R2(config-router)#network 172.16.23.3 0.0.0.0 area 23 R3(config-router)#network 172.16.3.3 0.0.0.0 area 23 R2(config-router)#network 172.16.34.3 0.0.0.0 area 34 R3(config-router)#exit Cu hnh OSPF trn R4 R3(config)#interface loopback 0 R3(config-if)#ip ospf network point-to-point R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 172.16.4.4 R3(config-router)#network 172.16.4.4 0.0.0.0 area 34 R2(config-router)#network 172.16.34.4 0.0.0.0 area 34 R3(config-router)#exit Kim tra cu hnh OSPF

115

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-1: Show ip route trn R1

Hnh 3.6.3-2: Show ip route trn R2

Hnh 3.6.3-3: Show ip route trn R3

116

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-4: Show ip route trn R4

Bc 3: Cu hnh R2 summarize cho area 20 R2(config)#router ospf 1 R2(config-router)#area 20 range 172.16.2.0 255.255.255.0 R2(config-router)#exit

Hnh 3.6.3-5: Show ip route trn R1 sau khi summarize cho area 20

Hnh 3.6.3-6: Show ip route trn R3 sau khi summarize cho area 20

Bc 4: Cu hnh link gia R1 v R2 s dng network type l broadcast. Vi R1 l DR.

117

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Cu hnh trn R1 R1(config)#interface Serial 0/3/0 R1(config-if)#ip ospf network broadcast R1(config-if)#ip ospf priority 10 R1(config-if)#exit Cu hnh trn R2 R2(config)#interface Serial 0/1 R2(config-if)#ip ospf network broadcast R2(config-if)#ip ospf priority 5 R2(config-if)#exit

Hnh 3.6.3-7: Show ip ospf neighbor trn R1

Hnh 3.6.3-8: Show ip ospf neighbor trn R2

Bc 5: Cu hnh R1 lun l Default route R1(config)#router ospf 1 R1(config-router)#default-information originate always R1(config-router)#end

Hnh 3.6.3-9: Show ip route trn R2

118

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-10: Show ip route trn R3

Bc 6: Chnh sa Hello timers v Dead timers gp i gi tr mc nh link gia R2 v R3 Cu hnh trn R2 R2(config)#interface Serial 0/0 R2(config-if)#ip ospf hello-interval 5 R2(config-if)#ip ospf dead-interval 15 R2(config-if)#exit Cu hnh trn R3 R3(config)#interface Serial 0/3/1 R3(config-if)#ip ospf hello-interval 5 R3(config-if)#ip ospf dead-interval 15 R3(config-if)#exit Kim tra cu hnh

Hnh 3.6.3-11: Show ip ospf interface trn R2

119

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-12: Show ip ospf interface trn R3

Bc 7: Chnh sa cost gia R2 v R3 l 500 Cu hnh trn R2 R2(config)#interface Serial 0/0 R2(config-if)#ip os R2(config-if)#ip ospf co R2(config-if)#ip ospf cost 100 R2(config-if)#exit Cu hnh trn R3 R3(config)#interface Serial 0/3/1 R3(config-if)#ip os R3(config-if)#ip ospf co R3(config-if)#ip ospf cost 100 R3(config-if)#exit Kim tra cu hnh

Hnh 3.6.3-13: Show ip route trn R2


120

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-14: Show ip route trn R3

Bc 8: Cu hnh Virtual link cho area 34 v cu hnh area 34 l totally stubby area Cu hnh trn R2 R2(config)#router ospf 1 R2(config-router)#area 23 virtual-link 172.16.3.3 R2(config-router)#exit Cu hnh trn R3 R3(config)#router ospf 1 R3(config-router)#area 23 virtual-link 172.16.2.2 R3(config-router)#area 34 stub no-summary R3(config-router)#exit Cu hnh trn R4 R4(config)#router ospf 1 R4(config-router)#area 34 stub R4(config-router)#exit Kim tra cu hnh

Hnh 3.6.3-15: Show ip route ospf trn R1

121

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-16: Show ip route ospf trn R2

Hnh 3.6.3-17: Show ip route trn R4

Bc 9: S dng MD5 Authentication vi keyword l cisco link gia R3 v R4 Cu hnh trn R3 R3(config)#interface Serial 0/3/0 R3(config-if)#ip ospf authentication message-digest R3(config-if)#ip ospf message-digest-key 1 md5 cisco R3(config-if)#exit Cu hnh trn R4 R4(config)#interface Serial 0/0/1 R4(config-if)#ip ospf authentication message-digest R4(config-if)#ip ospf message-digest-key 1 md5 cisco R4(config-if)#exit Kim tra cu hnh

122

Gio trnh thc hnh BSCI

Chng 3 - OSPF

Hnh 3.6.3-18: Show ip ospf interface trn R3

Hnh 3.6.3-19: Show ip ospf interface trn R4

123

You might also like