• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

Lab 3.1: Hiệu chỉnh ad (administrative distance)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Lab 3.1: Hiệu chỉnh ad (administrative distance)

    Click image for larger version

Name:	27-3 HÌNH 1.jpg
Views:	28
Size:	52.8 KB
ID:	427115
    1. Yêu cầu
    1. Thực hiện định tuyến và redistribution, đảm bảo mạng hội tụ. Theo yêu cầu sau:
      • Redistribute vào EIGRP: seed metric được thiết lập với các thông số: Bandwidth = 1000 kbps, delay = 1ms, reliability = 255, load = 1, MTU =1500.
      • Redistribute vào OSPF với seed metric để như mặc định.
    2. R2 chặn không cho route 192.168.2.0 được redistribute vào trong.
    3. R3 chặn không cho route 192.168.3.0 được redistribute vào trong.
    4. Kết nối giữa R2 và R3 luôn là đường dự phòng (từ R2 và R3, khi đi đến bất kỳ mạng nào không kết nối trực tiếp đều đi theo đường băng ngang qua vùng OSPF, không đi qua đường nối giữa R2 và R3).
    5. R1 học các route từ R2 có AD = 102, từ R3 có AD = 103.
    Bước 1: Định tuyến và redistribute

    Đặt IP cho các thiết bị theo sơ đồ hình 3.1 sau đó chạy định tuyến OSPF cho 3 router:

    R1
    router ospf 1
    log-adjacency-changes
    network 1.1.1.0 0.0.0.255 area 0
    network 192.168.12.0 0.0.0.255 area 0
    network 192.168.13.0 0.0.0.255 area 0
    R2
    router ospf 1
    log-adjacency-changes
    network 192.168.12.0 0.0.0.255 area 0
    R3
    router ospf 1
    log-adjacency-changes
    network 192.168.13.0 0.0.0.255 area 0

    Định tuyến EIGRP trên R2 và R3:

    R2
    router eigrp 1
    network 10.2.2.0 0.0.0.255
    network 192.168.23.0
    auto-summary
    R3
    router eigrp 1
    network 10.3.3.0 0.0.0.255
    network 192.168.23.0
    auto-summary

    R2 chưa thấy mạng 10.3.3.0/24 và R3 chưa thấy mạng 10.2.2.0/24 trong các bảng định tuyến của chúng. Đó là bởi vì hai mạng này đều là mạng con của mạng chính (major network) 10.0.0.0/8 và các router R2 và R3 đang tự động tóm tắt các mạng con về mạng chính khi cập nhật định tuyến về chúng đi ngang qua biên giới của một mạng chính khác (tính năng auto – summary của giao thức EIGRP). Ta có thể xem các route tóm tắt được tự động tạo ra trong bảng định tuyến của các router R2 và R3 bằng cách sử dụng câu lệnh “show ip route” trên hai router này:

    R2#show ip route
    (đã bỏ qua một số dòng)
    10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    C 10.2.2.0/24 is directly connected, Loopback2
    D 10.0.0.0/8 is a summary, 00:08:23, Null0
    C 192.168.23.0/24 is directly connected, FastEthernet0/1
    C 192.168.2.0/24 is directly connected, Loopback1



    R3#show ip route
    (đã bỏ qua một số dòng)
    10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    C 10.3.3.0/24 is directly connected, Loopback2
    D 10.0.0.0/8 is a summary, 00:10:06, Null0
    C 192.168.23.0/24 is directly connected, FastEthernet0/0
    C 192.168.3.0/24 is directly connected, Loopback1

    Để các mạng được hiển thị trên bảng định tuyến của các router, ta thực hiện câu lệnh “no auto-summary”:

    R2(config)#router eigrp 1
    R2(config-router)#no auto-summary
    R3(config)#router eigrp 1
    R3(config-router)#no auto-summary

    Sau khi thực hiện xong câu lệnh “no auto-summary”, quan sát bảng định tuyến trên các router:

    R2#show ip route
    (đã bỏ qua một số dòng)
    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    1.0.0.0/32 is subnetted, 1 subnets
    O 1.1.1.1 [110/2] via 192.168.12.1, 00:13:59, FastEthernet0/0
    O 192.168.13.0/24 [110/2] via 192.168.12.1, 00:13:59, FastEthernet0/0
    2.0.0.0/24 is subnetted, 1 subnets
    C 2.2.2.0 is directly connected, Loopback0
    10.0.0.0/24 is subnetted, 2 subnets
    D 10.3.3.0 [90/156160] via 192.168.23.3, 00:00:09, FastEthernet0/1
    C 10.2.2.0 is directly connected, Loopback2
    C 192.168.23.0/24 is directly connected, FastEthernet0/1
    C 192.168.2.0/24 is directly connected, Loopback1



    R3#show ip route
    (đã bỏ qua một số dòng)
    O 192.168.12.0/24 [110/2] via 192.168.13.1, 00:14:25, FastEthernet0/1
    1.0.0.0/32 is subnetted, 1 subnets
    O 1.1.1.1 [110/2] via 192.168.13.1, 00:14:25, FastEthernet0/1
    C 192.168.13.0/24 is directly connected, FastEthernet0/1
    3.0.0.0/24 is subnetted, 1 subnets
    C 3.3.3.0 is directly connected, Loopback0
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.3.3.0 is directly connected, Loopback2
    D 10.2.2.0 [90/156160] via 192.168.23.2, 00:00:42, FastEthernet0/0
    C 192.168.23.0/24 is directly connected, FastEthernet0/0
    C 192.168.3.0/24 is directly connected, Loopback1

    Trên R2, thực hiện redistribute từ các giao thức bên ngoài vào các giao thức OSPF và EIGRP:

    R2(config)#router ospf 1
    R2(config-router)#redistribute eigrp 1 subnets
    R2(config-router)#redistribute connected
    R2(config-router)#exit
    R2(config)#router eigrp 1
    R2(config-router)#redistribute ospf 1 metric 1000 100 255 1 1500
    R2(config-router)#redistribute connected

    Thực hiện tương tự trên router R3:

    R3(config)#router ospf 1
    R3(config-router)#redistribute eigrp 1 subnets
    R3(config-router)#redistribute connected
    R3(config-router)#exit
    R3(config)#router eigrp 1
    R3(config-router)#redistribute ospf 1 metric 1000 100 255 1 1500
    R3(config-router)#redistribute connected

    Để ý rằng khi xem bảng định tuyến, ta thấy R3 học được các route 2.2.2.0/24 và 192.168.2.0/24 thông qua OSPF, cho dù các route này được cung cấp từ cả hai giao thức OSPF và EIGRP. Điều này xảy ra vì route bên ngoài khi được đưa vào OSPF có giá trị AD = 110, nhưng nếu đưa vào EIGRP thì sẽ có giá trị AD lên tới 170. Do đó, router R3 sẽ học các route này từ giao thức OSPF (có AD nhỏ hơn trong trường hợp này):

    R3#show ip route
    (đã bỏ qua một số dòng)
    O 192.168.12.0/24 [110/2] via 192.168.13.1, 00:05:37, FastEthernet0/1
    1.0.0.0/32 is subnetted, 1 subnets
    O 1.1.1.1 [110/2] via 192.168.13.1, 00:05:37, FastEthernet0/1
    C 192.168.13.0/24 is directly connected, FastEthernet0/1
    2.0.0.0/24 is subnetted, 1 subnets
    O E2 2.2.2.0 [110/20] via 192.168.13.1, 00:00:59, FastEthernet0/1
    3.0.0.0/24 is subnetted, 1 subnets
    C 3.3.3.0 is directly connected, Loopback0
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.3.3.0 is directly connected, Loopback2
    D 10.2.2.0 [90/156160] via 192.168.23.2, 00:13:33, FastEthernet0/0
    C 192.168.23.0/24 is directly connected, FastEthernet0/0
    O E2 192.168.2.0/24 [110/20] via 192.168.13.1, 00:00:59, FastEthernet0/1
    C 192.168.3.0/24 is directly connected, Loopback1

    Tương tự, R2 cũng sẽ thấy các route bên ngoài (3.3.3.0/24 và 192.168.3.0/24) được R3 redistribute vào OSPF và EIGRP qua đường OSPF chứ không qua đường EIGRP. Bước 2: R2 chặn không cho route 192.168.2.0/24 được redistribute vào trong

    Ta có thể sử dụng Distribute-list hoặc Route-map. Trong bài lab này ta sử dụng route-map:

    R2(config)#access-list 1 permit 192.168.2.0
    R2(config)#route-map abc deny 10
    R2(config-route-map)#match ip address 1
    R2(config-route-map)#exit
    R2(config)#route-map abc permit 20
    R2(config-route-map)#exit
    R2(config)#router ospf 1
    R2(config-router)#redistribute connected route-map abc subnets
    R2(config)#router eigrp 1
    R2(config-router)#redistribute connected route-map abc
    Bước 3: R3 chặn không cho route 192.168.3.0/24 được redistribute vào trong

    Thực hiện tương tự như trên router R2:

    R3(config)#access-list 1 permit 192.168.3.0
    R3(config)#route-map abc deny 10
    R3(config-route-map)#match ip address 1
    R3(config-route-map)#exit
    R3(config)#route-map abc permit 20
    R3(config-route-map)#exit
    R3(config)#router ospf 1
    R3(config-router)#redistribute connected route-map abc subnets
    R3(config)#router eigrp 1
    R3(config-router)#redistribute connected route-map abc

    Để kiểm tra kết quả của hai bước 2 và 3, ta thực hiện kiểm tra bảng định tuyến trên R1: không còn thấy các route 192.168.2.0/24 và 192.168.3.0/24.

    R1#show ip route
    (đã bỏ qua một số dòng)
    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    1.0.0.0/24 is subnetted, 1 subnets
    C 1.1.1.0 is directly connected, Loopback0
    C 192.168.13.0/24 is directly connected, FastEthernet0/1
    2.0.0.0/24 is subnetted, 1 subnets
    O E2 2.2.2.0 [110/20] via 192.168.12.2, 00:24:52, FastEthernet0/0
    3.0.0.0/24 is subnetted, 1 subnets
    O E2 3.3.3.0 [110/20] via 192.168.13.3, 00:24:36, FastEthernet0/1
    10.0.0.0/24 is subnetted, 2 subnets
    O E2 10.3.3.0 [110/20] via 192.168.12.2, 00:29:30, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:29:30, FastEthernet0/1
    O E2 10.2.2.0 [110/20] via 192.168.12.2, 00:29:30, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:29:30, FastEthernet0/1
    O E2 192.168.23.0/24 [110/20] via 192.168.12.2, 00:29:31, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:29:31, FastEthernet0/1
    Bước 4: Cấu hình để kết nối giữa R2 và R3 luôn là đường dự phòng

    Xem lại bảng định tuyến của R2 và R3, ta thấy có 1 số route vẫn đi qua đường R2-R3:

    R2#show ip route eigrp
    D 10.3.3.0 [90/156160] via 192.168.23.3, 00:36:16, FastEthernet0/1



    R3#show ip route eigrp
    D 10.2.2.0 [90/156160] via 192.168.23.2, 00:28:34, FastEthernet0/0

    Các route 10.2.2.0 và 10.3.3.0 được quảng bá bởi EIGRP. Hai route này cũng được EIGRP phân phối (redistribute) sang OSPF, đến lượt mình, OSPF lại quảng bá hai route này đến các router. Vì AD của EIGRP nhỏ hơn OSPF (90 < 110), các router sẽ học chúng từ EIGRP. Vậy khi đi đến các mạng này, các router luôn sử dụng đường chính là đường nối giữa R2 và R3.
    Ta sử dụng câu lệnh “distance” để chỉnh AD của OSPF nhỏ hơn EIGRP, ép R2 học route 10.3.3.0 và R3 học route 10.2.2.0 qua OSPF.
    Chỉnh sửa trên R2:

    R2(config)#router ospf 1
    R2(config-router)#distance 85


    Kiểm tra lại bảng định tuyến của R2:

    R2#show ip route
    (đã bỏ qua một số dòng)
    O E2 3.3.3.0 [85/20] via 192.168.12.1, 00:03:40, FastEthernet0/0
    10.0.0.0/24 is subnetted, 2 subnets
    O E2 10.3.3.0 [85/20] via 192.168.12.1, 00:03:40, FastEthernet0/0
    C 10.2.2.0 is directly connected, Loopback2
    C 192.168.23.0/24 is directly connected, FastEthernet0/1
    C 192.168.2.0/24 is directly connected, Loopback1

    Chỉnh sửa trên R3:

    R3(config)#router ospf 1
    R3(config-router)#distance 84

    Kiểm tra lại bảng định tuyến của R3:

    R3#show ip route
    (đã bỏ qua một số dòng)
    O E2 2.2.2.0 [84/20] via 192.168.13.1, 00:00:09, FastEthernet0/1
    3.0.0.0/24 is subnetted, 1 subnets
    C 3.3.3.0 is directly connected, Loopback0
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.3.3.0 is directly connected, Loopback2
    O E2 10.2.2.0 [84/20] via 192.168.13.1, 00:00:09, FastEthernet0/1
    C 192.168.23.0/24 is directly connected, FastEthernet0/0
    C 192.168.3.0/24 is directly connected, Loopback1

    Xem bảng định tuyến R1 sau khi hiệu chỉnh AD của OSPF:

    R1#show ip route
    (đã bỏ qua một số dòng)
    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    1.0.0.0/24 is subnetted, 1 subnets
    C 1.1.1.0 is directly connected, Loopback0
    C 192.168.13.0/24 is directly connected, FastEthernet0/1
    2.0.0.0/24 is subnetted, 1 subnets
    O E2 2.2.2.0 [110/20] via 192.168.12.2, 00:01:24, FastEthernet0/0
    3.0.0.0/24 is subnetted, 1 subnets
    O E2 3.3.3.0 [110/20] via 192.168.13.3, 00:04:23, FastEthernet0/1
    10.0.0.0/24 is subnetted, 2 subnets
    O E2 10.3.3.0 [110/20] via 192.168.13.3, 00:04:29, FastEthernet0/1
    O E2 10.2.2.0 [110/20] via 192.168.12.2, 00:01:30, FastEthernet0/0
    O E2 192.168.23.0/24 [110/20] via 192.168.12.2, 00:49:43, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:49:43, FastEthernet0/1

    Ta thấy R1 không còn học 10.2.2.0 và 10.3.3.0 qua cả 2 đường như lúc đầu nữa.
    Bảng định tuyến R1 trước khi hiệu chỉnh AD của OSPF:

    O E2 10.3.3.0 [110/20] via 192.168.12.2, 00:29:30, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:29:30, FastEthernet0/1
    O E2 10.2.2.0 [110/20] via 192.168.12.2, 00:29:30, FastEthernet0/0
    [110/20] via 192.168.13.3, 00:29:30, FastEthernet0/1
    Bước 5: R1 học các route từ R2 có AD là 102, từ R3 có AD là 103

    Thay đổi AD trên R1 để đạt được yêu cầu trên:

    R1(config)#router ospf 1
    R1(config-router)#distance 102 192.168.2.2 0.0.0.0
    R1(config-router)#distance 103 192.168.3.3 0.0.0.0

    Các tham số của câu lệnh “distance” được dùng ở trên là router – id của các router R2 và R3.
    Kiểm tra lại bằng cách xem bảng định tuyến của R1:

    R1#show ip route
    C 192.168.12.0/24 is directly connected, FastEthernet0/0
    1.0.0.0/24 is subnetted, 1 subnets
    C 1.1.1.0 is directly connected, Loopback0
    C 192.168.13.0/24 is directly connected, FastEthernet0/1
    2.0.0.0/24 is subnetted, 1 subnets
    O E2 2.2.2.0 [102/20] via 192.168.12.2, 00:04:48, FastEthernet0/0
    3.0.0.0/24 is subnetted, 1 subnets
    O E2 3.3.3.0 [103/20] via 192.168.13.3, 00:04:48, FastEthernet0/1
    10.0.0.0/24 is subnetted, 2 subnets
    O E2 10.3.3.0 [103/20] via 192.168.13.3, 00:04:48, FastEthernet0/1
    O E2 10.2.2.0 [102/20] via 192.168.12.2, 00:04:48, FastEthernet0/0
    O E2 192.168.23.0/24 [102/20] via 192.168.12.2, 00:04:48, FastEthernet0/0
    2. Cấu hình cuối cùng

    R1#show run
    interface Loopback0
    ip address 1.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.12.1 255.255.255.0
    !--More-- !
    interface FastEthernet0/1
    ip address 192.168.13.1 255.255.255.0
    !
    router ospf 1
    log-adjacency-changes
    network 1.1.1.0 0.0.0.255 area 0
    network 192.168.12.0 0.0.0.255 area 0
    network 192.168.13.0 0.0.0.255 area 0
    distance 102 192.168.2.2 0.0.0.0
    distance 103 192.168.3.3 0.0.0.0
    !
    R2#show run
    interface Loopback0
    ip address 2.2.2.2 255.255.255.0
    !
    interface Loopback1
    ip address 192.168.2.2 255.255.255.0
    !
    interface Loopback2
    ip address 10.2.2.2 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.12.2 255.255.255.0
    !
    interface FastEthernet0/1
    ip address 192.168.23.2 255.255.255.0
    !
    router eigrp 1
    redistribute connected route-map abc
    redistribute ospf 1 metric 1000 100 255 1 1500
    network 10.2.2.0 0.0.0.255
    network 192.168.23.0
    no auto-summary
    !
    router ospf 1
    log-adjacency-changes
    redistribute connected subnets route-map abc
    redistribute eigrp 1 subnets
    network 192.168.12.0 0.0.0.255 area 0
    distance 85
    !
    access-list 1 permit 192.168.2.0
    !
    route-map abc deny 10
    match ip address 1
    !
    route-map abc permit 20
    R3#show run
    interface Loopback0
    ip address 3.3.3.3 255.255.255.0
    !
    interface Loopback1
    ip address 192.168.3.3 255.255.255.0
    !
    interface Loopback2
    ip address 10.3.3.3 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.23.3 255.255.255.0
    !
    interface FastEthernet0/1
    ip address 192.168.13.3 255.255.255.0
    !
    router eigrp 1
    redistribute connected route-map abc
    redistribute ospf 1 metric 1000 100 255 1 1500
    network 10.3.3.0 0.0.0.255
    network 192.168.23.0
    no auto-summary
    !
    router ospf 1
    log-adjacency-changes
    redistribute connected subnets route-map abc
    redistribute eigrp 1 subnets
    network 192.168.13.0 0.0.0.255 area 0
    distance 84
    !
    access-list 1 permit 192.168.3.0
    !
    route-map abc deny 10
    match ip address 1
    !
    route-map abc permit 20
    Email : vnpro@vnpro.org
    ---------------------------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog
Working...
X