Transcript
Page 1: Redistribute Giữa ISIS Và OSPF

Redistribute giữa ISIS và OSPFTác giả: Nguyễn Thị Băng Tâm

Trong bài này sẽ thực hiện redistribute giữa hai giao thức classless là OSPF và ISIS với nhau .Mục tiêu bài làm :Thực hiện multiple redistribute points (redistribute tại nhiều điểm )Chỉ ra vấn đề gặp phải khi redistribute và cách giải quyết vấn đề đó .Từ một router ping thấy tất cả các địa chỉ trong mạng .Mô hình mạng như sau : router R3 và R4 sẽ chạy giao thức OSPF , R5 chạy giao thức ISIS. Router R4 và R1 sẽ là các router thực hiện redistribute .

Địa chỉ trên các interface của các router :

Router Interface địa chỉRouter R1 E0/0

S0/0172.16.1.1/24172.16.2.2 /30

Router R2 S0/0E0/0

172.16.2.1/30192.168.4.2/24

Router R3 E0/0S0/0

192.168.4.1/24192.168.1.1/24

Router R4 S0/1S0/0

192.168.1.2/24192.168.2.1/30

Router R5 S0/0E0/0Loopback 0

192.168.2.2/30172.16.1.2/2410.1.1.1/24

Page 2: Redistribute Giữa ISIS Và OSPF

Cấu hình ban đầu :

R1!hostname R1!enable password cisco!interface Ethernet0/0 ip address 172.16.1.1 255.255.255.0!interface Serial0/0ip address 172.16.2.2 255.255.255.252!end

R2!hostname R2!interface Ethernet0/0 ip address 192.168.4.2 255.255.255.0!interface Serial0/0 ip address 172.16.2.1 255.255.255.252 clockrate 64000!ip classless!end

R3!hostname R3!interface Ethernet0/0 ip address 192.168.4.1 255.255.255.0 half-duplex!interface Serial0/0 ip address 192.168.1.1 255.255.255.0

Page 3: Redistribute Giữa ISIS Và OSPF

no fair-queue!end

R4!hostname R4!interface Ethernet0/0 ip address 192.168.100.1 255.255.255.0!interface Serial0/0 ip address 192.168.2.1 255.255.255.0 clockrate 64000 no fair-queue!interface Serial0/1 ip address 192.168.1.2 255.255.255.0 clockrate 64000!ip http serverip classless!end

R5!hostname R5!interface Loopback0 ip address 10.1.1.1 255.255.255.0 no ip directed-broadcast!interface Ethernet0/0ip address 172.16.1.2 255.255.255.0 no ip directed-broadcast!interface Serial0/0 ip address 192.168.2.2 255.255.255.252!ip classlessend

Cấu hình ban đầu cho các router :R1

Page 4: Redistribute Giữa ISIS Và OSPF

Router# configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R1R1(config)#line console 0R1(config-line)#password ciscoR1(config-line)#loginR1(config)#line vty 0 4R1(config-line)#password ciscoR1(config-line)#loginR1(config-line)#exitR1(config)#enable password ciscoR1(config)#interface s0/0R1(config-if)#ip address 172.16.2.2 255.255.255.252 R1(config-if)#clock rate 64000R1(config-if)#no shutdownR1(config-if)#int e0/0R1(config-if)#ip address 172.16.1.1 255.255.255.0R1(config-if)#no shutdownR1(config-if)#exitR1(config)#

cấu hình cho router R2 :

Router>enableRouter#configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R2R2(config)#line console 0R2(config-line)#password ciscoR2(config-line)#line vty 0 4R2(config-line)#no loginR2(config-line)#exitR2(config)#interface e0/0R2(config-if)#ip address 192.168.4.2 255.255.255.0R2(config-if)#no shutdownR2(config-if)#interface s0/0R2(config-if)#ip address 172.16.2.1 255.255.255.252R2(config-if)#clock rate 64000R2(config-if)#no shutdownR2(config-if)#exitR2(config)#^ZR2#

cấu hình cho router R3 :

Page 5: Redistribute Giữa ISIS Và OSPF

Router# configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R3R3(config)#line console 0R3(config-line)#password ciscoR3(config-line)#line vty 0 4R3(config-line)#no loginR3(config-line)#exitR3(config)#interface s0/0R3(config-if)#ip address 192.168.1.1 255.255.255.0R3(config-if)#clock rate 64000R3(config-if)#no shutdownR3(config-if)#interface e0/0R3(config-if)#ip address 192.168.4.1 255.255.255.0R3(config-if)#no shutdownR3(config-if)#exitR3(config)#^ZR3#

cấu hình cho router R4 :

Router# configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R4R4(config)#line console 0R4(config-line)#password ciscoR4(config-line)#line vty 0 4R4(config-line)#no loginR4(config-line)#exitR4(config)#interface s0/1R4(config-if)#ip address 192.168.1.2 255.255.255.0R4(config-if)#clock rate 64000R4(config-if)#no shutdownR4(config-if)#interface s0/0R4(config-if)#ip address 192.168.2.1 255.255.255.252R4(config-if)#clock rate 64000R4(config-if)#no shutdownR4(config-if)#exitcấu hình cho router R5 :Router# configure terminalEnter configuration commands, one per line. End with CNTL/Z.Router(config)#hostname R5R5(config)#line console 0R5(config-line)#password ciscoR5(config-line)#line vty 0 4R5(config-line)#no login

Page 6: Redistribute Giữa ISIS Và OSPF

R5(config-line)#exitR5(config)#interface s0/0R5(config-if)#ip address 192.168.2.2 255.255.255.252R5(config-if)#clock rate 64000R5(config-if)#no shutdownR5(config-if)#interface e0/0R5(config-if)#ip address 172.16.1.2 255.255.255.0R5(config-if)#no shutdownR5(config-if)#interface loopback 0R5(config-if)#ip address 10.1.1.1 255.255.255.0R5(config-if)#^ZR5#

kiểm tra bảng định tuyến :

R1#show ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0

R2#show ip routeGateway of last resort is not set

172.16.0.0/30 is subnetted, 1 subnetsC 172.16.2.0 is directly connected, Serial0/0C 192.168.4.0/24 is directly connected, Ethernet0/0

R3#show ip routeGateway of last resort is not setC 192.168.4.0/24 is directly connected, Ethernet0/0C 192.168.1.0/24 is directly connected, Serial0/0

R4#show ip routeGateway of last resort is not setC 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0/30 is directly connected, Serial0/0

R5#show ip routeGateway of last resort is not set

172.16.0.0/24 is subnetted, 1 subnetsC 172.16.1.0 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnets

Page 7: Redistribute Giữa ISIS Và OSPF

C 10.1.1.0 is directly connected, Loopback0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Cấu hình định tuyến cho các router .Router R2,R3, interface s0/0 của R1 và interface s0/1 của R4 chạy OSPF process 1 ,còn lại là chạy ISIS .Ta biết cấu hình ISIS đòi hỏi cần phải có địa chỉ NET ,mỗi system-ID đại diện cho mỗi node, ta có thể gắn nó một cách tùy ý nhưng để đảm bảo system-ID là duy nhất của mỗi router trong một area ta sẽ sử dụng địa chỉ Mac .Ta kiểm tra địa chỉ Mac của thiết bị bằng cách show arp hoặc show interface .

R1#show arpProtocol Address Age (min) Hardware Addr Type InterfaceInternet 172.16.1.1 - 0004.c052.7ce0 ARPA Ethernet0/0

R4#show interface e0/0Ethernet0/0 is administratively down, line protocol is down Hardware is AmdP2, address is 0002.4b79.9ca0 (bia 0002.4b79.9ca0) Internet address is 192.168.100.1/24 MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec, reliability 252/255, txload 1/255, rxload 1/255 <omitted>

R5#sh arpProtocol Address Age (min) Hardware Addr Type InterfaceInternet 172.16.1.2 - 00d0.ba1a.f080 ARPA Ethernet0/0

Cấu hình như sau : R1(config)#router ospf 1R1(config-router)#network 172.16.2.0 0.0.0.3 area 0R1(config-router)#exitR1(config)#clns routingR1(config)#router isisR1(config-router)#net 01.0001.0004.c052.7ce0.00R1(config-router)#exitR1(config)#interface e0/0R1(config-if)#ip router isisR1(config-if)#^ZR1#

R2(config)#router ospf 1R2(config-router)#network 192.168.4.0 0.0.0.255 area 0R2(config-router)#network 172.16.2.0 0.0.0.3 area 0R2(config-router)#exitR2(config)#^Z

Page 8: Redistribute Giữa ISIS Và OSPF

R3(config)#router ospf 1R3(config-router)#network 192.168.4.0 0.0.0.255 area 0R3(config-router)#network 192.168.1.0 0.0.0.255 area 0R3(config-router)#exitR3(config)#^Z

R4(config)#router ospf 1R4(config-router)#network 192.168.1.0 0.0.0.255 area 0R4(config-router)#exitR4(config)#clns routingR4(config)#router isisR4(config-router)#net 01.0001.0002.4b79.9ca0.00R4(config-router)#exitR4(config)#int s0/0R4(config-if)#ip router isisR4(config-if)#^Z

R5(config)#clns routingR5(config)#router isis R5(config-router)#net 01.0001.00d0.ba1a.f080.00R5(config-router)#int s0/0R5(config-if)#ip router isisR5(config-if)#int e0/0R5(config-if)#ip router isisR5(config-if)#exitR5(config)#int loopback 0R5(config-if)#ip router isisR5(config)#^Z

kiểm tra lại bảng định tuyến :

R1#sh ip routeGateway of last resort is not set 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0O 192.168.4.0/24 [110/74] via 172.16.2.1, 00:03:18, Serial0/0 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 172.16.1.2, Ethernet0/0O 192.168.1.0/24 [110/138] via 172.16.2.1, 00:03:18, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsi L1 192.168.2.0 [115/20] via 172.16.1.2, Ethernet0/0

Những route nào học từ ISIS sẽ bắt đầu bằng i. Trong bài này các router chạy ISIS để mặc định là L1/L2 router và các router đang chạy level – 1 routing nên

Page 9: Redistribute Giữa ISIS Và OSPF

có kí hiệu là L1 .Đối với metric của ISIS thì loại metric có chiều dài là 1 byte. Bit 8 chỉ ra sự hiện diện của loại metric trong TLV.Bit 7 được dùng để phân loại metric là internal hay là external .Internal metric đề cập đến các route được tạo ra trong miền ISIS , trong khi đó external route đề cập đến các route bên ngoài miền ISIS hoặc là từ các giao thức định tuyến khác. 6 bit còn lại dành cho việc tính toán thực sự giá trị của metric. Do đó ta có giá trị cost cực đại của default metric là 63 trên một link . Đối với Cisco router cost của một link được quyết định bởi giá trị được đăng kí đến interface ngõ ra . Cisco đăng kí default metric là 10 cho mỗi interface mà không quan tâm interface đó thuộc loại nào. Lúc này mỗi subnetwork được xem là bằng nhau và ISIS metric được tính toán đơn giản bằng cách tính tổng các hop-count nó phải đi qua để đến đích , mỗi hop có cost là 10. Ví dụ trong bảng định tuyến của R1 ta thấy ,route 192.168.2.0 có metric là 20 vì nó đi qua R5,R1. Cost của các route học được từ OSPF được tính tương tự như bài redistribute giữa classfull và classless. Cost của 192.168.1.0/24 là 138 vì nó phải đi qua 2 serial interface (mỗi interface có cost là 64) và một ethernet interface (có cost là 10). Cách tính cost của OSPF là không đổi khi thực hiện redistribute ,do đó trong bài này ta sẽ không xét kĩ về nó .

R2#show ip routeGateway of last resort is not set 172.16.0.0/30 is subnetted, 1 subnetsC 172.16.2.0 is directly connected, Serial0/0C 192.168.4.0/24 is directly connected, Ethernet0/0O 192.168.1.0/24 [110/74] via 192.168.4.1, 00:00:05, Ethernet0/0

R3#sh ip routeGateway of last resort is not set 172.16.0.0/30 is subnetted, 1 subnetsO 172.16.2.0 [110/74] via 192.168.4.2, 00:01:07, Ethernet0/0C 192.168.4.0/24 is directly connected, Ethernet0/0C 192.168.1.0/24 is directly connected, Serial0/0

R4#sh ip routeGateway of last resort is not set 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksi L1 172.16.1.0/24 [115/20] via 192.168.2.2, Serial0/0O 172.16.2.0/30 [110/138] via 192.168.1.1, 00:01:51, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:01:51, Serial0/1 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 192.168.2.2, Serial0/0C 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

R5#show ip routeGateway of last resort is not set

Page 10: Redistribute Giữa ISIS Và OSPF

172.16.0.0/24 is subnetted, 1 subnetsC 172.16.1.0 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Kiểm tra bằng lệnh ping :R4#ping 172.16.2.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/40 ms

R2#ping 192.168.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

R4#ping 10.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/29/32 ms

R4#ping 192.168.4.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.4.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms

R2#ping 192.168.2.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)

R2 không thể ping 192.168.2.1 được vì R2 chạy giao thức OSPF còn mạng 192.168.2.0/24 sử dụng ISIS .Muốn thực hiện ping thành công ta phải redistribute giữa hai giao thức . cấu hình redistribute được thực hiện trên cả hai routert R1 và R4 được gọi là multiple redistribute points Cấu hình như sau :

R4(config)#router ospf 1R4(config-router)#redistribute isis level-1 metric 20 % Only classful networks will be redistributed

Page 11: Redistribute Giữa ISIS Và OSPF

R4(config-router)#router isis R4(config-router)#redistribute ospf 1 metric 10 level-1-2 R4(config-router)#exit

R1(config)#router ospf 1R1(config-router)#redistribute isis level-1 metric 20% Only classful networks will be redistributedà redistribute các route ISIS vào OSPF với metric là 20 và các route này đóng vai trò là level-1. R1(config-router)#router isisR1(config-router)#redistribute ospf 1 metric 10 level-1-2à redistribute những route OSPF vào ISIS với metric là 10 và các route có vai trò level-1-2 route .

Kiểm tra bảng định tuyến :

R2#show ip routeGateway of last resort is not set 172.16.0.0/30 is subnetted, 1 subnetsC 172.16.2.0 is directly connected, Serial0/0C 192.168.4.0/24 is directly connected, Ethernet0/0O 192.168.1.0/24 [110/74] via 192.168.4.1, 00:11:09, Ethernet0/0

à trên bảng định tuyến của R2 không học được route nào từ ISIS lí do là vì chỉ có những classfull networks mới được đi vào OSPF .

R5#sh ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0i L1 172.16.2.0/30 [115/20] via 192.168.2.1, Serial0/0 [115/20] via 172.16.1.1, Ethernet0/0i L1 192.168.4.0/24 [115/20] via 192.168.2.1, Serial0/0 [115/20] via 172.16.1.1, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0i L1 192.168.1.0/24 [115/20] via 192.168.2.1, Serial0/0 [115/20] via 172.16.1.1, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Để R2,R3 thấy được các route trong ISIS ta thêm vào trong câu lệnh redistribute một subnets.R4(config)#router ospf 1

Page 12: Redistribute Giữa ISIS Và OSPF

R4(config-router)#no redistribute isis level-1 metric 20R4(config-router)#redistribute isis level-1 metric 20 subnetsR4(config-router)#router isis R4(config-router)#no redistribute ospf 1 metric 10 level-1-2 R4(config-router)#redistribute ospf 1 metric 10 metric-type externalà các route được redistribute vào ISIS có thể là internal route hoặc external route (internal là default) hoặc là level 1 ,hoặc là level 2 (level 2 là default ). Trong cấu hình trên các OSPF route được redistribute như là external route với default metric là 10 .

R1(config)#router ospf 1R1(config-router)#no redistribute isis level-1 metric 20R1(config-router)#redistribute isis level-1 metric 20 subnets R1(config-router)#router isisR1(config-router)#no redistribute ospf 1 metric 10 level-1-2R1(config-router)#redistribute ospf 1 metric 10 metric-type external

Kiểm tra bảng định tuyến: R4#show ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksi L1 172.16.1.0/24 [115/20] via 192.168.2.2, Serial0/0O 172.16.2.0/30 [110/138] via 192.168.1.1, 00:23:26, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:23:26, Serial0/1 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 192.168.2.2, Serial0/0C 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0à bảng định tuyến của R4 không có gì thay đổi .

R1#sh ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0O 192.168.4.0/24 [110/74] via 172.16.2.1, 00:23:14, Serial0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 172.16.2.1, 00:10:32, Serial0/0O 192.168.1.0/24 [110/138] via 172.16.2.1, 00:23:14, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsi L1 192.168.2.0 [115/20] via 172.16.1.2, Ethernet0/0à bảng định tuyến đã khác trước ,có sự xuất hiện một external route .Đó là route 10.1.1.0 được học thông qua OSPF qua interface 172.16.2.1 thay vì học

Page 13: Redistribute Giữa ISIS Và OSPF

trực tiếp từ router R5 .Ở đây ta gặp phải một vấn đề ,cả R1 và R4 đều đang redistribute các route được học bởi ISIS vào OSPF.R4 học mạng 10.1.1.0 thông qua ISIS và quảng bá vào OSPF domain .Kết quả là R1 học mạng 10.1.1.0 không phải từ R5 mà từ R2 thông qua OSPF .

R1#traceroute 10.1.1.1Type escape sequence to abort.Tracing the route to 10.1.1.1 1 172.16.2.1 16 msec 16 msec 12 msec 2 192.168.4.1 16 msec 16 msec 16 msec 3 192.168.1.2 28 msec 28 msec 28 msec 4 192.168.2.2 44 msec 16 msec *

R4#traceroute 10.1.1.1Type escape sequence to abort.Tracing the route to 10.1.1.1 1 192.168.2.2 20 msec 24 msec *

Ta reload lại router R4 ,quan sát bảng định tuyến của cả 2 router R1 và R4 :R1#sh ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0i L2 192.168.4.0/24 [115/94] via 172.16.1.2, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 172.16.1.2, Ethernet0/0i L2 192.168.1.0/24 [115/94] via 172.16.1.2, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsi L1 192.168.2.0 [115/20] via 172.16.1.2, Ethernet0/0à R1 xem R5 như là next hop để đi đến route 10.1.1.0 ,do đó có kí hiệu L1 .Bảng định tuyến cũng cho thấy R1 xem route 192.168.1.0 là level-2 , metric 94 cho thấy đây là external route.

Trong khi đó thì R4 lại xem 10.1.1.0 như là một route bên ngoài mà nó học được thông qua R3.

R4#show ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksi L1 172.16.1.0/24 [115/20] via 192.168.2.2, Serial0/0O 172.16.2.0/30 [110/138] via 192.168.1.1, 00:00:18, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:00:18, Serial0/1 10.0.0.0/24 is subnetted, 1 subnets

Page 14: Redistribute Giữa ISIS Và OSPF

O E2 10.1.1.0 [110/20] via 192.168.1.1, 00:00:00, Serial0/1C 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Sự hội tụ trong một mạng : các router chia sẽ thông tin định tuyến với nhau , nhưng mỗi cá nhân router phải tự tính toán bảng định tuyến của chúng .Đối với mỗi bảng định tuyến cá nhân đó được chính xác , các router đã có một cái nhìn chung về topology mạng .Lúc này mạng được xem là hội tụ .Nếu mạng đang trong quá trình hội tụ ,sẽ dễ dàng xảy ra nhiều vấn đề định tuyến như router nghĩ rằng một link đang up trong khi thật sự là nó đang bị down dẫn đến bảng định tuyến sai và loop dễ dàng xảy ra .Mạng được xem là hội tụ nhanh khi khôi phục được sự cố (như lỗi liên kết hoặc sự thay đổi về mạng ) một cách nhanh chóng .Các giao thức link-state hội tụ mạng rất nhanh vì khi có sự thay đổi xảy ra trong mạng ,sự thay đổi này ngay lập tức được gửi đi bằng multicast tới các neighbor trong partial update (tức là update chỉ gồm có sự thay đổi này ) điều này làm loop khó có thể xảy ra trong một mạng chạy toàn giao thức link- state .Trở lại với bài trên ,ta thấy loop đã không xảy ra nhưng trong cả hai trường hợp ,router R1 và R4 đều chọn con đường đi không tối ưu đến mạng 10.1.1.0 .R1 thay vì xem R5 như là next hop để đến đích thì nó lại xem R2 như là next hop .R4 cũng tương tự .Ta có thể giải thích điều này như sau : (xem bảng định tuyến trước khi R4 được reload )giả sử cả hai router R1 và R4 thực hiện redistribute cùng một thời điểm .Cả hai router đều gửi OSPF update trong đó có mạng 10.1.1.0 ,R4 may mắn hơn ,nó gửi update nhanh hơn R1. R4 chỉ gửi những route mà nó học từ ISIS vào OSPF , đó là những route 172.16.1.0 và 10.1.1.0 , nó không gửi những route kết nối trực tiếp hoặc là những route nó đã được học thông qua OSPF.R3 nhận update từ R4 , xem R4 như là next –hop router (quan sát bảng định tuyến của R3 ,những route học từ R4 được tô đậm ) và gửi update đến R2 .

R3#show ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksO E2 172.16.1.0/24 [110/20] via 192.168.1.2, 00:28:39, Serial0/0O 172.16.2.0/30 [110/74] via 192.168.4.2, 00:41:20, Ethernet0/0C 192.168.4.0/24 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 192.168.1.2, 00:28:39, Serial0/0C 192.168.1.0/24 is directly connected, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsO E2 192.168.2.0 [110/20] via 192.168.4.2, 00:14:14, Ethernet0/0

R2 , nhận update từ R3 ,xem R3 là next-hop router .

Page 15: Redistribute Giữa ISIS Và OSPF

R2#show ip route 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksO E2 172.16.1.0/24 [110/20] via 192.168.4.1, 00:00:40, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0C 192.168.4.0/24 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 192.168.4.1, 00:00:40, Ethernet0/0O 192.168.1.0/24 [110/74] via 192.168.4.1, 00:00:40, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsO E2 192.168.2.0 [110/20] via 172.16.2.2, 00:00:40, Serial0/0 R1 và R2 gửi update cho nhau . Khi nhận được update của R2 về mạng 10.1.1.0 , router R1 nghĩ rằng đường đi đến mạng 10.1.1.0 qua R2 tốt hơn vì có AD nhỏ hơn , dẫn đến R1 cập nhập bảng định tuyến và xem R2 như là next-hop. R1 không cập nhập những route còn lại từ R2 vì bản thân trong bảng định tuyến của nó đã tồn tại những route đó với AD tốt hơn . Khi R2 nhận update từ R1 , nó chỉ cập nhập route 192.168.2.0 . Lúc này R2 xem R1 như là next-hop để đi đến mạng 192.168.2.0 , R2 lại gửi update về mạng 192.168.2.0 cho R3 ,R3 xem R2 là next –hop để đến mạng 192.168.2.0 (xem bảng định tuyến ).Bảng định tuyến của R5 ,R5 cân bằng tải giữa hai đường :

R5#show ip route 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0i L2 172.16.2.0/30 [115/84] via 192.168.2.1, Serial0/0 [115/84] via 172.16.1.1, Ethernet0/0i L2 192.168.4.0/24 [115/84] via 192.168.2.1, Serial0/0 [115/84] via 172.16.1.1, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0i L2 192.168.1.0/24 [115/84] via 192.168.2.1, Serial0/0 [115/84] via 172.16.1.1, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Khi ra reload lai router R4 , quá trình học route của các router diễn ra như sau : R5 ,R3 nhận ra sự thay đổi trong mạng ,ngay lập tức chúng gửi update chỉ bao gồm thông tin về sự thay đổi đó cho các router chạy cùng giao thức với chúng ,trong trường hợp này R5 gửi update cho R1 , R3 gửi update cho R2 . R1 cũng có thể nhận update cho biết về sự thay đổi trong mạng từ R2 nhưng vì ISIS hội tụ nhanh hơn OSPF nên R1 sẽ update thông tin từ R5. R1 xem R5 là next-hop để đi đến các route còn lại trong mạng .

Page 16: Redistribute Giữa ISIS Và OSPF

R1#sh ip routeGateway of last resort is not set 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0i L2 192.168.4.0/24 [115/94] via 172.16.1.2, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 172.16.1.2, Ethernet0/0i L2 192.168.1.0/24 [115/94] via 172.16.1.2, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsi L1 192.168.2.0 [115/20] via 172.16.1.2, Ethernet0/0

Khi R1 đã có đầy đủ thông tin về mạng của nó , là khi các mạng trong ISIS đã hội tụ xong , R1 liền gửi ngay update đến cho R2 ,trong update chỉ bao gồm những route bên trong nó học được từ ISIS (những route có kí tự L1 phía trước ), R2 cập nhập update và gửi cho R3 ,R3 lại gửi cho R4 .R4 xem R3 như là next-hop .Do đó khi R4 cập nhập update nó sẽ chọn đường đi đến mạng 10.1.1.0 qua R3 vì nó thấy đường đi qua R3 có AD nhỏ hơn .

R4#show ip routeGateway of last resort is not set 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksi L1 172.16.1.0/24 [115/20] via 192.168.2.2, Serial0/0O 172.16.2.0/30 [110/138] via 192.168.1.1, 00:00:18, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:00:18, Serial0/1 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 192.168.1.1, 00:00:00, Serial0/1C 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Qua phân tích trên ta thấy administrative distance có thể gây việc chọn đường đi không tối ưu mà trong một vài giao thức khác như RIP ,IGRP có thể gây loop , làm chậm lại quá trình hội tụ. có nhiều cách giải quyết vấn đề này như là sử dụng route filtering , thay đổi administrative distance bằng phương pháp thủ công , hay là sử dụng route map .Trong bài này ta sẽ thay đổi AD bằng cách dùng thêm câu lệnh distance để giải quyết vấn đề sub-optimal route , mà trong một vài trường hợp loop và black-hole có thể xảy ra .Thay đổi AD sao cho R1 muốn đi đến mạng 10.1.1.0 và 192.168.1.0 phải coi router R5 là next-hop .R4 muốn đi đến mạng 10.1.1.0 và 172.16.1.0 phải coi R5 là next-hop. R2,R3 có thể tùy ý chọn lựa đường .

cấu hình như sau : R4(config)#router ospf 1

Page 17: Redistribute Giữa ISIS Và OSPF

R4(config-router)#distance 130R4(config-router)#distance 110 0.0.0.0 255.255.255.255 1R4(config-router)#router isis R4(config-router)#distance 130R4(config-router)#distance 115 192.168.2.2 0.0.0.0 2R4(config-router)#exit

R4(config)#access-list 1 permit 192.168.4.0R4(config)#access-list 1 permit 172.16.2.0 0.0.0.3R4(config)#access-list 2 permit 10.1.1.0 0.0.0.255R4(config)#access-list 2 permit 172.16.1.0 0.0.0.255

R1(config)#router ospf 1R1(config-router)#distance 130 R1(config-router)#distance 110 0.0.0.0 255.255.255.255 1R1(config-router)#router isisR1(config-router)#distance 130R1(config-router)#distance 115 172.16.1.2 0.0.0.0 2R1(config-router)#exitR1(config)#access-list 1 permit 192.168.4.0 0.0.0.255R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255R1(config)#access-list 2 permit 10.1.1.0 0.0.0.255R1(config)#access-list 2 permit 172.16.1.0 0.0.0.255

R1#sh run!router ospf 1 log-adjacency-changes redistribute isis level-1 metric 20 subnets network 172.16.2.0 0.0.0.3 area 0 distance 130 distance 110 0.0.0.0 255.255.255.255 1!router isis net 01.0001.0004.c052.7ce0.00 redistribute ospf 1 metric 10 metric-type external distance 130 clns distance 115 172.16.1.2 0.0.0.0 2!!access-list 1 permit 192.168.4.0 0.0.0.255access-list 1 permit 192.168.1.0 0.0.0.255access-list 2 permit 10.1.1.0 0.0.0.255access-list 2 permit 192.168.2.0 0.0.0.255!

Page 18: Redistribute Giữa ISIS Và OSPF

R4#sh run!router ospf 1 log-adjacency-changes redistribute isis level-1 metric 20 subnets network 192.168.1.0 0.0.0.255 area 0 distance 130 distance 110 0.0.0.0 255.255.255.255 1!router isis net 01.0001.0002.4b79.9ca0.00 redistribute ospf 1 metric 10 metric-type external distance 130 clns distance 115 192.168.2.2 0.0.0.0 2!access-list 1 permit 192.168.4.0access-list 1 permit 172.16.2.0 0.0.0.3access-list 2 permit 10.1.1.0 0.0.0.255access-list 2 permit 172.16.1.0 0.0.0.255!

Câu lệnh distance đầu tiên trong hai cấu hình thiết lập distance mặc định cho các route của OSPF và ISIS là 130 . Câu lệnh distance thứ hai thiết lập một distance khác tùy theo router quảng bá nào được chỉ định và có tham chiếu đến access-list .Chẳng hạn trên router R1 , tiến trình ISIS của R1 đăng kí distance là 115 cho các route được quảng bá bởi R5 và được cho phép bởi access-list 2 .Tất cả các route còn lại được gán distance bằng 130 . Inverse mask được sử dụng trong địa chỉ của router quảng bá (cụ thể là R5 ) chỉ ra chính xác interface nào mà R1 cần đi đến .Đối với OSPF , địa chỉ và inverse mask trong câu lệnh distance là 0.0.0.0 255.255.255.255 chỉ định bất kì router nào .Các route OSPF từ tất cả các router được cho phép bởi access- list 1 được đăng kí một distance là 110 , tất cả các route còn lại khác có distance là 130 .Câu lệnh distance trong R4 được giải thích tương tự .Kết quả là ta có bảng định tuyến sau :

R4#sh ip route

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksi L1 172.16.1.0/24 [115/20] via 192.168.2.2, Serial0/0O 172.16.2.0/30 [110/138] via 192.168.1.1, 00:57:37, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:57:37, Serial0/1 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 192.168.2.2, Serial0/0C 192.168.1.0/24 is directly connected, Serial0/1 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Page 19: Redistribute Giữa ISIS Và OSPF

R1#sh ip route

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0O 192.168.4.0/24 [110/74] via 172.16.2.1, 00:00:53, Serial0/0 10.0.0.0/24 is subnetted, 1 subnetsi L1 10.1.1.0 [115/20] via 172.16.1.2, Ethernet0/0O 192.168.1.0/24 [110/138] via 172.16.2.1, 00:00:53, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsi L1 192.168.2.0 [115/20] via 172.16.1.2, Ethernet0/0

Trong bảng định tuyến của R4 ta thấy rằng , R4 đang định tuyến đến tất cả các mạng trong miền OSPF thông qua R3 và đến tất cả các mạng trong miền ISIS thông qua R5 . Distance của OSPF và ISIS được gắn cho các route .Bảng định tuyến của R1 tương tự .Để thấy rõ hơn ý nghĩa của câu lệnh distance 130 ,ta giả sử interface giữa R5 và R4 down .

R4(config)#int s0/0R4(config-if)#shutdown*Mar 1 01:44:29.056: %LINK-5-CHANGED: Interface Serial0/0, changed state to administratively down*Mar 1 01:44:30.058: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down

kiểm tra lại bảng định tuyến của R4 : R4#sh ip routeGateway of last resort is not set

172.16.0.0/30 is subnetted, 1 subnetsO 172.16.2.0 [110/138] via 192.168.1.1, 00:37:45, Serial0/1O 192.168.4.0/24 [110/74] via 192.168.1.1, 00:37:45, Serial0/1 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [130/20] via 192.168.1.1, 00:00:22, Serial0/1C 192.168.1.0/24 is directly connected, Serial0/1Bảng định tuyến cho thấy tất cả các route bây giờ đi đến R4 thông qua R3 .Các route đến các mạng trong miền ISIS có distance là 130 , đây là route mà R4 học được thông qua OSPF có metric là 20 vì là external route .Khi kết nối trên interface của R4 và R5 được khôi phục trở lại, các bản tin quảng bá ISIS từ R5 với distance 115 sẽ thay thế các bản tin quảng bá OSPF với distance 130 .Tương tự ,giả sử khi kết nối giữa R5 và R1 bị down thì R1 cũng học các route trong miền ISIS thông qua OSPF với distance là 130 .

R1#sh ip route

Page 20: Redistribute Giữa ISIS Và OSPF

Gateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksO E2 172.16.1.0/24 [130/20] via 172.16.2.1, 00:00:03, Serial0/0C 172.16.2.0/30 is directly connected, Serial0/0O 192.168.4.0/24 [110/74] via 172.16.2.1, 00:00:03, Serial0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [130/20] via 172.16.2.1, 00:00:03, Serial0/0O 192.168.1.0/24 [110/138] via 172.16.2.1, 00:00:03, Serial0/0

Bảng định tuyến của các router còn lại khi tất cả các interface đều up là : R2#sh ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksO E2 172.16.1.0/24 [110/20] via 192.168.4.1, 00:00:45, Ethernet0/0C 172.16.2.0/30 is directly connected, Serial0/0C 192.168.4.0/24 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 172.16.2.2, 00:00:45, Serial0/0O 192.168.1.0/24 [110/74] via 192.168.4.1, 01:32:57, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsO E2 192.168.2.0 [110/20] via 172.16.2.2, 00:00:50, Serial0/0

R3#sh ip routeGateway of last resort is not set

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksO E2 172.16.1.0/24 [110/20] via 192.168.1.2, 00:01:49, Serial0/0O 172.16.2.0/30 [110/74] via 192.168.4.2, 01:34:01, Ethernet0/0C 192.168.4.0/24 is directly connected, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsO E2 10.1.1.0 [110/20] via 192.168.1.2, 00:01:49, Serial0/0C 192.168.1.0/24 is directly connected, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsO E2 192.168.2.0 [110/20] via 192.168.4.2, 00:01:54, Ethernet0/0

R5#sh ip route

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0i L2 172.16.2.0/30 [115/84] via 192.168.2.1, Serial0/0 [115/84] via 172.16.1.1, Ethernet0/0i L2 192.168.4.0/24 [115/84] via 192.168.2.1, Serial0/0

Page 21: Redistribute Giữa ISIS Và OSPF

[115/84] via 172.16.1.1, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0i L2 192.168.1.0/24 [115/84] via 192.168.2.1, Serial0/0 [115/84] via 172.16.1.1, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0

Hiện tại R5 đang thực hiện cân bằng tải với chi phí bằng nhau trên cả hai router R1 và R4 để đi đến các route trong miền OSPF .Ta xây dựng chính sách trên R5 sao cho R5 sử dụng R1 như là gateway chính để đi đến miền OSPF , các route chỉ đi qua R4 khi R1 không còn thích hợp .Tức là sử dụng R1 như là primary gateway còn R4 là backup gateway .Sử dụng câu lệnh distance để thực hiện điều này :

R5(config)#router isisR5(config-router)#distance 100 172.16.1.1 0.0.0.0

R5# clear ip route *R5#sh ip route

172.16.0.0/16 is variably subnetted, 2 subnets, 2 masksC 172.16.1.0/24 is directly connected, Ethernet0/0i L2 172.16.2.0/30 [100/84] via 172.16.1.1, Ethernet0/0i L2 192.168.4.0/24 [100/84] via 172.16.1.1, Ethernet0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0i L2 192.168.1.0/24 [100/84] via 172.16.1.1, Ethernet0/0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0à R5 xem R1 như là next-hop .giả sử R1 không còn chạy nữa .

R5(config)#int e0/0R5(config-if)#shutdown

R5#debug ip packetIP packet debugging is on03:27:42: IP: s=172.16.1.2 (local), d=172.16.1.1, len 56, unroutable03:28:02: IP: s=172.16.1.2 (local), d=172.16.1.1, len 56, unroutable03:28:21: IP: s=172.16.1.2 (local), d=172.16.1.1, len 56, unroutable

R5#sh ip route

172.16.0.0/30 is subnetted, 1 subnetsi L2 172.16.2.0 [115/84] via 192.168.2.1, Serial0/0

Page 22: Redistribute Giữa ISIS Và OSPF

i L2 192.168.4.0/24 [115/84] via 192.168.2.1, Serial0/0 10.0.0.0/24 is subnetted, 1 subnetsC 10.1.1.0 is directly connected, Loopback0i L2 192.168.1.0/24 [115/84] via 192.168.2.1, Serial0/0 192.168.2.0/30 is subnetted, 1 subnetsC 192.168.2.0 is directly connected, Serial0/0à R5 bây giờ chuyển sang xem R4 như là next-hop .


Recommended