Tải bản đầy đủ (.doc) (12 trang)

distance and redistribution.

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (111.15 KB, 12 trang )

DISTANCE AND REDISTRIBUTION.
1. Mục tiêu và Giới thiệu:
Sử dụng các kỹ thuật distance và route redistribution.
Lệnh distance chỉ thay đổi Administrative distance (AD) của route khi route được cài đặt
vào bảng định tuyến. Do đó, lệnh distance chỉ có tác dụng bên trong router, và không ảnh
hưởng đến các router khác trong routing domain.
Kỹ thuật distance sử dụng lệnh distance để tăng AD của route. Tác dụng của việc này là:
Đối với load balancing có nhiều path đến cùng một network, ta có thể ưu tiên sử dụng
một path và loại bỏ các path khác, và tạo được các path dự phòng.
Khi một route được redistribution nhiều lần, và có thể sẽ được redistribute lại network đã
có route đó với AD thấp hơn (do độ ưu tiên của source protocol) nên có độ ưu tiên cao
hơn. Do đó, ta sẽ có hiện tượng suboptimal path hay routing loop. Vì vậy, cần cẩn thận
khi thay đổi distance của các route.
Lệnh distance tổng quát (distance <AD> được áp dụng đối với tất cả các protocol).
Ngoài ra, các protocol BGP, OSPF, EIGRP có lệnh distance riêng.
2. Bối cảnh.
Công ty ABC đang ở trong giai đoạn protocol migration, sử dụng OSPF và RIPv2 như
trong hình vẽ.
Do đó, cần có mutual redistribution giữa hai protocol để các network đều thấy nhau.
Đường đi B-C-D có băng thông thấp hơn, nên được sử dụng làm đường backup.
Chỉ có router A làm redistribution cho RIP vào OSPF.
Router A và D làm redistribution cho OSPF vào RIP tạo nên load balancing. Dùng AD để
chuyển BCD thành đường backup cho BAD.
3. Thực hiện.
Bước 1:
Xây dựng và cấu hình mạng theo sơ đồ nhưng chưa cấu hình OSPF. Dùng các lệnh CDP
và ping để kiểm tra các kết nốI trực tiếp vớI nhau.
Bước 2: Cấu hình RIP trên A, C, D.
Ta cấu hình RIPv2 cho cho các router A, C, D như sau:.
RouterA(config)#router rip
RouterA(config-router)#version 2


RouterA(config-router)#network 192.168.1.0
RouterA(config-router)#no auto-summary
RouterC(config)#router rip
RouterC(config-router)#version 2
RouterC(config-router)#no auto-summary
RouterC(config-router)#network 192.168.4.0
RouterD(config)#router rip
RouterD(config-router)#version 2
RouterD(config-router)#network 192.168.10.0
RouterD(config-router)#network 192.168.1.0
RouterD(config-router)#network 192.168.4.0
Kiểm tra trên các bảng định tuyến trên router A và C, ta sẽ thấy có 2 RIP route mới.
RouterA#show ip route
R 192.168.10.0/24 [120/1] via 192.168.1.2, 00:00:13, FastEthernet0/0
192.168.11.0/32 is subnetted, 1 subnets
R 192.168.4.0 [120/1] via 192.168.1.2, 00:00:13, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
192.168.2.0/25 is subnetted, 1 subnets
C 192.168.2.0 is directly connected, FastEthernet0/1
192.168.3.0/30 is subnetted, 1 subnets
RouterC#show ip route
R 192.168.10.0/24 [120/1] via 192.168.4.2, 00:00:09, Serial0/0
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/0
R 192.168.1.0/24 [120/1] via 192.168.4.2, 00:00:09, Serial0/0
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1
Bước 3: Cấu hình OSPF trên A, B, C.
Ta cấu hình OSPF cho router A, B, C như sau:
RouterA(config)#router ospf 1

RouterA(config-router)#network 192.168.2.0 0.0.0.127 area 0
RouterB(config)#router ospf 1
RouterB(config-router)#network 192.168.2.0 0.0.0.127 area 0
RouterB(config-router)#network 192.168.3.0 0.0.0.3 area 0
RouterB(config-router)#network 192.168.11.0 0.0.0.255 area 0
RouterC(config)#router ospf 1
RouterC(config-router)#network 192.168.3.0 0.0.0.3 area 0
Kiểm tra trên các bảng định tuyến trên router A và C, ta sẽ thấy có các route học từ OSPF
RouterA#show ip route
R 192.168.10.0/24 [120/1] via 192.168.1.2, 00:00:22, FastEthernet0/0
192.168.11.0/32 is subnetted, 1 subnets
O 192.168.11.1 [110/11] via 192.168.2.2, 00:11:25, FastEthernet0/1
192.168.4.0/30 is subnetted, 1 subnets
R 192.168.4.0 [120/1] via 192.168.1.2, 00:00:22, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
192.168.2.0/25 is subnetted, 1 subnets
C 192.168.2.0 is directly connected, FastEthernet0/1
192.168.3.0/30 is subnetted, 1 subnets
O 192.168.3.0 [110/74] via 192.168.2.2, 00:11:26, FastEthernet0/1
RouterC#show ip route
R 192.168.10.0/24 [120/1] via 192.168.4.2, 00:00:21, Serial0/0
192.168.11.0/32 is subnetted, 1 subnets
O 192.168.11.1 [110/65] via 192.168.3.2, 00:10:55, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/0
R 192.168.1.0/24 [120/1] via 192.168.4.2, 00:00:21, Serial0/0
192.168.2.0/25 is subnetted, 1 subnets
O 192.168.2.0 [110/74] via 192.168.3.2, 00:10:55, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1

Bước 4: Redistribute RIP vào OSPF.
Cấu hình redistribute RIP vào trong OSPF ở router A.
RouterA(config)#router osfpf 1
RouterA(config-router)#redistribute rip subnets
Các route mới sẽ xuất hiện trong routing table của router B
Kiểm tra các route trên router B.
RouterB#show ip route
O E2 192.168.10.0/24 [110/20] via 192.168.2.1, 00:00:31, Ethernet0/0
C 192.168.11.0/24 is directly connected, Loopback0
192.168.4.0/30 is subnetted, 1 subnets
O E2 192.168.4.0 [110/20] via 192.168.2.1, 00:00:31, Ethernet0/0
O E2 192.168.1.0/24 [110/20] via 192.168.2.1, 00:00:31, Ethernet0/0
192.168.2.0/25 is subnetted, 1 subnets
C 192.168.2.0 is directly connected, Ethernet0/0
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1
RouterC#show ip route
O E2 192.168.10.0/24 [110/20] via 192.168.3.2, 00:02:33, Serial0/1
192.168.11.0/32 is subnetted, 1 subnets
O 192.168.11.1 [110/65] via 192.168.3.2, 00:02:55, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/0
O E2 192.168.1.0/24 [110/20] via 192.168.3.2, 00:02:55, Serial0/1
192.168.2.0/25 is subnetted, 1 subnets
O 192.168.2.0 [110/74] via 192.168.3.2, 00:02:55, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1
Nhận xét :
Ta thấy Router C học được các route 192.168.10.0/24 và 192.168.1.0/24 qua miền OSPF
chứ không học qua RIP do AD của OSPF (110) nhỏ hơn AD của RIP (120).

Ở router C, để đi đến network 192.168.10.0/24, 192.168.1.0/24, packet phải đi qua
network 192.168.3.0/30 là không tối ưu (bandwidth s0/1 = 64K) trong khi nếu đi qua
network 192.168.4.0/30 sẽ nhanh do có bandwidth là 2M. Ta sẽ chỉnh lại đường đi của
packet sao cho tốt hơn.
Bước 5: distance OSPF.
Để lấy lại con đường tối ưu đã học được từ RIP trên router C, ta dùng lệnh distance ospf
nâng AD của các route này lên ( nghĩa là giảm độ ưu tiên xuống).
RouterC(config)#router ospf 1
RouterC(config-router)#distance ospf external 200
RouterC#clear ip route *
RouterC#show ip route
R 192.168.10.0/24 [120/1] via 192.168.4.2, 00:00:00, Serial0/0
192.168.11.0/32 is subnetted, 1 subnets
O 192.168.11.1 [110/65] via 192.168.3.2, 00:00:48, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/0
R 192.168.1.0/24 [120/1] via 192.168.4.2, 00:00:01, Serial0/0
192.168.2.0/25 is subnetted, 1 subnets
O 192.168.2.0 [110/74] via 192.168.3.2, 00:00:48, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1
Ta thấy các route 192.168.1.0/24 và 192.168.10.0/24 đã được học từ RIP do có AD (120)
nhỏ hơn AD của OSPF mà ta vừa cấu hình (200).
NOTE:
Để kiểm chứng việc thay đổi AD của OSPF, ta thử shutdown interface serial 0/0
(192.168.4.1)
RouterC#show ip route
O E2 192.168.10.0/24 [200/20] via 192.168.3.2, 00:00:08, Serial0/1
192.168.11.0/32 is subnetted, 1 subnets
O 192.168.11.1 [110/65] via 192.168.3.2, 00:05:09, Serial0/1

O E2 192.168.1.0/24 [200/20] via 192.168.3.2, 00:00:09, Serial0/1
192.168.2.0/25 is subnetted, 1 subnets
O 192.168.2.0 [110/74] via 192.168.3.2, 00:05:09, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
C 192.168.3.0 is directly connected, Serial0/1
Bước 6: Redistribute OSPF vào RIP.
RouterA(config)#router rip
RouterA(config-router)#redistribute ospf 1 metric 3
RouterC(config)#route rip
RouterC(config-router)#redistribute ospf 1 metric 3
Kiểm tra bảng định tuyến trên router A, C và D.
Ở 2 router A và D không có thay đổi. Nhưng ở router D, ta có multipath.
RouterD#show ip route
C 192.168.10.0/24 is directly connected, Loopback0
192.168.11.0/32 is subnetted, 1 subnets
R 192.168.11.1 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0
[120/3] via 192.168.4.1, 00:00:18, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
192.168.2.0/25 is subnetted, 1 subnets
R 192.168.2.0 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0
[120/3] via 192.168.4.1, 00:00:18, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
R 192.168.3.0 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0
[120/3] via 192.168.4.1, 00:00:18, Serial0/1
Để tối ưu hoá các multipath route trong RIP, ta dùng lệnh distance. Lệnh distance có thể
dùng chung cho tất cả các routing protocol.
Bước 7: configure distance.
Yêu cầu đặt ra, ta cần loại bỏ các route từ D đi đến 192.168.11.0/24 và 192.168.3.0/30.

Network 192.168.4.0/24 chỉ dùng làm dự phòng cho 192.168.1.0/24 để đi ra khỏi RIP
domain.
Do đường đi BAD ưu tiên hơn BCD, ta chỉnh AD của các route từ router C có AD cao
hơn, để loại các route này ra khỏi bảng routing table.
RouterD(config)#router rip
RouterD(config-router)#distance 200 192.168.4.1 0.0.0.0
Kiểm tra bảng định tuyến của router D. Các RIP route có next-hop là 192.168.4.1 đã bị
loại ra khỏi bảng định tuyến.
RouterD#clear ip route *
RouterD#show ip route
C 192.168.10.0/24 is directly connected, Loopback0
192.168.11.0/32 is subnetted, 1 subnets
R 192.168.11.1 [120/3] via 192.168.1.1, 00:00:08, Ethernet0/0
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
192.168.2.0/25 is subnetted, 1 subnets
R 192.168.2.0 [120/3] via 192.168.1.1, 00:00:08, Ethernet0/0
192.168.3.0/30 is subnetted, 1 subnets
R 192.168.3.0 [120/3] via 192.168.1.1, 00:00:08, Ethernet0/0
Bước 8: Kiểm tra tính dự phòng của AD.
Shutdown int fa0/0 của router A. Kiểm tra bảng định tuyến của router C. Các network
192.168.3.024 và 192.168.11.0/24 sẽ dùng 192.168.4.1 là next hop.
RouterD#clear ip route *
RouterD#show ip route
C 192.168.10.0/24 is directly connected, Loopback0
192.168.11.0/32 is subnetted, 1 subnets
R 192.168.11.1 [200/3] via 192.168.4.1, 00:00:02, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/1

C 192.168.1.0/24 is directly connected, Ethernet0/0
192.168.2.0/25 is subnetted, 1 subnets
R 192.168.2.0 [200/3] via 192.168.4.1, 00:00:02, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
R 192.168.3.0 [200/3] via 192.168.4.1, 00:00:02, Serial0/1
4. Phần làm thêm.
4.1 Dùng command distance <AD> với access-líst.
Giả sử phát sinh nhu cầu từ router D chỉ cho 1 một path đến 192.168.3.0/30 qua
192.168.4.1 và sử dụng multi-path đến 192.168.11.0/24. Như vậy ta cần phải loại bỏ
route 192.168.3.0 với next-hop là 192.168.1.1. Thực hiện trên router D:
RouterD(config)#ip access-list standard Filter
RouterD(config-std-nacl)# permit 192.168.3.0 0.0.0.3
RouterD(config-std-nacl)#exit
RouterD(config)#router rip
RouterD(config-router)#distance 200 192.168.4.1 0.0.0.0 Filter
Kiểm tra:
RouterD#clear ip route *
RouterD#show ip route
C 192.168.10.0/24 is directly connected, Loopback0
192.168.11.0/32 is subnetted, 1 subnets
R 192.168.11.1 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0
[120/3] via 192.168.4.1, 00:00:01, Serial0/1
192.168.4.0/30 is subnetted, 1 subnets
C 192.168.4.0 is directly connected, Serial0/1
C 192.168.1.0/24 is directly connected, Ethernet0/0
192.168.2.0/25 is subnetted, 1 subnets
R 192.168.2.0 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0
[120/3] via 192.168.4.1, 00:00:01, Serial0/1
192.168.3.0/30 is subnetted, 1 subnets
R 192.168.3.0 [120/3] via 192.168.1.1, 00:00:23, Ethernet0/0

5. Cấu hình.
RouterD#show run
Building configuration
Current configuration : 1182 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname RouterD
!
no logging buffered
!
ip subnet-zero
!
no ip finger
no ip domain-lookup
!
!
interface Loopback0
ip address 192.168.10.1 255.255.255.0
!
interface Ethernet0/0
ip address 192.168.1.2 255.255.255.0
half-duplex
!
interface Serial0/1
ip address 192.168.4.2 255.255.255.252

!
router rip
version 2
network 192.168.1.0
network 192.168.4.0
network 192.168.10.0
distance 200 192.168.4.1 0.0.0.0 Filter
no auto-summary
!
ip kerberos source-interface any
ip classless
no ip http server
!
!
ip access-list standard Filter
permit 192.168.3.0 0.0.0.3
!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
privilege level 15
no login
terminal-type monitor
!
End
RouterC#show run
Building configuration
Current configuration:

!
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname RouterC
!
ip subnet-zero
!
interface Serial0/0
ip address 192.168.4.1 255.255.255.252
no ip directed-broadcast
clockrate 64000
!
interface Serial0/1
ip address 192.168.3.1 255.255.255.252
no ip directed-broadcast
!
router ospf 1
network 192.168.3.0 0.0.0.3 area 0
distance ospf external 200
!
router rip
version 2
redistribute ospf 1 metric 3
network 192.168.4.0
no auto-summary
!
ip classless

!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
privilege level 15
no login
!
End
RouterB#show run
Building configuration
Current configuration:
!
version 11.3
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname RouterB
!
enable password cisco
!
memory-size iomem 10
ip subnet-zero
!
interface Loopback0
ip address 192.168.11.1 255.255.255.0
!
interface Ethernet0/0

ip address 192.168.2.2 255.255.255.128
!
interface Serial0/1
ip address 192.168.3.2 255.255.255.252
clockrate 64000
!
router ospf 1
network 192.168.2.0 0.0.0.127 area 0
network 192.168.3.0 0.0.0.3 area 0
network 192.168.11.0 0.0.0.255 area 0
!
ip classless
!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
privilege level 15
no login
RouterA#show run
Building configuration
Current configuration : 1083 bytes
!
version 12.1
no service single-slot-reload-enable
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!

hostname RouterA
!
logging rate-limit console 10 except errors
enable password cisco
!
ip subnet-zero
!
no ip finger
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.128
duplex auto
speed auto
!
router ospf 1
redistribute rip subnets
network 192.168.2.0 0.0.0.127 area 0
!
router rip
version 2
redistribute ospf 1 metric 3
network 192.168.1.0
no auto-summary
!
ip kerberos source-interface any

ip classless
no ip http server
!
line con 0
logging synchronous
transport input none
line aux 0
line vty 0 4
privilege level 15
no login
!
end

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×