klepski
05-08-2004, 02:34 AM
Redistribute giữa OSPF và RIP
1. Giới thiệu
Thực hiện trao đổi routes giữa các routing protocol là một công việc hết sức phức tạp và cần đòi hỏi nhiều kinh nghiệm để thực hiện hiệu quả. Bài lab này sẽ giới thiệu cách thực hiện Redistribute giữa hai routing protocols phổ biến là OSPF và RIP.
2. Mục tiêu
Thực hiện lab các công việc:
• Cấu hình Redistribute giữa OSPF và RIP.
• Tất cả các router đều ping thấy nhau.
• Kiểm tra kết quả bằng các lệnh show, ping và debug.
3. Hoàn cảnh
http://forum.vnpro.org/files/redistribute_rip_ospf_topo.jpg
Công ty ABC mới sát nhập vào công ty XYZ. Mạng máy tính của công ty ABC sử dụng RIP, còn công ty XYZ thì dùng OSPF dạng sơ đồ trên. Sau khi sát nhập, hai mạng trên không liên lạc được với nhau. Họ cần một chuyên gia để giải quyết việc này và bạn đã được chọn. Bạn muốn thử nghiệm trước trên môi trường Lab để chắc chắn công việc sẽ được thực hiện thành công.
Trong Lab này, chúng tôi sử dụng cả 2 dòng router 2600 và 2500, nhưng các bạn có thể chỉ cần sử dụng router 2500 là đủ.
4. Thực hiện
Bước 1: Cấu hình các router theo sơ đồ trên
Router R1:
R1(config)#interface e0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no keepalive
R1(config-if)#no shutdown
R1(config-if)#interface s0
R1(config-if)#ip address 172.16.2.2 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#router rip
R1(config-router)#network 172.16.0.0
R1(config-router)#network 192.168.1.0
Router R2:
R2(config)#interface e0/0
R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#no keepalive
R2(config-if)#no shutdown
R2(config-if)#interface s0/0
R2(config-if)#ip address 172.16.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s0/1
R2(config-if)#ip address 172.16.3.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#router rip
R2(config-router)#network 172.16.0.0
R2(config-router)#router ospf 100
R2(config-router)#network 172.16.3.0 0.0.0.255 area 0
Router R3:
R3(config)#interface e0
R3(config-if)#ip address 192.168.3.1 255.255.255.0
R3(config-if)#no keepalive
R3(config-if)#no shutdown
R3(config-if)#interface s0
R3(config-if)#ip address 172.16.4.2 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#interface s1
R3(config-if)#ip address 172.16.3.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#router ospf 100
R3(config-router)#network 172.16.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 172.16.4.0 0.0.0.255 area 1
Router R4:
R4(config)#interface e0/0
R4(config-if)#ip address 192.168.4.1 255.255.255.0
R4(config-if)#no keepalive
R4(config-if)#no shutdown
R4(config-if)#interface s0/0
R4(config-if)#ip address 172.16.4.1 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#router ospf 100
R4(config-router)#network 172.16.4.0 0.0.0.255 area 1
R4(config-router)#network 192.168.4.0 0.0.0.255 area 1
NOTE :
Lệnh no keepalive được dùng để giữ cho interface luôn luôn up, do vậy nó chỉ thích hợp trong môi trường lab. Khi bạn cấu hình trên môi trường thật thì không nên sử dụng lệnh này.
Bước 2: Cấu hình Redistribute từ OSPF vào RIP trên R2
Vì R2 là Boundary Router, hiểu được cả RIP và OSPF nên ta sẽ thực hiện việc Redistribute trên R2.
R2(config)#router rip
R2(config-router)#redistribute ospf 100 metric 5
R2(config-router)#passive-interface S0/1
o Tham số 100 chính là OSPF Process ID mà ta cấu hình OSPF ban đầu (bạn có thể tham khảo cấu hình ở cuối bài này).
o Tham số metric 5 có nghĩa là các route từ OSPF khi redistribute sang RIP sẽ có metric bằng 5.
o Lệnh Passive-interface S0/1 trên R2 để ngăn các routing update từ RIP qua OSPF. Nếu không có lệnh này, thì cấu hình của bạn vẫn không sai, nhưng sẽ làm hao tốn resource và bandwidth của Router hơn.
o Hay bạn cũng có thể dùng lệnh default-metric để làm việc này.
R2(config)#router rip
R2(config-router)#redistribute ospf 100
R2(config-router)#default-metric 5
NOTE:
o Khi bạn cầu hình sử dụng lệnh default-metric 5, thì tất cả các routing protocol khác (như IGRP, EIGRP,IS-IS v.v…) khi redistribute vào RIP (trong trường hợp này) đều mang giá trị metric là 5 hết.
o Còn khi bạn cấu hình metric riêng cho từng routing protocol, ví dụ :
R2(config-router)#redistribute ospf 100 metric 5
Thì giá trị metric bằng 5 chỉ được áp vô cho các route học từ routing protocol đó thôi (trong trường hợp này là OSPF).
o Như vậy, ta sẽ thấy, cầu hình metric cho từng routing protocol khi redistribute sẽ có độ ưu tiên cao hơn là cầu hình default-metric.
Bước 3: Cấu hình redistribute chiều từ RIP sang OSPF trên R2
Lúc này, ta thấy R1 (mạng RIP) đã thấy được tất cả các route bên mạng OSPF, đó là do ta vừa redistribute các route từ OSPF vào RIP.
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
R 172.16.3.0 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
Nhưng các router R2,R3 và R4 (mạng OSPF) thì không thấy các route bên trong R1 (mạng RIP)
R4#sh ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.4.0 is directly connected, Serial0/0
O IA 172.16.3.0 [110/128] via 172.16.4.2, 00:10:01, Serial0/0
C 192.168.4.0/24 is directly connected, Ethernet0
O IA 192.168.3.0/24 [110/65] via 172.16.4.2, 00:10:01, Serial0/0
Nên ta phải cấu hình redistribute các route từ RIP sang OSPF như sau :
R2(config)#router ospf 100
R2(config-router)#redistribute rip subnets
Tham số subnets biểu thị khi RIP redistribute vào OSPF sẽ cung cấp các network theo classless
Lúc này tất cả các router đã học được các network của nhau
R3#show ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0
O E2 172.16.2.0 [110/20] via 172.16.3.2, 00:27:43, Serial1
C 172.16.3.0 is directly connected, Serial1
O 192.168.4.0 [110/65] via 172.16.4.1, 00:29:10, Serial0
O E2 192.168.1.0/24 [110/20] via 172.16.3.2, 00:29:10, Serial1
C 192.168.3.0/24 is directly connected, Ethernet0
R4#sh ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0/1
O E2 172.16.2.0 [110/20] via 172.16.4.2, 00:13:01, Serial0/0
O IA 172.16.3.0 [110/128] via 172.16.4.2, 00:13:01, Serial0/0
C 192.168.4.0/24 is directly connected, Ethernet0
O E2 192.168.1.0/24 [110/20] via 172.16.4.2, 00:13:01, Serial0/0
O IA 192.168.3.0 [110/65] via 172.16.4.2, 00:13:01, Serial0/0
NOTE:
Các route từ RIP khi được redistribute qua OSPF sẽ được hiểu là một External Link (Type 5)
Bước 4: Cấu hình redistribute các connected network vào OSPF
Ta thấy trong bảng routing của các router chạy OSPF chỉ còn thiếu network 192.168.2.0/24 của R2. Đó là do network này không được quảng bá trong OSPF. Vậy nên R2 cũng phải redistribute route này vào OSPF bằng
R2(config)#router ospf 100
R2(config-router)#redistribute connected subnets
Bây giờ, routing table của R3 và R4 đã có network 192.168.2.0/24 do R2 redistribute vào.
R3#sh ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0
O E2 172.16.2.0 [110/20] via 172.16.3.2, 00:27:43, Serial1
C 172.16.3.0 is directly connected, Serial1
192.168.4.0/32 is subnetted, 1 subnets
O 192.168.4.1 [110/65] via 172.16.4.1, 00:29:10, Serial0
O E2 192.168.1.0/24 [110/20] via 172.16.3.2, 00:29:10, Serial1
O E2 192.168.2.0/24 [110/20] via 172.16.3.2, 00:26:33, Serial1
C 192.168.3.0/24 is directly connected, Ethernet0
Bước 5: Cấu hình redistribute các connected network vào RIP
Ta thấy trong bảng routing của các router chạy RIP (trong lab này là R1) chỉ còn thiếu network 192.168.2.0/24 của R2. Đó là do network này không được quảng bá trong RIP. Vậy nên R2 cũng phải redistribute route này vào RIP bằng lệnh :
R2(config)#router rip
R2(config-router)#redistribute connected
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
R 172.16.3.0 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.2.0/24 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
TIP:
Nếu routing table của R1 vẫn chưa xuất hiện network 192.168.2.0 thì ta dùng lệnh clear ip route * để R1 xây dựng routing table mới cho nhanh, nếu không bạn sẽ mất thời gian ngồi chờ RIP update.
FUN STUFF:
Giả sử bạn thêm vào R2 một route mới vào interface Loopback0 có địa chỉ là 172.16.10.1/24 và bạn hãy redistribute connected nó vào mạng RIP.
Sau đó ta bỏ redistribute connected trong RIP trên R2 thì routing table của R1 sẽ mất network 192.168.2.0 nhưng network 172.16.10.0 vẫn còn, mặc dù cả 2 route này đều có cùng bản chất là connected đối với R2
R2(config)#router rip
R2(config-router)#no redistribute connected
R1#clear ip route *
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
[fade:a3bd0b2b05]R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:24, Serial0[/fade:a3bd0b2b05]
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
Đó là do R1 hiện đang chạy RIP, một classfull routing protocol, nên RIP chỉ nắm cả network 172.16.0.0.
Bạn hãy thử clear ip route * hoặc clear ip route 172.16.10.0, bạn sẽ thấy RIP lại học được lại route 172.16.10.0 lại sau một thời gian.
6. Cấu hình
R1#show running-config
Building configuration...
Current configuration : 960 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R1
!
interface Ethernet0
ip address 192.168.1.1 255.255.255.0
!
interface Serial0
ip address 172.16.2.2 255.255.255.0
clock rate 64000
!
router rip
network 172.16.0.0
network 192.168.1.0
!
line con 0
transport input none
line aux 0
line vty 0 4
login
!
R2#show running-config
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
interface Ethernet0/0
ip address 192.168.2.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.2.1 255.255.255.0
no ip directed-broadcast
!
interface Serial0/1
ip address 172.16.3.2 255.255.255.0
no ip directed-broadcast
clockrate 64000
!
router ospf 100
network 172.16.3.0 0.0.0.255 area 0
redistribute rip subnets
redistribute connected subnets
!
router rip
network 172.16.0.0
redistribute ospf 100 metric 5
redistribute connected
!
ip classless
no ip http server
!
line con 0
transport input none
line aux 0
line vty 0 4
!
R3#show running-config
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R3
!
interface Ethernet0
ip address 192.168.3.1 255.255.255.0
!
interface Serial0
ip address 172.16.4.2 255.255.255.0
no ip directed-broadcast
clock rate 64000
!
interface Serial1
ip address 172.16.3.1 255.255.255.0
no ip directed-broadcast
clockrate 64000
!
router ospf 100
network 192.168.3.0 0.0.0.255 area 0
network 172.16.3.0 0.0.0.255 area 0
network 172.16.4.0 0.0.0.255 area 1
!
ip classless
no ip http server
!
line con 0
transport input none
line aux 0
line vty 0 4
!
R4#show running-config
Building configuration...
Current configuration : 960 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R4
!
interface Ethernet0/0
ip address 192.168.4.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.4.1 255.255.255.0
!
router ospf 100
network 172.16.4.0 0.0.0.255 area 1
network 192.168.4.0 0.0.0.255 area 1
!
line con 0
transport input none
line aux 0
line vty 0 4
login
!
1. Giới thiệu
Thực hiện trao đổi routes giữa các routing protocol là một công việc hết sức phức tạp và cần đòi hỏi nhiều kinh nghiệm để thực hiện hiệu quả. Bài lab này sẽ giới thiệu cách thực hiện Redistribute giữa hai routing protocols phổ biến là OSPF và RIP.
2. Mục tiêu
Thực hiện lab các công việc:
• Cấu hình Redistribute giữa OSPF và RIP.
• Tất cả các router đều ping thấy nhau.
• Kiểm tra kết quả bằng các lệnh show, ping và debug.
3. Hoàn cảnh
http://forum.vnpro.org/files/redistribute_rip_ospf_topo.jpg
Công ty ABC mới sát nhập vào công ty XYZ. Mạng máy tính của công ty ABC sử dụng RIP, còn công ty XYZ thì dùng OSPF dạng sơ đồ trên. Sau khi sát nhập, hai mạng trên không liên lạc được với nhau. Họ cần một chuyên gia để giải quyết việc này và bạn đã được chọn. Bạn muốn thử nghiệm trước trên môi trường Lab để chắc chắn công việc sẽ được thực hiện thành công.
Trong Lab này, chúng tôi sử dụng cả 2 dòng router 2600 và 2500, nhưng các bạn có thể chỉ cần sử dụng router 2500 là đủ.
4. Thực hiện
Bước 1: Cấu hình các router theo sơ đồ trên
Router R1:
R1(config)#interface e0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no keepalive
R1(config-if)#no shutdown
R1(config-if)#interface s0
R1(config-if)#ip address 172.16.2.2 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#router rip
R1(config-router)#network 172.16.0.0
R1(config-router)#network 192.168.1.0
Router R2:
R2(config)#interface e0/0
R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#no keepalive
R2(config-if)#no shutdown
R2(config-if)#interface s0/0
R2(config-if)#ip address 172.16.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#interface s0/1
R2(config-if)#ip address 172.16.3.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#router rip
R2(config-router)#network 172.16.0.0
R2(config-router)#router ospf 100
R2(config-router)#network 172.16.3.0 0.0.0.255 area 0
Router R3:
R3(config)#interface e0
R3(config-if)#ip address 192.168.3.1 255.255.255.0
R3(config-if)#no keepalive
R3(config-if)#no shutdown
R3(config-if)#interface s0
R3(config-if)#ip address 172.16.4.2 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#interface s1
R3(config-if)#ip address 172.16.3.1 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#router ospf 100
R3(config-router)#network 172.16.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0
R3(config-router)#network 172.16.4.0 0.0.0.255 area 1
Router R4:
R4(config)#interface e0/0
R4(config-if)#ip address 192.168.4.1 255.255.255.0
R4(config-if)#no keepalive
R4(config-if)#no shutdown
R4(config-if)#interface s0/0
R4(config-if)#ip address 172.16.4.1 255.255.255.0
R4(config-if)#no shutdown
R4(config-if)#router ospf 100
R4(config-router)#network 172.16.4.0 0.0.0.255 area 1
R4(config-router)#network 192.168.4.0 0.0.0.255 area 1
NOTE :
Lệnh no keepalive được dùng để giữ cho interface luôn luôn up, do vậy nó chỉ thích hợp trong môi trường lab. Khi bạn cấu hình trên môi trường thật thì không nên sử dụng lệnh này.
Bước 2: Cấu hình Redistribute từ OSPF vào RIP trên R2
Vì R2 là Boundary Router, hiểu được cả RIP và OSPF nên ta sẽ thực hiện việc Redistribute trên R2.
R2(config)#router rip
R2(config-router)#redistribute ospf 100 metric 5
R2(config-router)#passive-interface S0/1
o Tham số 100 chính là OSPF Process ID mà ta cấu hình OSPF ban đầu (bạn có thể tham khảo cấu hình ở cuối bài này).
o Tham số metric 5 có nghĩa là các route từ OSPF khi redistribute sang RIP sẽ có metric bằng 5.
o Lệnh Passive-interface S0/1 trên R2 để ngăn các routing update từ RIP qua OSPF. Nếu không có lệnh này, thì cấu hình của bạn vẫn không sai, nhưng sẽ làm hao tốn resource và bandwidth của Router hơn.
o Hay bạn cũng có thể dùng lệnh default-metric để làm việc này.
R2(config)#router rip
R2(config-router)#redistribute ospf 100
R2(config-router)#default-metric 5
NOTE:
o Khi bạn cầu hình sử dụng lệnh default-metric 5, thì tất cả các routing protocol khác (như IGRP, EIGRP,IS-IS v.v…) khi redistribute vào RIP (trong trường hợp này) đều mang giá trị metric là 5 hết.
o Còn khi bạn cấu hình metric riêng cho từng routing protocol, ví dụ :
R2(config-router)#redistribute ospf 100 metric 5
Thì giá trị metric bằng 5 chỉ được áp vô cho các route học từ routing protocol đó thôi (trong trường hợp này là OSPF).
o Như vậy, ta sẽ thấy, cầu hình metric cho từng routing protocol khi redistribute sẽ có độ ưu tiên cao hơn là cầu hình default-metric.
Bước 3: Cấu hình redistribute chiều từ RIP sang OSPF trên R2
Lúc này, ta thấy R1 (mạng RIP) đã thấy được tất cả các route bên mạng OSPF, đó là do ta vừa redistribute các route từ OSPF vào RIP.
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
R 172.16.3.0 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
Nhưng các router R2,R3 và R4 (mạng OSPF) thì không thấy các route bên trong R1 (mạng RIP)
R4#sh ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.4.0 is directly connected, Serial0/0
O IA 172.16.3.0 [110/128] via 172.16.4.2, 00:10:01, Serial0/0
C 192.168.4.0/24 is directly connected, Ethernet0
O IA 192.168.3.0/24 [110/65] via 172.16.4.2, 00:10:01, Serial0/0
Nên ta phải cấu hình redistribute các route từ RIP sang OSPF như sau :
R2(config)#router ospf 100
R2(config-router)#redistribute rip subnets
Tham số subnets biểu thị khi RIP redistribute vào OSPF sẽ cung cấp các network theo classless
Lúc này tất cả các router đã học được các network của nhau
R3#show ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0
O E2 172.16.2.0 [110/20] via 172.16.3.2, 00:27:43, Serial1
C 172.16.3.0 is directly connected, Serial1
O 192.168.4.0 [110/65] via 172.16.4.1, 00:29:10, Serial0
O E2 192.168.1.0/24 [110/20] via 172.16.3.2, 00:29:10, Serial1
C 192.168.3.0/24 is directly connected, Ethernet0
R4#sh ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0/1
O E2 172.16.2.0 [110/20] via 172.16.4.2, 00:13:01, Serial0/0
O IA 172.16.3.0 [110/128] via 172.16.4.2, 00:13:01, Serial0/0
C 192.168.4.0/24 is directly connected, Ethernet0
O E2 192.168.1.0/24 [110/20] via 172.16.4.2, 00:13:01, Serial0/0
O IA 192.168.3.0 [110/65] via 172.16.4.2, 00:13:01, Serial0/0
NOTE:
Các route từ RIP khi được redistribute qua OSPF sẽ được hiểu là một External Link (Type 5)
Bước 4: Cấu hình redistribute các connected network vào OSPF
Ta thấy trong bảng routing của các router chạy OSPF chỉ còn thiếu network 192.168.2.0/24 của R2. Đó là do network này không được quảng bá trong OSPF. Vậy nên R2 cũng phải redistribute route này vào OSPF bằng
R2(config)#router ospf 100
R2(config-router)#redistribute connected subnets
Bây giờ, routing table của R3 và R4 đã có network 192.168.2.0/24 do R2 redistribute vào.
R3#sh ip route
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.4.0 is directly connected, Serial0
O E2 172.16.2.0 [110/20] via 172.16.3.2, 00:27:43, Serial1
C 172.16.3.0 is directly connected, Serial1
192.168.4.0/32 is subnetted, 1 subnets
O 192.168.4.1 [110/65] via 172.16.4.1, 00:29:10, Serial0
O E2 192.168.1.0/24 [110/20] via 172.16.3.2, 00:29:10, Serial1
O E2 192.168.2.0/24 [110/20] via 172.16.3.2, 00:26:33, Serial1
C 192.168.3.0/24 is directly connected, Ethernet0
Bước 5: Cấu hình redistribute các connected network vào RIP
Ta thấy trong bảng routing của các router chạy RIP (trong lab này là R1) chỉ còn thiếu network 192.168.2.0/24 của R2. Đó là do network này không được quảng bá trong RIP. Vậy nên R2 cũng phải redistribute route này vào RIP bằng lệnh :
R2(config)#router rip
R2(config-router)#redistribute connected
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
R 172.16.3.0 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.2.0/24 [120/1] via 172.16.2.1, 00:00:24, Serial0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
TIP:
Nếu routing table của R1 vẫn chưa xuất hiện network 192.168.2.0 thì ta dùng lệnh clear ip route * để R1 xây dựng routing table mới cho nhanh, nếu không bạn sẽ mất thời gian ngồi chờ RIP update.
FUN STUFF:
Giả sử bạn thêm vào R2 một route mới vào interface Loopback0 có địa chỉ là 172.16.10.1/24 và bạn hãy redistribute connected nó vào mạng RIP.
Sau đó ta bỏ redistribute connected trong RIP trên R2 thì routing table của R1 sẽ mất network 192.168.2.0 nhưng network 172.16.10.0 vẫn còn, mặc dù cả 2 route này đều có cùng bản chất là connected đối với R2
R2(config)#router rip
R2(config-router)#no redistribute connected
R1#clear ip route *
R1#show ip route
172.16.0.0/24 is subnetted, 2 subnets
C 172.16.2.0 is directly connected, Serial0
[fade:a3bd0b2b05]R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:24, Serial0[/fade:a3bd0b2b05]
R 172.16.4.0 [120/5] via 172.16.2.1, 00:00:06, Serial0
C 192.168.1.0/24 is directly connected, Ethernet0
R 192.168.3.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
R 192.168.4.0/24 [120/5] via 172.16.2.1, 00:00:06, Serial0
Đó là do R1 hiện đang chạy RIP, một classfull routing protocol, nên RIP chỉ nắm cả network 172.16.0.0.
Bạn hãy thử clear ip route * hoặc clear ip route 172.16.10.0, bạn sẽ thấy RIP lại học được lại route 172.16.10.0 lại sau một thời gian.
6. Cấu hình
R1#show running-config
Building configuration...
Current configuration : 960 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R1
!
interface Ethernet0
ip address 192.168.1.1 255.255.255.0
!
interface Serial0
ip address 172.16.2.2 255.255.255.0
clock rate 64000
!
router rip
network 172.16.0.0
network 192.168.1.0
!
line con 0
transport input none
line aux 0
line vty 0 4
login
!
R2#show running-config
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
interface Ethernet0/0
ip address 192.168.2.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.2.1 255.255.255.0
no ip directed-broadcast
!
interface Serial0/1
ip address 172.16.3.2 255.255.255.0
no ip directed-broadcast
clockrate 64000
!
router ospf 100
network 172.16.3.0 0.0.0.255 area 0
redistribute rip subnets
redistribute connected subnets
!
router rip
network 172.16.0.0
redistribute ospf 100 metric 5
redistribute connected
!
ip classless
no ip http server
!
line con 0
transport input none
line aux 0
line vty 0 4
!
R3#show running-config
Building configuration...
Current configuration:
!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R3
!
interface Ethernet0
ip address 192.168.3.1 255.255.255.0
!
interface Serial0
ip address 172.16.4.2 255.255.255.0
no ip directed-broadcast
clock rate 64000
!
interface Serial1
ip address 172.16.3.1 255.255.255.0
no ip directed-broadcast
clockrate 64000
!
router ospf 100
network 192.168.3.0 0.0.0.255 area 0
network 172.16.3.0 0.0.0.255 area 0
network 172.16.4.0 0.0.0.255 area 1
!
ip classless
no ip http server
!
line con 0
transport input none
line aux 0
line vty 0 4
!
R4#show running-config
Building configuration...
Current configuration : 960 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R4
!
interface Ethernet0/0
ip address 192.168.4.1 255.255.255.0
!
interface Serial0/0
ip address 172.16.4.1 255.255.255.0
!
router ospf 100
network 172.16.4.0 0.0.0.255 area 1
network 192.168.4.0 0.0.0.255 area 1
!
line con 0
transport input none
line aux 0
line vty 0 4
login
!