Professional Documents
Culture Documents
Chng 3 - OSPF
Chng 3 -
Lo0 S0/3/1
.0 / 24
R2 Fa0/0
10 .1
.1
00
10.1.200.0/24
R1 Lo0 10.1.1.0/24
10.2.2.0/24
R3 Lo0 10.3.3.0/24
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
72
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
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
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.
75
Chng 3 - OSPF
76
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
77
Chng 3 - OSPF
78
Chng 3 - OSPF
79
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
80
Chng 3 - OSPF
81
Chng 3 - OSPF
Bi 3.2 Multi-Area OSPF with Stub Areas and Authentication 3.2.1 S lun l
/2
00 .0
10.2.2.0/24
10 20 .1 .
Area 0
10
.1
.1
0 .0
Lo1 : 172.16.10.0/24
/2 4
S0/0/1 R3 Lo0 10.3.3.0/24
R1
Lo0: 10.1.1.0/24
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
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
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
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.
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
Chng 3 - OSPF
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
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
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
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
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
88
Chng 3 - OSPF
10.2.2.0/24
6 .1
.0/ 3
Area 0
2 .1
6 .2 .0 /
17
30
Internet 172.30.30.0/30
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
89
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
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
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
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
93
Chng 3 - OSPF
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
94
Chng 3 - OSPF
103
102
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
95
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
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
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
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
99
Chng 3 - OSPF
100
Chng 3 - OSPF
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
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
102
Chng 3 - OSPF
103
Chng 3 - OSPF
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
OSPF Area 40
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
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
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
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
Chng 3 - OSPF
108
Chng 3 - OSPF
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
109
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
110
Chng 3 - OSPF
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 34 R4
R1 Lo0: 172.16.1.1/24
Lo0: 172.16.4.4/24
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
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
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
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
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
Chng 3 - OSPF
116
Chng 3 - OSPF
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
117
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
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
118
Chng 3 - OSPF
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
119
Chng 3 - OSPF
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
Chng 3 - OSPF
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
121
Chng 3 - OSPF
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
Chng 3 - OSPF
123