• 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 2.2: Cấu hình vùng stub và xác thực trong ospf

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

  • Lab 2.2: Cấu hình vùng stub và xác thực trong ospf

    1. Yêu cầu
    • Cấu hình OSPF đa vùng trên các router.
    • Cấu hình các vùng OSPF đặc biệt: stub, totally stubby, và not so stubby area.
    • Cấu hình xác thực OSPF.

    2. Mô hình
    Click image for larger version

Name:	22-3 HÌNH 1.jpg
Views:	30
Size:	38.1 KB
ID:	427101

    Bước 1: Gán địa chỉ IP

    Trên router R1:

    R1# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R1(config)# interface loopback 1
    R1(config-if)# ip address 10.1.1.1 255.255.255.0
    R1(config-if)# interface serial 0/0/0
    R1(config-if)# ip address 10.1.12.1 255.255.255.0
    R1(config-if)# clockrate 64000
    R1(config-if)# no shutdown

    Trên router R2:

    R2# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R2(config)# interface loopback 2
    R2(config-if)# ip address 10.1.2.1 255.255.255.0
    R2(config-if)# interface serial 0/0/0
    R2(config-if)# ip address 10.1.12.2 255.255.255.0
    R2(config-if)# no shutdown
    R2(config-if)# interface serial 0/0/1
    R2(config-if)# ip address 10.1.23.2 255.255.255.0
    R2(config-if)# clockrate 64000
    R2(config-if)# no shutdown

    Trên router R3:

    R3# configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    R3(config)# interface loopback 3
    R3(config-if)# ip address 10.1.3.1 255.255.255.0
    R3(config-if)# interface loopback 20
    R3(config-if)# ip address 172.20.200.1 255.255.255.0
    R3(config-if)# interface serial 0/0/1
    R3(config-if)# ip address 10.1.23.1 255.255.255.0
    R3(config-if)# no shutdown

    Bước 2: Cấu hình OSPF đa vùng

    Cấu hình OSPF, cho các cổng serial và cổng loopback của R1; cổng S0/0/0 và cổng loopback của R2 tham gia vùng 0 (area 0):

    R1(config)# router ospf 1
    R1(config-router)# network 10.1.12.0 0.0.0.255 area 0
    R1(config-router)# network 10.1.1.0 0.0.0.255 area 0
    R1(config-router)# interface loopback 1
    R1(config-if)# ip ospf network point-to-point
    R2(config)# router ospf 1
    R2(config-router)# network 10.1.12.0 0.0.0.255 area 0
    R2(config-router)# network 10.1.2.0 0.0.0.255 area 0
    R2(config-router)# interface loopback 2
    R2(config-if)# ip ospf network point-to-point

    Xem bảng định tuyến trên các router R1 và R2:

    R1# show ip route
    (đã bỏ qua một số dòng)
    Gateway of last resort is not set
    10.0.0.0/24 is subnetted, 3 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    O 10.1.2.0 [110/65] via 10.1.12.2, 00:00:10, Serial0/0/0
    C 10.1.1.0 is directly connected, Loopback1
    R2# show ip route
    (đã bỏ qua một số dòng)
    Gateway of last resort is not set
    10.0.0.0/24 is subnetted, 4 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    C 10.1.2.0 is directly connected, Loopback2
    O 10.1.1.0 [110/65] via 10.1.12.1, 00:00:30, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1

    Cho cổng serial còn lại của R2 và các cổng của R3 tham gia vùng 23:

    R2(config)# router ospf 1
    R2(config-router)# network 10.1.23.0 0.0.0.255 area 23
    R3(config)# router ospf 1
    R3(config-router)# network 10.1.23.0 0.0.0.255 area 23
    R3(config-router)# network 10.1.3.0 0.0.0.255 area 23
    R3(config-router)# interface loopback 3
    R3(config-if)# ip ospf network point-to-point

    Thực hiện lệnh “show ip route” trên router R1 để xem bảng định tuyến. Ta thấy route 10.1.3.0/24 và 10.1.23.0/24 được đánh dấu là
    O IA vì đây là route ngoại vùng được học từ một vùng khác:


    R1# show ip route
    (đã bỏ qua một số dòng)
    10.0.0.0/24 is subnetted, 5 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    O IA 10.1.3.0 [110/129] via 10.1.12.2, 00:00:28, Serial0/0/0
    O 10.1.2.0 [110/65] via 10.1.12.2, 00:01:38, Serial0/0/0
    C 10.1.1.0 is directly connected, Loopback1
    O IA 10.1.23.0 [110/128] via 10.1.12.2, 00:01:38, Serial0/0/0

    Thực hiện lại lệnh “show ip route” trên router R2, ta không thấy route nào bị đánh dấu “O IA” vì router R2 là router biên nằm giữa hai vùng, ta gọi router này là ABR (Area Border Router).

    R2# show ip route
    (đã bỏ qua một số dòng)
    10.0.0.0/24 is subnetted, 5 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    O 10.1.3.0 [110/65] via 10.1.23.3, 00:00:50, Serial0/0/1
    C 10.1.2.0 is directly connected, Loopback2
    O 10.1.1.0 [110/65] via 10.1.12.1, 00:02:00, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1

    Bước 3: Cấu hình vùng Stub

    Sử dụng lệnh “area area-id stub” trên các router R2 và R3 để cấu hình vùng 23 thành vùng stub:

    R2(config)# router ospf 1
    R2(config-router)# area 23 stub
    R3(config)# router ospf 1
    R3(config-router)# area 23 stub

    Sử dụng lệnh “show ip route” trên router R3 để quan sát bảng định tuyến. Để ý rằng R3 thuộc vùng stub, nó được ABR đưa vào một default – route thay cho mọi route ngoài AS khác (các route loại OE 1 hoặc OE 2). Vùng stub không tiếp nhận LSA type – 5.

    R3# show ip route
    (đã bỏ qua một số dòng)
    O IA 10.1.1.0 [110/129] via 10.1.23.2, 00:00:56, Serial0/0/1
    C 10.1.23.0 is directly connected, Serial0/0/1
    O*IA 0.0.0.0/0 [110/65] via 10.1.23.2, 00:00:56, Serial0/0/1

    Để xem area 23 trên router thuộc loại area nào, dùng lệnh “show ip ospf”:

    R2# show ip ospf
    (đã bỏ qua một số dòng)
    Area 23
    Number of interfaces in this area is 1
    It is a stub area
    generates stub default route with cost 1

    Bước 4: Cấu hình vùng Totally Stubby

    Để cấu hình vùng totally stubby, ta chỉ cần sử dụng thêm tham số “no-summary” trong câu lệnh tạo vùng stub trên router ABR của vùng stub. Bên cạnh việc không tiếp nhận LSA type 5, vùng totally stubby sẽ không tiếp nhận cả LSA type 3. Do đó, các route
    O IA sẽ không xuất hiện trong bảng định tuyến của các internal router trong vùng totally stubby. Các route liên vùng (
    O IA) và các route ngoại (O E1 và O E2) sẽ được thay thế bằng một default route do ABR đưa vào.


    R2(config)# router ospf 1
    R2(config-router)# area 23 stub no-summary
    R3# show ip route
    (đã bỏ qua một số dòng)
    Gateway of last resort is 10.1.23.2 to network 0.0.0.0
    172.20.0.0/24 is subnetted, 1 subnets
    C 172.20.200.0 is directly connected, Loopback20
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.1.3.0 is directly connected, Loopback3
    C 10.1.23.0 is directly connected, Serial0/0/1
    O*IA 0.0.0.0/0 [110/65] via 10.1.23.2, 00:00:10, Serial0/0/1

    Bước 5: Cấu hình vùng NSSA (Not So Stubby Area)

    Vùng NSSA có tính chất hoàn toàn giống những stub bình thường, ngoại trừ việc cho phép những route ngoại được phân phối từ ASBR router được đi vào trong vùng. Điều này được thực hiện bằng cách sử dụng một loại LSA đặc biệt – LSA type 7. Các LSA type 7 khi di chuyển đến ABR sẽ được ABR chuyển đổi thành LSA type 5 từ đó được vận chuyển tiếp đi đến toàn mạng. Trong bước này, chúng ta sẽ thay đổi area 23 thành vùng NSSA. NSSA không tương thích với stub area, do đó việc đầu tiên là bỏ cấu hình stub area trên R2 và R3, sử dụng lệnh “no area 23 stub”.
    Tiếp theo, ta gõ tiếp lệnh “area area-id nssa” trên R2 và R3 để cấu hình vùng NSSA. Để sinh ra route bên ngoài vào vùng NSSA, trên R3 ta sử dụng lệnh “redistribute connected subnets”.

    R2(config)# router ospf 1
    R2(config-router)# no area 23 stub
    R2(config-router)# area 23 nssa
    R3(config)# router ospf 1
    R3(config-router)# no area 23 stub
    R3(config-router)# area 23 nssa
    R3(config-router)# redistribute connected subnets

    Thực hiện lệnh “show ip route” trên các router để xem thông tin về route ngoại được R3 redistribute vào OSPF sẽ được hiển thị như thế nào.

    R2# show ip route
    (đã bỏ qua một số dòng)
    172.20.0.0/24 is subnetted, 1 subnets
    O N2 172.20.200.0 [110/20] via 10.1.23.3, 00:00:41, Serial0/0/1
    10.0.0.0/24 is subnetted, 5 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    O 10.1.3.0 [110/65] via 10.1.23.3, 00:00:47, Serial0/0/1
    C 10.1.2.0 is directly connected, Loopback2
    O 10.1.1.0 [110/65] via 10.1.12.1, 00:03:42, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1

    Trong bảng định tuyến của R2, ta thấy route ngoại được R3 đưa vào được đánh dấu là O N2. Nếu còn router nào khác có kết nối thuộc vùng 23 thì router này cũng sẽ thấy route này trong bảng định tuyến được đánh dấu là O N2. Các route ngoại được đưa vào trong vùng NSSA bằng LSA type 7 và hiển thị trong bảng định tuyến của các router nội vùng với ký hiệu O N1 hoặc O N2.

    R1# show ip route
    (đã bỏ qua một số dòng)
    172.20.0.0/24 is subnetted, 1 subnets
    O E2 172.20.200.0 [110/20] via 10.1.12.2, 00:01:22, Serial0/0/0
    10.0.0.0/24 is subnetted, 5 subnets
    C 10.1.12.0 is directly connected, Serial0/0/0
    O IA 10.1.3.0 [110/129] via 10.1.12.2, 00:02:06, Serial0/0/0
    O 10.1.2.0 [110/65] via 10.1.12.2, 00:04:22, Serial0/0/0
    C 10.1.1.0 is directly connected, Loopback1
    O IA 10.1.23.0 [110/128] via 10.1.12.2, 00:04:22, Serial0/0/0

    Trong bảng định tuyến của R1, ta thấy route ngoại bây giờ lại được đánh dấu thành O E2, router ABR R2 đã thực hiện chuyển đổi route này từ LSA type 7 sang LSA type 5 để đưa đi toàn mạng.
    Chúng ta cũng có thể biến một vùng NSSA thành một vùng NSSA totally stubby, có nghĩa là vùng NSSA này sẽ không tiếp nhận LSA type 3, các router trong vùng sẽ không thấy các route liên vùng (O IA) trong bảng định tuyến của nó. Để thực hiện điều này, chúng ta sử dụng thêm tham số “no-summary” trong câu lệnh “area area-id nssa”.

    R2(config)# router ospf 1
    R2(config-router)# area 23 nssa no-summary

    Sau khi thực hiện, xem bảng định tuyến của R3:

    R3# show ip route
    (đã bỏ qua một số dòng)
    172.20.0.0/24 is subnetted, 1 subnets
    C 172.20.200.0 is directly connected, Loopback20
    10.0.0.0/24 is subnetted, 2 subnets
    C 10.1.3.0 is directly connected, Loopback3
    C 10.1.23.0 is directly connected, Serial0/0/1
    O*IA 0.0.0.0/0 [110/65] via 10.1.23.2, 00:00:20, Serial0/0/1

    Bước 6: Xác thực OSPF

    Vì lý do bảo mật, ta có thể bật xác thực giữa các cổng trong OSPF. Trong bài lab này, ta sẽ bật xác thực trên 2 kết nối serial: xác thực kiểu plain-text trên kết nối giữa R2 với R3 và xác thực dạng MD5 trên kết nối giữa R1 với R2.
    Để bật xác thực trên cổng, vào cổng đó, dùng lệnh “ip ospf authentication”. Tiếp theo, đặt mật mã “ip ospf authentication-key key-string”. Kiểm tra xác thực bằng lệnh “show ip ospf interface interface”.
    Xác thực kiểu plain – text trên kết nối giữa R2 và R3:

    R2(config)# interface serial 0/0/1
    R2(config-if)# ip ospf authentication
    R2(config-if)# ip ospf authentication-key cisco
    R3(config)# interface serial 0/0/1
    R3(config-if)# ip ospf authentication
    R3(config-if)# ip ospf authentication-key cisco

    Kiểm tra lại điều này bằng cách sử dụng câu lệnh “show ip ospf interface”:

    R2# show ip ospf interface serial 0/0/1
    Serial0/0/1 is up, line protocol is up
    Internet Address 10.1.23.2/24, Area 23
    Process ID 1, Router ID 10.1.2.1, Network Type POINT_TO_POINT, Cost: 64
    Transmit Delay is 1 sec, State POINT_TO_POINT,
    Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:09
    Supports Link-local Signaling (LLS)
    Index 1/3, flood queue length 0
    Next 0x0(0)/0x0(0)
    Last flood scan length is 1, maximum is 4
    Last flood scan time is 0 msec, maximum is 0 msec
    Neighbor Count is 1, Adjacent neighbor count is 1
    Adjacent with neighbor 172.20.200.1
    Suppress hello for 0 neighbor(s)
    Simple password authentication enabled

    Xác thực kiểu MD5 trên kết nối giữa R1 và R2:

    R1(config)# interface serial 0/0/0
    R1(config-if)# ip ospf authentication message-digest
    R1(config-if)# ip ospf message-digest-key 1 md5 cisco
    R2(config)# interface serial 0/0/0
    R2(config-if)# ip ospf authentication message-digest
    R2(config-if)# ip ospf message-digest-key 1 md5 cisco

    Kiểm tra lại điều này bằng cách sử dụng câu lệnh “show ip ospf interface”:

    R1# show ip ospf interface serial 0/0/0
    Serial0/0/0 is up, line protocol is up
    Internet Address 10.1.12.1/24, Area 0
    Process ID 1, Router ID 10.1.1.1, Network Type POINT_TO_POINT, Cost: 64
    Transmit Delay is 1 sec, State POINT_TO_POINT,
    Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:08
    Supports Link-local Signaling (LLS)
    Index 1/1, flood queue length 0
    Next 0x0(0)/0x0(0)
    Last flood scan length is 1, maximum is 1
    Last flood scan time is 0 msec, maximum is 0 msec
    Neighbor Count is 0, Adjacent neighbor count is 0
    Suppress hello for 0 neighbor(s)
    Message digest authentication enabled
    Youngest key id is 1


    3. Cấu hình cuối cùng

    R1# show run
    !
    hostname R1
    !
    interface Loopback1
    ip address 10.1.1.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Serial0/0/0
    ip address 10.1.12.1 255.255.255.0
    ip ospf authentication message-digest
    ip ospf message-digest-key 1 md5 cisco
    clock rate 64000
    no shutdown
    !
    router ospf 1
    network 10.1.1.0 0.0.0.255 area 0
    network 10.1.12.0 0.0.0.255 area 0
    !
    end
    R2# show run
    !
    hostname R2
    !
    interface Loopback2
    ip address 10.1.2.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Serial0/0/0
    ip address 10.1.12.2 255.255.255.0
    no shutdown
    !
    interface Serial0/0/1
    ip address 10.1.23.2 255.255.255.0
    ip ospf authentication
    ip ospf authentication-key cisco
    no shutdown
    !
    router ospf 1
    area 23 nssa no-summary
    network 10.1.2.0 0.0.0.255 area 0
    network 10.1.12.0 0.0.0.255 area 0
    network 10.1.23.0 0.0.0.255 area 23
    !
    end
    R3# show run
    !
    hostname R3
    !
    interface Loopback3
    ip address 10.1.3.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Loopback20
    ip address 172.20.200.1 255.255.255.0
    !
    interface Serial0/0/1
    ip address 10.1.23.3 255.255.255.0
    ip ospf authentication
    ip ospf authentication-key cisco
    no shutdown
    !
    router ospf 1
    area 23 nssa
    redistribute connected subnets
    network 10.1.3.0 0.0.0.255 area 23
    network 10.1.23.0 0.0.0.255 area 23
    !
    end

    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