• 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.3: Ospf virtual links và area summarization

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

  • Lab 2.3: Ospf virtual links và area summarization

    1. Yêu cầu
    • Cấu hình OSPF đa vùng trên các router.
    • Tạo đường kết nối ảo.
    • Tóm tắt địa chỉ trong OSPF.
    • Quảng bá default route vào OSPF.

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

Name:	23-3 HÌNH 1.jpg
Views:	40
Size:	47.4 KB
ID:	427103

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

    Gán địa chỉ IP cho các cổng router như hình 2.3:
    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 loopback 30
    R1(config-if)# ip address 172.30.30.1 255.255.255.252
    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 100
    R3(config-if)# ip address 192.168.100.1 255.255.255.0
    R3(config-if)# interface loopback 101
    R3(config-if)# ip address 192.168.101.1 255.255.255.0
    R3(config-if)# interface loopback 102
    R3(config-if)# ip address 192.168.102.1 255.255.255.0
    R3(config-if)# interface loopback 103
    R3(config-if)# ip address 192.168.103.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: Cho các cổng tham gia vào OSPF

    Cho các cổng loopback 1 và serial s0/0/0 của router R1 tham gia vào OSPF 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

    Cho các cổng loopback 2 và serial s0/0/0 của router R2 tham gia vào OSPF area 0:

    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

    Cho cổng serial s0/0/1 của router R2 tham gia vào OSPF area 23:

    R2(config)# router ospf 1
    R2(config-router)# network 10.1.23.0 0.0.0.255 area 23

    Cho các cổng loopback 3 và serial s0/0/1 của router R3 tham gia vào OSPF 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

    Cho đến lúc này, sau khi OSPF hội tụ, đứng trên bất kỳ router nào cũng có thể ping đến tất cả các IP trong mạng, ngoại trừ IP cổng loopback 30 trên R1 và các loopback 100 đến 103 trên R3. Bước 3: Tạo liên kết ảo (virtual link)

    Cho các cổng loopback 100 đến 103 của router R3 tham gia vào OSPF area 100:

    R3(config)# router ospf 1
    R3(config-router)# network 192.168.100.0 0.0.3.255 area 100
    R3(config-router)# interface loopback 100
    R3(config-if)# ip ospf network point-to-point
    R3(config-if)# interface loopback 101
    R3(config-if)# ip ospf network point-to-point
    R3(config-if)# interface loopback 102
    R3(config-if)# ip ospf network point-to-point
    R3(config-if)# interface loopback 103
    R3(config-if)# ip ospf network point-to-point

    Xem bảng định tuyến trên router R2:

    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, 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:01:00, 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:10, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1

    Ta thấy R2 không thấy các mạng của các loopback 100 đến 103 của router R3. Đó là vì các loopback này tham gia OSPF vùng 100 và vùng này không kết nối trực tiếp về vùng 0 mà chỉ kết nối đến vùng 23.
    Để các nơi khác có thể đi đến được vùng 100, ta phải tạo một kết nối vật lý từ vùng 100 về vùng 0 hoặc tạo một đường hầm xuyên qua vùng 23 để nối vùng 100 về vùng 0. Trong bài lab này, ta sẽ sử dụng giải pháp tạo đường hầm bằng cách xây dựng liên kết ảo (virtual link) trên vùng 23:

    R2(config)# router ospf 1
    R2(config-router)# area 23 virtual-link 192.168.103.1
    R3(config)# router ospf 1
    R3(config-router)# area 23 virtual-link 10.1.2.1

    Sau khi đã tạo xong virtual link, xem lại bảng định tuyến trên router R2:

    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, 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:01:35, 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:01:35, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1
    O IA 192.168.102.0/24 [110/65] via 10.1.23.3, 00:00:05, Serial0/0/1
    O IA 192.168.103.0/24 [110/65] via 10.1.23.3, 00:00:05, Serial0/0/1
    O IA 192.168.100.0/24 [110/65] via 10.1.23.3, 00:00:57, Serial0/0/1
    O IA 192.168.101.0/24 [110/65] via 10.1.23.3, 00:00:16, Serial0/0/1

    Lúc này, các route đi đến các loopback của vùng 100 đã hiện ra trong bảng định tuyến của R2 và được đánh dấu là route liên vùng (O IA).
    Router R2 có thêm một adjacency nữa qua đường virtual link:

    R2# show ip ospf neighbor
    Neighbor ID Pri State Dead Time Address Interface
    192.168.103.1 0 FULL/ - - 10.1.23.3 OSPF_VL0
    10.1.1.1 0 FULL/ - 00:00:30 10.1.12.1 Serial0/0/0
    192.168.103.1 0 FULL/ - 00:00:30 10.1.23.3 Serial0/0/1

    Để quan sát các thông số OSPF trên đường virtual link, ta sử dụng lệnh “show ip ospf interface”:

    R2# show ip ospf interface
    (đã bỏ qua một số dòng)
    OSPF_VL0 is up, line protocol is up
    Internet Address 10.1.23.2/24, Area 0
    Process ID 1, Router ID 10.1.2.1, Network Type VIRTUAL_LINK, Cost: 64
    Configured as demand circuit.
    Run as demand circuit.
    DoNotAge LSA allowed.
    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:03
    Supports Link-local Signaling (LLS)
    Index 3/4, 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 1, Adjacent neighbor count is 1
    Adjacent with neighbor 192.168.103.1 (Hello suppressed)
    Suppress hello for 1 neighbor(s)
    (đã bỏ qua một số dòng)
    Bước 4: Tóm tắt địa chỉ

    Thực hiện tóm tắt các mạng loopback 100 đến 103 trên router R3 bằng câu lệnh “area area – id range network mask”.

    R3(config)# router ospf 1
    R3(config-router)# area 100 range 192.168.100.0 255.255.252.0

    Kiểm tra lại kết quả của việc tóm tắt này bằng cách xem bảng định tuyến và bảng LSDB (Link State Database – cơ sở dữ liệu trạng thái liên kết) của R2:

    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:07:25, 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:07:25, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1
    O IA 192.168.100.0/22 [110/65] via 10.1.23.3, 00:00:01, Serial0/0/1
    R2# show ip ospf database

    OSPF Router with ID (10.1.2.1) (Process ID 1)

    Router Link States (Area 0)

    Link ID ADV Router Age Seq# Checksum Link
    count

    10.1.1.1 10.1.1.1 969 0x80000002 0x00C668 3
    10.1.2.1 10.1.2.1 498 0x80000005 0x00924E 4
    192.168.103.1 192.168.103.1 5 (DNA) 0x80000002 0x00A573 1

    Summary Net Link States (Area 0)

    Link ID ADV Router Age Seq# Checksum
    10.1.3.0 10.1.2.1 537 0x80000001 0x00EFEF
    10.1.3.0 192.168.103.1 11 (DNA) 0x80000001 0x00FD5E
    10.1.23.0 10.1.2.1 557 0x80000001 0x0009C3
    10.1.23.0 192.168.103.1 11 (DNA) 0x80000001 0x00996F
    192.168.100.0 192.168.103.1 1 (DNA) 0x80000001 0x009C03


    Router Link States (Area 23)

    Link ID ADV Router Age Seq# Checksum Link
    count

    10.1.2.1 10.1.2.1 498 0x80000009 0x00D191 2
    192.168.103.1 192.168.103.1 499 0x80000004 0x00A7DC 3

    Summary Net Link States (Area 23)

    Link ID ADV Router Age Seq# Checksum
    10.1.1.0 10.1.2.1 563 0x80000001 0x0006DB
    10.1.2.0 10.1.2.1 563 0x80000001 0x0078A8
    10.1.12.0 10.1.2.1 563 0x80000001 0x008255
    192.168.100.0 192.168.103.1 51 0x80000002 0x009A04

    Chú ý: R3 tự tạo ra route tóm tắt chỉ đến Null0:

    R3# show ip route
    (đã bỏ qua một số dòng)
    C 192.168.102.0/24 is directly connected, Loopback102
    C 192.168.103.0/24 is directly connected, Loopback103
    C 192.168.100.0/24 is directly connected, Loopback100
    C 192.168.101.0/24 is directly connected, Loopback101
    O 192.168.100.0/22 is a summary, 00:01:19, Null0

    Route chỉ đến Null0 được tạo ra nhằm mục đích chống loop.
    Bước 5: Quáng bá default route vào OSPF

    Giả lập loopback 30 trên R1 là kết nối Internet, không cho mạng này tham gia vào OSPF. Mọi gói tin đi Internet sẽ phải đi đến R1, do đó ta sẽ cho R1 đưa default route đến tất cả các router còn lại trong mạng để chỉ đường đến nó với các gói tin mà địa chỉ đích không thỏa mãn bất kỳ entry nào trong bảng định tuyến:

    R1(config)# router ospf 1
    R1(config-router)# default-information originate always

    Từ khóa “always” để ép R1 luôn đưa default route vào trong bất kể trên nó có sẵn default route hay không. Không có từ khóa này, R1 sẽ chỉ đưa default route vào trong khi trên nó có sẵn default route.
    Kiểm tra rằng trên bảng định tuyến của R2 và R3 đã xuất hiện default route bằng lệnh “show ip route”:

    R2# show ip route
    (đã bỏ qua một số dòng)
    Gateway of last resort is 10.1.12.1 to network 0.0.0.0

    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:10:36, 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:00:19, Serial0/0/0
    C 10.1.23.0 is directly connected, Serial0/0/1
    O*E2 0.0.0.0/0 [110/1] via 10.1.12.1, 00:00:09, Serial0/0/0
    O IA 192.168.100.0/22 [110/65] via 10.1.23.3, 00:00:19, Serial0/0/1
    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
    (đã bỏ qua một số dòng)
    C 192.168.103.0/24 is directly connected, Loopback103
    C 192.168.100.0/24 is directly connected, Loopback100
    C 192.168.101.0/24 is directly connected, Loopback101
    O*E2 0.0.0.0/0 [110/1] via 10.1.23.2, 00:00:26, Serial0/0/1
    O 192.168.100.0/22 is a summary, 00:03:28, Null0

    Từ R2 và R3, bạn sẽ ping được địa chỉ Internet (trường hợp này là cổng loopback 30 trên R1), mặc dù địa chỉ này chưa được quảng bá vào OSPF, đó là nhờ default route.

    R3# ping 172.30.30.1
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 172.30.30.1, timeout is 2 seconds:
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 28/30/32 ms
    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 Loopback30
    ip address 172.30.30.1 255.255.255.252
    !
    interface Serial0/0/0
    ip address 10.1.12.1 255.255.255.0
    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
    default-information originate always
    !
    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
    no shutdown
    !
    router ospf 1
    area 23 virtual-link 192.168.103.1
    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 Loopback100
    ip address 192.168.100.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Loopback101
    ip address 192.168.101.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Loopback102
    ip address 192.168.102.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Loopback103
    ip address 192.168.103.1 255.255.255.0
    ip ospf network point-to-point
    !
    interface Serial0/0/1
    ip address 10.1.23.3 255.255.255.0
    clock rate 2000000
    no shutdown
    !
    router ospf 1
    area 23 virtual-link 10.1.2.1
    area 100 range 192.168.100.0 255.255.252.0
    network 10.1.3.0 0.0.0.255 area 23
    network 10.1.23.0 0.0.0.255 area 23
    network 192.168.100.0 0.0.3.255 area 100
    !
    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