1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

lab 6-3 sử dụng route-map

17 481 1

Đ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

Thông tin cơ bản

Định dạng
Số trang 17
Dung lượng 52,5 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Lab 6-3: SỬ DỤNG ROUTE-MAPMô tả Bài thực hành này hướng dẫn cách sử dụng lệnh route-map trong quá trình phân phối route giữa các giao thức định tuyến.. Kiểm tra trên các bảng định tuyến

Trang 1

Lab 6-3: SỬ DỤNG ROUTE-MAP

Mô tả

Bài thực hành này hướng dẫn cách sử dụng lệnh route-map trong quá trình phân phối route giữa các giao thức định tuyến 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 giao thức để 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 giao thức 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

Thực hiện

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

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

Trang 2

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

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

4 Redistribute connected ở BienHoa

Cấu hình đưa các route 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 bảng định tuyến 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 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

Trang 3

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: Đưa các route 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ẽ phân phối 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 phân phối 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

Trang 4

HCM(config)#router rip

HCM(config-router)#redistribute connected route-map conneted-to-rip

 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:

Trang 5

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

6 Phân phối RIP vào OSPF ở ISP1 và sử dụng route-map để tagging

Khi phân phối 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 phân phối vào RIP domain

và có khả năng tạo sub-optimal đường đis Để 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 phân phối các OSPF route vào RIP, sẽ không phân phối 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

Trang 6

Sử dụng route-map để lọc route trong quá trình phân phối 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

Trang 7

6 Phân phối OSPF vào RIP ở ISP2 và sử dụng route-map filter.

Để tránh sub-optimal đường đis trong ta phải tránh đưa 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 đưa ngược trở lại vào RIP domain tạo nên sub-optimal đường đis:

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 đưa 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

Trang 8

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

Trang 9

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

Trang 10

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

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 configuration:

!

version 12.1

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

hostname ISP1

!

ip subnet-zero

no ip domain-lookup

Trang 11

interface Ethernet0

ip address 192.168.100.1 255.255.255.0

!

interface Serial0

ip address 192.168.2.1 255.255.255.252 clockrate 2000000

!

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 input none

line aux 0

line vty 0 4

password cisco

login

!

end

BienHoa#sh run

Building configuration

Current configuration:

!

version 12.0

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

Trang 12

hostname BienHoa

!

ip subnet-zero

no ip domain-lookup

!

process-max-time 200

!

interface Loopback0

ip address 192.168.22.1 255.255.255.0

no ip directed-broadcast

!

interface Ethernet0

ip address 192.168.21.1 255.255.255.0

no ip directed-broadcast

no keepalive

!

interface Serial0

ip address 192.168.2.6 255.255.255.252

no ip directed-broadcast

clockrate 125000

!

interface Serial1

ip address 192.168.2.10 255.255.255.252

no ip directed-broadcast

!

router rip

version 2

redistribute connected

network 192.168.2.0

no auto-summary

!

ip classless

no ip http server

!

!

line con 0

logging synchronous

transport input none

line aux 0

line vty 0 4

password cisco

login

!

end

ISP2#sh run

Trang 13

Building configuration

Current configuration:

!

version 12.1

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

hostname ISP2

!

ip subnet-zero

no ip domain-lookup

!

interface Ethernet0

ip address 192.168.100.2 255.255.255.0

!

interface Serial0

ip address 192.168.2.5 255.255.255.252

no fair-queue

!

interface Serial1

no ip address

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

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

TỪ KHÓA LIÊN QUAN

w