Redistribute gi a OSPF và IGRPữ
Tác gi : Nguy n Th Băng Tâm ả ễ ị
Trong bài này ta s th c hi n redistribute gi a hai giao th c hi u classfull làẽ ự ệ ữ ứ ể
IGRP và giao th c hi u classless là OSPF .ứ ể
M c tiêu bài làmụ :
T m t router b t kì trong m ng ping th y t t c các đ a ch .ừ ộ ấ ạ ấ ấ ả ị ỉ
Gi i quy t v n đ mà classfull g p ph i là discontiguous network và VLSM .ả ế ấ ề ặ ả
Ki m tra metric c a hai giao th c .ể ủ ứ
Mô hình m ng nh hình v d i đây , router R2 ch y hai giao th c là OSPFạ ư ẽ ướ ạ ứ
và IGRP .Router này s th c hi n redistribute gi a hai giao th c này .ẽ ự ệ ữ ứ
Đi ch c a các interface trên các router nh sau : ạ ỉ ủ ư
Router Interface Đ a chị ỉ
Router R1 S0/0
F0/1
F0/0
Loopback 0
192.168.2.1/24
172.16.1.1/28
172.16.1.17/28
192.168.6.1/24
Router R2 S0/0
S0/1
E0/0
192.168.2.2/24
192.168.1.2/24
192.168.3.2/24
Router R3 S0/0
E0/0
Loopback 0
192.168.1.3/24
172.16.4.1/24
10.3.1.1/24
Router R4 E0/0
Loopback 0
Loopback 1
Loopback 2
192.168.3.4/24
10.1.1.1/24
10.1.2.160/24
172.16.5.1/24
C u hình ban đ u : ấ ầ
R1
!
Hostname R1
!
Interface Loopback0
Ip address 192.168.6.1 255.255.255.0
!
Interface fastethernet0/0
Ip address 172.16.1.16 255.255.255.240
!
Interface Serial0/0
Ip address 192.168.2.1 255.255.255.0
!
Interface fastethernet0/1
Ip address 172.16.1.1 255.255.255.240
!
End
R2
!
Hostname R2
!
Interface Ethernet0/0
Ip address 192.168.3.2 255.255.255.0
!
Interface Serial0/0
Ip address 192.168.2.2 255.255.255.0
Clockrate 64000
!
Interface Serial0/1
Ip address 192.168.1.2 255.255.255.0
!
End
R3
!
Hostname R3
!
Interface Loopback0
Ip address 10.3.1.1 255.255.255.0
!
Interface Ethernet0/0
Ip address 172.16.4.1 255.255.255.0
!
Interface Serial0/0
Ip address 192.168.1.3 255.255.255.0
Clockrate 64000
!
Ip classless
!
End
R4
!
Hostname R4
!
Interface Loopback0
Ip address 10.1.1.1 255.255.255.0
!
Interface Loopback1
Ip address 10.1.2.160 255.255.255.0
!
Interface Loopback2
Ip address 172.16.5.1 255.255.255.0
!
Interface Ethernet0/0
Ip address 192.168.3.4 255.255.255.0
!
End
Bây gi ta ti n hành c u hình t ng b c cho các router : ờ ế ấ ừ ướ
C u hình cho router R1 : ấ
Press RETURN to get started!
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#line console 0
R1(config-line)#password cisco
R1(config-line)#logging synchronous
R1(config-line)#line vty 0 4
R1(config-line)#no login
R1(config-line)#exit
R1(config)#interface s0/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface f0/1
R1(config-if)#ip address 172.16.1.1 255.255.255.240
R1(config-if)#no keepalive
R1(config-if)#no shutdown
00:15:24: %LINK-3-UPDOWN: Interface fastethernet0/1, changed state to up
00:15:25: %LINEPROTO-5-UPDOWN: Line protocol on Interface
fastethernet0/1, changed
State to up
R1(config-if)#interface f0/0
R1(config-if)#ip address 172.16.1.17 255.255.255.240
R1(config-if)#no keepalive
R1(config-if)#no shutdown
R1(config-if)#exit
00:15:45: %LINK-3-UPDOWN: Interface fastethernet0/0, changed state to up
00:15:46: %LINEPROTO-5-UPDOWN: Line protocol on Interface
fastethernet0/0, changed state to up
R1(config)#interface loopback 0
R1(config-if)#ip address 192.168.6.1 255.255.255.0
R1(config)#exit
R1#copy running-config startup-config
Building configuration...
[OK]
(th c hiên l u c u hình)ự ư ấ
C u hình cho router R2 : ấ
Press RETURN to get started!
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#line console 0
R2(config-line)#password cisco
R2(config-line)#logging synchronous
R2(config-line)#line vty 0 4
R2(config-line)#no login
R2(config-line)#exit
R2(config)#interface s0/0
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#interface s0/1
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface e0/0
R2(config-if)#ip address 192.168.3.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#exit
R2#
R2#wr
Building configuration...
[OK]
(th c hi n l u c u hình )ự ệ ư ấ
C u hình cho router R3 :ấ
Press RETURN to get started!
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R3
R3(config)#line console 0
R3(config-line)#password cisco
R3(config-line)#logging synchronous
R3(config-line)#line vty 0 4
R3(config-line)#no login
R3(config-line)#exit
R3(config)#interface s0/0
R3(config-if)#ip address 192.168.1.3 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface e0/0
R3(config-if)#ip address 172.16.4.1 255.255.255.0
R3(config-if)#no keepalive
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#int loopback 0
R3(config-if)#ip address 10.3.31.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#exit
R3#write
Building configuration...
[OK]
(th c hi n l u c u hình)ự ệ ư ấ
C u hình cho router R4 : ấ
Press RETURN to get started!
Router>enable
Router#configure t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R4
R4(config)#line console 0
R4(config-line)#password cisco
R4(config-line)#logging synchronous
R4(config-line)#line vty 0 4
R4(config-line)#no login
R4(config-line)#exit
R4(config)#interface e0/0
R4(config-if)#ip address 192.168.3.4 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#exit
*Mar 1 00:04:19.865: %LINK-3-UPDOWN: Interface Ethernet0/0, changed
state to up
R4(config)#interface loopback 0
R4(config-if)#ip address 10.1.1.1 255.255.255.0
R4(config-if)#interface loopback 1
R4(config-if)#ip address 10.1.2.160 255.255.255.0
R4(config-if)#interface loopback 2
R4(config-if)#ip address 172.16.5.1 255.255.255.0
R4(config-if)#exit
R4(config)#exit
R4#wr
Building configuration...
[OK]
(th c hi n l u c u hình)ự ệ ư ấ
Ki m tra b ng đ nh tuy n c a m i router : ể ả ị ế ủ ỗ
R1#sh ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 1 masks
C 172.16.1.0/28 is directly connected, fastethernet0/1
C 172.16.1.16/28 is directly connected, fastethernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.6.0/24 is directly connected, Loopback0
R2#sh ip route
<omitted>
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Serial0/1
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.3.0/24 is directly connected, Ethernet0/0
R3#sh ip route
<omitted>
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.4.0 is directly connected, Ethernet0/0
10.0.0.0/24 is subnetted, 1 subnets
C 10.3.1.0 is directly connected, Loopback0
C 192.168.1.0/24 is directly connected, Serial0/0
R4#sh ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.5.0 is directly connected, Loopback2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
C 192.168.3.0/24 is directly connected, Ethernet0/0
trên b ng đ nh tuy n ta ch th y các connected network ,lí do là vì không cóỞ ả ị ế ỉ ấ
giao th c đ nh tuy n nào ch y trên đó .C u hình cho các router R1,R4 vàứ ị ế ạ ấ
interface s0/0 c a R2 ch y OSPF v i process –id là 1, area 0 . Router R3 vàủ ạ ớ
interface s0/1 c a R2 ch y IGRP process 1.ủ ạ
C u hình nh sau : ấ ư
R1(config)#router ospf 1
R1(config-router)#network 172.16.1.0 0.0.0.15 area 0
R1(config-router)#network 172.16.1.16 0 0.0.0.15 area 0
R1(config-router)#network 192.168.2.0 0.0.0.255 area 0
R1(config-router)#network 192.168.6.0 0.0.0.255 area 0
R2(config)#router ospf 1
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0
R2(config-router)#network 192.168.3.0 0.0.0.255 area 0
R2(config-router)#exit
R2(config)#router igrp 1
R2(config-router)#network 192.168.1.0
R2(config-router)#exit
R3(config)#router igrp 1
R3(config-router)#network 172.16.0.0
R3(config-router)#network 10.0.0.0
R3(config-router)#network 192.168.1.0
R4(config)#router ospf 1
R4(config-router)#network 192.168.3.0 0.0.0.255 area 0
R4(config-router)#network 10.1.1.0 0.0.0.255 area 0
R4(config-router)#network 10.1.2.0 0.0.0.255 area 0
R4(config-router)#network 172.16.5.1 0.0.0.0 area 0
Ki m tra l i b ng đ nh tuy n : ể ạ ả ị ế
R1#sh ip route
<omitted>
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O 172.16.5.1/32 [110/75] via 192.168.2.2, 00:00:26, Serial0/0
C 172.16.1.0/28 is directly connected, fastethernet0/1
C 172.16.1.16/28 is directly connected, fastethernet0/0
10.0.0.0/24 is subnetted, 2 subnets
O 10.1.1.0 [110/75] via 192.168.2.2, 00:00:26, Serial0/0
O 10.1.2.0 [110/75] via 192.168.2.2, 00:00:26, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.6.0/24 is directly connected, loopback0
O 192.168.3.0/24 [110/74] via 192.168.2.2, 00:00:26, Serial0/0
Quan sát b ng trên ta th y : ả ấ
O miêu t các route OSPF mà R1 h c đ c .Ví d nh b ng trên ta có thả ọ ượ ụ ư ả ể
th y R1 h c đ c route 172.16.5.1 thông qua interface 192.168.2.2 , 110 là ADấ ọ ượ
c a OSPF ,75 là cost đ đi đ n đ c route 172.16.5.1 .Quan sát ta th y ,R1ủ ể ế ượ ấ
cũng h c đ c m ng 192.168.3.0/24 thông qua OSPF nh ng ch có cost 74 ,sọ ượ ạ ư ỉ ự
khác nhau đây là vì R1 mu n h c đ c 172.16.5.1 ph i đi qua m t hop-ở ố ọ ượ ả ộ
count là R4,do đó trong quá trình tính cost có c ng thêm 1 .ộ
R1#ping 192.168.3.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/40/56 ms
R1#ping 172.16.5.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.5.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/40/60 ms
R2#sh ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
O 172.16.5.1/32 [110/11] via 192.168.3.4, 00:00:04, Ethernet0/0
I 172.16.0.0/16 [100/8576] via 192.168.1.3, 00:00:04, Serial0/1
O 172.16.1.0/28 [110/65] via 192.168.2.1, 00:00:04, Serial0/0
O 172.16.1.16/28 [110/65] via 192.168.2.1, 00:00:04, Serial0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
I 10.0.0.0/8 [100/8976] via 192.168.1.3, 00:00:04, Serial0/1
O 10.1.1.0/24 [110/11] via 192.168.3.4, 00:00:04, Ethernet0/0
O 10.1.2.0/24 [110/11] via 192.168.3.4, 00:00:04, Ethernet0/0
O 192.168.6.0/24 [110/65] via 192.168.2.1,00:00:04, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/1
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.3.0/24 is directly connected, Ethernet0/0
Quan sát b ng đ nh tuy n c a router 2 : ả ị ế ủ
R2 h c đ c 5 route qua OSPF , đó là nh ng route b t đ u b ng ch O ,cóọ ượ ữ ắ ầ ằ ữ
AD b ng 110 . Cost gi a router R2 và R4 là 10 nên khi R2 h c routeằ ữ ọ
10.1.1.1,10.1.2.1,172.16.5.1 t R4 s có cost là 11 .Cũng nhìn trên b ng đ nhừ ẽ ả ị
tuy n ta có th bi t đ c cost gi a R2 và R1 là 64 .ế ể ế ượ ữ
Băng thông m c đ nh trên interface Ethernet là 10Mbps ,do đó cost trênặ ị
interface này là 10
8
/ 10Mbps = 10 .T c đ m c đ nh trên các interface serial làố ộ ặ ị
T1= 1.544Mbps ,do đó cost m c đ nh trên các interface serial là :ặ ị
10
8
/1,544Mbps = 64 .