route-map and redistribution

18 261 0
route-map and redistribution

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ROUTE-MAP AND REDISTRIBUTION. 1. Mục tiêu. Sử dụng các kỹ thuật route-map và route redistribution. 2. Bối cảnh. Công ty ABC vừa mới liên minh với công ty ISP. ABC có một chi nhánh ở Biên Hoà –BH, và trụ sở chính ở HCMC (router HCM và BienHoa). Cả trụ sở chính đều kết nối vào chi nhánh của cty ISP tại thành phố sở tại ((router ISP1 ở HCMC và ISP2 ở Biên Hoà). Hiện tại ABC có cấu hình kết nối như hình vẽ và đang sử dụng RIPv2 và ISP đang sử dụng OSPF. Do đó, cần có mutual redistribution giữa hai protocol để các network đều thấy nhau. Kết nối giữa ISP1 và HCMC, giữa HCM và BH là 2M. Kết nối giữa ISP2 và BH là 128K. Chỉ có router ISP1 làm redistribution cho RIP vào OSPF và ISP2 làm redistribution cho OSPF vào RIP. Trong tương lai, cả 2 router đều làm redistribution cho cả 2 protocol. Network 192.168.12.0/24 là phòng nghiên cứu R&D không được để cho các mạng khác nhìn thấy trừ network dành cho các manager là 192.168.11.0/24. Để thuận tiện sử dụng lệnh show ip rip database, nên sử dụng các IOS version 12. 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 HCM, BIENHOA, ISP1, ISP2 . Ta cấu hình RIPv2 cho cho các router HCM, BIENHOA, ISP1, ISP2 như sau:. HCM(config)#router rip HCM(config-router)#version 2 HCM(config-router)#no auto-summary HCM(config-router)#network 192.168.1.0 ISP1(config)#router rip ISP1(config-router)#version 2 ISP1(config-router)#no auto-summary ISP1(config-router)#network 192.168.1.0 BienHoa(config)#router rip BienHoa(config-router)#version 2 BienHoa(config-router)#no auto-summary BienHoa(config-router)#network 192.168.1.0 ISP2(config)#router rip ISP2(config-router)#version 2 ISP2(config-router)#no auto-summary ISP2(config-router)#network 192.168.1.0 Kiểm tra trên các bảng định tuyến trên router HCM, BIENHOA, ISP1, ISP2 ta sẽ thấy có các RIP route mới. sh ip route Bước 3: Cấu hình OSPF trên ISP1, ISP2 . Ta cấu hình OSPF cho router ISP1, ISP2 như sau: ISP1(config)#router ospf 1 ISP1(config-router)#network 192.168.100.0 0.0.0.255 area 0 ISP2(config)#router ospf 1 ISP2(config-router)#network 192.168.100.0 0.0.0.255 area 0 Kiểm tra trên các OSPF database và OSPF adjacency trên router ISP1 và ISP2, ta sẽ thấy có OSPF route mới. sh ip ospf database sh ip ospf neighbor Bước 4: Redistribute connected ở BienHoa. Cấu hình redistribute connected vào RIP ở router BienHoa. BienHoa(config)#router rip BienHoa(config-router)#redistribute connected Các RIP route 192.168.21.0/25 và 192.168.21.128/25 mới sẽ xuất hiện trong routing table của router ISP1, ISP2 và HCMC. Các route đó cũng sẽ xuất hiện trong RIP database của tất cả các router. NOTE : Bạn phải cấu hình no auto-summary trong mode router rip trên BienHoa để các router khác học được cả 2 route 192.168.21.0 /25 và 192.168.21.128/25. Nếu bạn không cấu hình, thì các router khác sẽ học được route 192.168.21.0/24. Kiểm tra bằng lệnh : HCM#show ip route 192.168.11.0/30 is subnetted, 1 subnets C 192.168.11.0 is directly connected, Ethernet0/0 192.168.21.0/24 is variably subnetted, 3 subnets, 2 masks R 192.168.21.0/25 [120/1] via 192.168.1.10, 00:00:10, Serial0/0 R 192.168.21.128/25 [120/1] via 192.168.1.10, 00:00:10, Serial0/0 C 192.168.21.128/30 is directly connected, Loopback0 Có thể kiểm tra RIP database bằng lệnh HCM#sh ip rip database 192.168.1.0/24 auto-summary 192.168.1.0/30 directly connected, Serial0/1 192.168.1.4/30 [1] via 192.168.1.10, 00:00:16, Serial0/0 192.168.1.8/30 directly connected, Serial0/0 192.168.21.0/24 auto-summary 192.168.21.0/25 [1] via 192.168.1.10, 00:00:16, Serial0/0 192.168.21.128/25 [1] via 192.168.1.10, 00:00:16, Serial0/0 Bước 5: Redistribute connected ở HCMC. Ở router HCMC còn hai netwrork chưa tham gia vào miền RIP là 192.168.11.0/25 và 192.168.11.128/25. Ta sẽ redistribute 2 network này vào miền RIP như sau : HCM(config)#router rip HCM(config-router)#redistribute connected Kiểm tra kết quả trên router BienHoa : BienHoa#show ip route 192.168.11.0/25 is subnetted, 2 subnets R 192.168.11.0 [120/1] via 192.168.1.9, 00:00:06, Serial0/0 R 192.168.11.128 [120/1] via 192.168.1.9, 00:00:06, Serial0/0 192.168.21.0/25 is subnetted, 2 subnets C 192.168.21.0 is directly connected, Ethernet0/0 C 192.168.21.128 is directly connected, Loopback0 192.168.1.0/30 is subnetted, 3 subnets C 192.168.1.8 is directly connected, Serial0/0 R 192.168.1.0 [120/1] via 192.168.1.9, 00:00:06, Serial0/0 C 192.168.1.4 is directly connected, Serial0/1 Nhưng ta không muốn các mạng khác thấy network 192.168.11.128/25 vì đây là network riêng của các nhà quản lý. Do đó, khi redistribute vào miền RIP ta sẽ dùng route-map để loại network này. Cấu hình như sau: HCM(config)#access-list 111 deny ip 192.168.11.0 0.0.0.127 any HCM(config)#access-list 111 permit ip any any HCM(config)#route-map connected-to-rip permit 10 HCM(config-route-map)#match ip address 111 HCM(config)#router rip HCM(config-router)#redistribute connected route-map conneted-to-rip TIP: Bạn nên sử dụng extend ACL. Kiểm tra lại route-map cấu hình: HCM#sh route-map route-map connected-to-rip, permit, sequence 10 Match clauses: ip address (access-lists): 111 Set clauses: Policy routing matches: 0 packets, 0 bytes ISP2#show ip route 192.168.11.0/25 is subnetted, 1 subnets R 192.168.11.128 [120/2] via 192.168.1.6, 00:00:13, Serial0/1 192.168.21.0/25 is subnetted, 2 subnets R 192.168.21.0 [120/1] via 192.168.1.6, 00:00:13, Serial0/1 R 192.168.21.128 [120/1] via 192.168.1.6, 00:00:13, Serial0/1 192.168.1.0/30 is subnetted, 3 subnets R 192.168.1.8 [120/1] via 192.168.1.6, 00:00:13, Serial0/1 R 192.168.1.0 [120/2] via 192.168.1.6, 00:00:13, Serial0/1 C 192.168.1.4 is directly connected, Serial0/1 C 192.168.100.0/24 is directly connected, FastEthernet0/0 BienHoa#show ip route 192.168.11.0/25 is subnetted, 1 subnets R 192.168.11.128 [120/1] via 192.168.1.9, 00:00:09, Serial0/0 192.168.21.0/25 is subnetted, 2 subnets C 192.168.21.0 is directly connected, Ethernet0/0 C 192.168.21.128 is directly connected, Loopback0 192.168.1.0/30 is subnetted, 3 subnets C 192.168.1.8 is directly connected, Serial0/0 R 192.168.1.0 [120/1] via 192.168.1.9, 00:00:09, Serial0/0 C 192.168.1.4 is directly connected, Serial0/1 Ta thấy HCM chỉ quảng bá network 192.168.11.128/25, còn network 192.168.11.0/25 bị chặn bởi route-map. Có thể kiểm tra sự xuất hiện của 192.168.11.0/24 trong RIP database bằng lệnh ở tất cả các router: ISP2#sh ip rip database 192.168.1.0/24 auto-summary 192.168.1.0/30 [2] via 192.168.1.6, 00:00:04, Serial0/1 192.168.1.4/30 directly connected, Serial0/1 192.168.1.8/30 [1] via 192.168.1.6, 00:00:04, Serial0/1 192.168.11.0/24 auto-summary 192.168.11.128/25 [2] via 192.168.1.6, 00:00:04, Serial0/1 192.168.21.0/24 auto-summary 192.168.21.0/25 [1] via 192.168.1.6, 00:00:04, Serial0/1 192.168.21.128/25 [1] via 192.168.1.6, 00:00:04, Serial0/1 Ta thấy trong RIP database của IPS2 không có sự xuất hiện của network 192.168.11.0/25. Bước 6: Redistribute RIP vào OSPF ở ISP1 và sử dụng route-map để tagging. Khi redistribute RIP route vào OSPF ở router ISP1, các route này sẽ có AD 110 và thuộc loại External Type 2. Khi các route E2 này đến ISP2 sẽ được redistribute vào RIP domain và có khả năng tạo sub-optimal paths. Để tránh hiện tượng này, route map có hỗ trợ ta một kỹ thuật để đánh dấu (tagging) các RIP route này với tag nào đó, ở đây ta chọn ngẫu nhiên số 200. Nhờ đó, router ISP2 khi redistribute các OSPF route vào RIP, sẽ không redistribute các route đã được đánh dấu tag 200 vào RIP domain. Cấu hình như sau: ISP1(config)#access-list 1 permit host 192.168.1.2 ISP1(config)#route-map rip-to-ospf permit 10 ISP1(config-route-map)#match ip route-source 1 ISP1(config-route-map)#set tag 200 Kiểm tra route-map vừa cấu hình xong: ISP1#sh route-map route-map rip-to-ospf, permit, sequence 10 Match clauses: ip route-source (access-lists): 1 Set clauses: Policy routing matches: 0 packets, 0 bytes Sử dụng route-map để lọc route trong quá trình redistribute rip vào ospf: ISP1(config)#router ospf 1 ISP1(config-router)#redistribute rip subnets route-map rip-to-ospf Kiểm tra OSPF database ở ISP1 và bảng định tuyến ở router ISP2. Ta sẽ thấy các route mới ở RIP domain với tag 200 xuất hiện trong OSPF database của ISP1 và ISP2. Ví dụ, trong bảng định tuyến của ISP2: ISP1#sh ip ospf database OSPF Router with ID (192.168.100.1) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 192.168.100.1 192.168.100.1 53 0x80000008 0x1DC8 1 192.168.100.2 192.168.100.2 258 0x80000005 0x7878 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 192.168.100.1 192.168.100.1 971 0x80000004 0x3EBC Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 192.168.1.4 192.168.100.1 247 0x80000002 0x3C60 200 192.168.1.8 192.168.100.1 247 0x80000002 0x1484 200 192.168.11.128 192.168.100.1 247 0x80000002 0x68C 200 192.168.21.0 192.168.100.1 247 0x80000002 0x9C6C 200 192.168.21.128 192.168.100.1 247 0x80000002 0x97F0 200 ISP2#show ip route 192.168.11.0/25 is subnetted, 1 subnets O E2 192.168.11.128 [110/20] via 192.168.100.1, 00:06:09, FastEthernet0/0 192.168.21.0/25 is subnetted, 2 subnets O E2 192.168.21.0 [110/20] via 192.168.100.1, 00:06:09, FastEthernet0/0 O E2 192.168.21.128 [110/20] via 192.168.100.1, 00:06:09, FastEthernet0/0 192.168.1.0/30 is subnetted, 3 subnets O E2 192.168.1.8 [110/20] via 192.168.100.1, 00:06:09, FastEthernet0/0 R 192.168.1.0 [120/2] via 192.168.1.6, 00:00:26, Serial0/1 C 192.168.1.4 is directly connected, Serial0/1 C 192.168.100.0/24 is directly connected, FastEthernet0/0 Bước 6: Redistribute OSPF vào RIP ở ISP2 và sử dụng route-map filter. Để tránh sub-optimal paths trong ta phải tránh redistribute các RIP route trở lại RIP domain với AD nhỏ hơn. Ở ISP2, khi thực hiện redistribution, ta sử dụng route-map để loại bỏ các route đã được đánh dấu ở bước 5. Để configure, ta sử dụng các lệnh như sau: ISP2(config)#route-map ospf-to-rip deny 10 ISP2(config-route-map)#match tag 200 ISP2(config-route-map)#route-map ospf-to-rip permit 20 Sử dụng route-map ospf-to-rip để chặn các RIP route được redistribute ngược trở lại vào RIP domain tạo nên sub-optimal paths: ISP2(config)#router rip ISP2(config-router)#redistribute ospf 1 metric 5 route-map ospf-to-rip Ta thấy trong rip database của ISP2 chỉ có một network 192.168.100.0/24 là được redistribute vào trong RIP domain ở ISP2 do không bị đánh dấu (tag) là 200. Do đó, route này sẽ được ISP2 quảng bá theo RIP. ISP2#sh ip rip database 192.168.1.0/24 auto-summary 192.168.1.0/30 [2] via 192.168.1.6, 00:00:01, Serial0/1 192.168.1.4/30 directly connected, Serial0/1 192.168.100.0/24 auto-summary 192.168.100.0/24 redistributed [1] via 0.0.0.0, Kiểm tra bảng định tuyến của HCM và BienHoa. BienHoa#sh ip route 192.168.11.0/25 is subnetted, 1 subnets R 192.168.11.128 [120/1] via 192.168.1.9, 00:00:02, Serial0/0 192.168.21.0/25 is subnetted, 2 subnets C 192.168.21.0 is directly connected, Ethernet0/0 C 192.168.21.128 is directly connected, Loopback0 192.168.1.0/30 is subnetted, 3 subnets C 192.168.1.8 is directly connected, Serial0/0 R 192.168.1.0 [120/1] via 192.168.1.9, 00:00:02, Serial0/0 C 192.168.1.4 is directly connected, Serial0/1 R 192.168.100.0/24 [120/5] via 192.168.1.5, 00:00:02, Serial0/1 5. Cấu hình ISP2#show run Building configuration Current configuration : 1307 bytes ! version 12.1 no service single-slot-reload-enable service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname ISP2 ! memory-size iomem 10 ip subnet-zero ! no ip finger no ip domain-lookup ! interface FastEthernet0/0 ip address 192.168.100.2 255.255.255.0 duplex auto speed auto ! interface Serial0/1 ip address 192.168.1.5 255.255.255.252 ! router ospf 1 log-adjacency-changes network 192.168.100.0 0.0.0.255 area 0 ! router rip version 2 redistribute ospf 1 metric 5 route-map ospf-to-rip network 192.168.1.0 no auto-summary ! ip kerberos source-interface any ip classless no ip http server ! access-list 1 permit 192.168.11.128 0.0.0.127 route-map ospf-to-rip deny 10 match tag 200 ! route-map ospf-to-rip permit 20 ! snmp-server packetsize 4096 snmp-server manager ! line con 0 logging synchronous transport input none line aux 0 line vty 0 4 privilege level 15 no login terminal-type monitor ! end HCM#sh run Building configuration Current configuration: ! version 12.0 service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname HCM ! ! ! ! ! ! ip subnet-zero no ip domain-lookup ! ! ! process-max-time 200 ! interface Loopback0 ip address 192.168.12.1 255.255.255.0 no ip directed-broadcast ! interface Ethernet0 ip address 192.168.11.1 255.255.255.0 no ip directed-broadcast no keepalive ! interface Serial0 ip address 192.168.2.2 255.255.255.252 no ip directed-broadcast ! interface Serial1 ip address 192.168.2.9 255.255.255.252 no ip directed-broadcast clockrate 2000000 ! router rip version 2 redistribute connected route-map connected-to-rip network 192.168.2.0 no auto-summary ! ip classless no ip http server ! access-list 1 deny 192.168.12.0 0.0.0.255 [...]... shutdown ! router ospf 1 log-adjacency-changes network 192.168.100.0 0.0.0.255 area 0 ! router rip version 2 redistribute ospf 1 metric 5 route-map ospf-to-rip network 192.168.2.0 no auto-summary ! ip classless no ip http server ! route-map ospf-to-rip deny 10 match tag 120 ! route-map ospf-to-rip permit 20 ! ! line con 0 logging synchronous transport input none line aux 0 line vty 0 4 password cisco login... ! interface Serial1 no ip address shutdown ! router ospf 1 log-adjacency-changes redistribute rip subnets route-map rip-to-ospf network 192.168.100.0 0.0.0.255 area 0 ! router rip version 2 network 192.168.2.0 no auto-summary ! ip classless no ip http server ! access-list 1 permit 192.168.2.2 route-map rip-to-ospf permit 10 match ip route-source 1 set tag 120 ! ! line con 0 logging synchronous transport... interface Serial0/1 ip address 192.168.1.1 255.255.255.252 ! router ospf 1 redistribute rip subnets route-map rip-to-ospf network 192.168.100.0 0.0.0.255 area 0 ! router rip version 2 network 192.168.1.0 no auto-summary ! ip classless ! access-list 1 permit 192.168.1.2 access-list 100 permit ip host 192.168.1.2 any route-map rip-to-ospf permit 10 match ip route-source 1 set tag 200 ! ! ! line con 0 logging... 64000 ! interface Serial0/1 ip address 192.168.1.2 255.255.255.252 clockrate 64000 ! router rip version 2 redistribute connected route-map connected-to-rip network 192.168.1.0 no auto-summary ! access-list 111 deny ip 192.168.11.0 0.0.0.127 any access-list 111 permit ip any any route-map connected-to-rip permit 10 match ip address 111 ! ...access-list 1 permit any route-map connected-to-rip permit 10 match ip address 1 ! ! line con 0 logging synchronous transport input none line aux 0 line vty 0 4 password cisco login ! end ISP1#sh run Building configuration Current . 192.168.1.2 ISP1(config) #route-map rip-to-ospf permit 10 ISP1(config -route-map) #match ip route-source 1 ISP1(config -route-map) #set tag 200 Kiểm tra route-map vừa cấu hình xong: ISP1#sh route-map route-map. ROUTE-MAP AND REDISTRIBUTION. 1. Mục tiêu. Sử dụng các kỹ thuật route-map và route redistribution. 2. Bối cảnh. Công ty ABC vừa mới liên. các lệnh như sau: ISP2(config) #route-map ospf-to-rip deny 10 ISP2(config -route-map) #match tag 200 ISP2(config -route-map) #route-map ospf-to-rip permit 20 Sử dụng route-map ospf-to-rip để chặn các

Ngày đăng: 16/11/2014, 19:46

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan