LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -

LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -

LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -

LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -

LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -
LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF -
(028) 35124257 - 0933 427 079

LAB 2.1: CẤU HÌNH COST VÀ PRIORITY TRONG OSPF

1. Yêu cầu

  • Cấu hình OSPF đơn vùng trên các router.
  • Cho các cổng loopback tham gia định tuyến OSPF.
  • Thực hiện một số lệnh show, quan sát kết quả.
  • Hiệu chỉnh các thông số của tiến trình OSPF (cost, priority…).

2. Mô hình

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

Thực hiện gán địa chỉ IP cho các cổng router như hình 2.1.

Trên router R1:

R1# configure terminal

R1(config)# interface Loopback1

R1(config-if)# description Engineering Department

R1(config-if)# ip address 10.1.1.1 255.255.255.0

R1(config-if)# exit

R1(config)# interface FastEthernet0/0

R1(config-if)# ip address 10.1.100.1 255.255.255.0

R1(config-if)# no shutdown

R1(config)# interface Serial 0/0/0 

R1(config-if)# ip address 10.1.100.1 255.255.255.0

R1(config-if)# clockrate 64000

R1(config-if)# no shutdown

Trên router R2:

R2# configure terminal

R2(config)# interface Loopback2

R2(config-if)# description Marketing Department

R2(config-if)# ip address 10.1.2.1 255.255.255.0

R2(config-if)# exit

R2(config)# interface FastEthernet0/0

R2(config-if)# ip address 10.1.100.2 255.255.255.0

R2(config-if)# no shutdown

R2(config)# interface Serial 0/0/0 

R2(config-if)# ip address 10.1.100.2 255.255.255.0

R2(config-if)# no shutdown

Trên router R3:

R3# configure terminal

R3(config)# interface Loopback3

R3(config-if)# description Accounting Department

R3(config-if)# ip address 10.1.3.1 255.255.255.0

R3(config-if)# exit

R3(config)# interface FastEthernet0/0

R3(config-if)# ip address 10.1.100.3 255.255.255.0

R3(config-if)# no shutdown

Bước 2: Chạy OSPF và cho các cổng vật lý tham gia OSPF

Trên router R1:

R1(config)# router ospf 1

R1(config-router)# network 10.1.100.0 0.0.0.255 area 0

R1(config-router)# network 10.1.200.1 0.0.0.0 area 0

R1(config-router)# end

Trên router R2:

R2(config)# router ospf 1

R2(config-router)# network 10.1.100.0 0.0.0.255 area 0

R2(config-router)# network 10.1.200.0 0.0.0.255 area 0

Trên router R3:

R3(config)# router ospf 1

R3(config-router)# network 10.1.200.0 0.0.0.255 area 0

Bước 3: Thử các lệnh “show” trong OSPF        

Lệnh “show ip protocol”:

R1# show ip protocols 

Routing Protocol is "ospf 1"

  Outgoing update filter list for all interfaces is not set

  Incoming update filter list for all interfaces is not set

  Router ID 10.1.1.1  

  Number of areas in this router is 1. 1 normal 0 stub 0 nssa

  Maximum path: 4

  Routing for Networks:

    10.1.100.0 0.0.0.255 area 0

    10.1.200.1 0.0.0.0 area 0

 Reference bandwidth unit is 100 mbps

  Routing Information Sources:

    Gateway         Distance      Last Update

    10.1.2.1             110      00:04:21

  Distance: (default is 110)

Từ kết quả xuất ra của lệnh này khi thực hiện trên R1, ta có một số thông tin như sau:

  • Router – ID của router R1 là 10.1.1.1
  • R1 đã thực hiện định tuyến (cho tham gia OSPF) các mạng: 10.1.100.0/24 và 10.1.200.1/32.

Lệnh “show ip ospf”:

R1# show ip ospf

 Routing Process "ospf 1" with ID 10.1.1.1

 Start time: 00:17:44.612, Time elapsed: 00:10:51.408

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Supports Link-local Signaling (LLS)

 Supports area transit capability

 Router is not originating router-LSAs with maximum metric

 Initial SPF schedule delay 5000 msecs

 Minimum hold time between two consecutive SPFs 10000 msecs

 Maximum wait time between two consecutive SPFs 10000 msecs

 Incremental-SPF disabled

Minimum LSA interval 5 secs

 Minimum LSA arrival 1000 msecs

 LSA group pacing timer 240 secs

 Interface flood pacing timer 33 msecs

 Retransmission pacing timer 66 msecs

 Number of external LSA 0. Checksum Sum 0x000000

 Number of opaque AS LSA 0. Checksum Sum 0x000000

 Number of DCbitless external and opaque AS LSA 0

 Number of DoNotAge external and opaque AS LSA 0

 Number of areas in this router is 1. 1 normal 0 stub 0 nssa

 Number of areas transit capable is 0

 External flood list length 0

    Area BACKBONE(0)

        Number of interfaces in this area is 2

        Area has no authentication

        SPF algorithm last executed 00:03:21.132 ago

        SPF algorithm executed 5 times

        Area ranges are

        Number of LSA 4. Checksum Sum 0x021A30

        Number of opaque link LSA 0. Checksum Sum 0x000000

        Number of DCbitless LSA 0

        Number of indication LSA 0

        Number of DoNotAge LSA 0

        Flood list length 0

Lệnh này giúp ta xem được nhiều thông số của tiến trình OSPF đang chạy trên router. Ví dụ: ta xác định được router R1 đang chạy OSPF có số process – ID = 1, và có router – ID là: 10.1.1.1.

Lệnh “show ip ospf neighbor”:

R1# show ip ospf neighbor

 

Neighbor ID   Pri  State         Dead Time  Address      Interface

10.1.2.1      1    FULL/DR       00:00:33   10.1.200.2   FastEthernet0/0

10.1.3.1      1    FULL/DROTHER  00:00:32   10.1.200.3   FastEthernet0/0

10.1.2.1      0    FULL/  -      00:00:33   10.1.100.2   Serial0/0/0

Lệnh này hiển thị các láng giềng (neighbor) của router. Ở trên, ta thấy router R1 có 03 láng giềng trao đổi thông tin định tuyến với nó qua các cổng F0/0 và S0/0/0. Riêng láng giềng 10.1.2.1 được học hai lần: một qua cổng F0/0, một qua cổng S0/0/0. Vì trên môi trường multiaccess phải xảy ra bầu chọn router điều phối thông tin định tuyến DR (Designated Router) và BDR dự phòng cho DR (Backup DR) nên ta thấy các láng giềng được học qua cổng Fast Ethernet đều được xác định rõ vai trò là DR, BDR hay DROther. Từ bảng neighbor ở trên, ta có thể xác định được vai trò của router R1 trên môi trường multiaccess là BDR.

Lệnh “show ip ospf interface”:

R1# show ip ospf interface FastEthernet 0/0

FastEthernet0/0 is up, line protocol is up 

  Internet Address 10.1.200.1/24, Area 0 

  Process ID 1, Router ID 10.1.1.1, Network Type BROADCAST, Cost: 1

  Transmit Delay is 1 sec, State BDR, Priority 1 
  Designated Router (ID) 10.1.2.1, Interface address 10.1.200.2

  Backup Designated router (ID) 10.1.1.1, Interface address 10.1.200.1

  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 2/2, flood queue length 0

  Next 0x0(0)/0x0(0)

  Last flood scan length is 0, maximum is 2

  Last flood scan time is 0 msec, maximum is 0 msec

  Neighbor Count is 2, Adjacent neighbor count is 2 

    Adjacent with neighbor 10.1.2.1  (Designated Router)

    Adjacent with neighbor 10.1.3.1

  Suppress hello for 0 neighbor(s)

Lệnh này liệt kê ra các cổng đã được tham gia vào định tuyến OSPF và các thông số của các cổng ấy khi tham gia OSPF như network – type, hello – timer, dead – timer…     

Lệnh “show ip ospf database”:

R1# show ip ospf database

            OSPF Router with ID (10.1.1.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     123    0x80000005  0x00546C 4

10.1.2.1       10.1.2.1     112    0x80000004  0x006C51 4

10.1.3.1       10.1.3.1     106    0x80000004  0x00F94C 2

               Net Link States (Area 0)

Link ID        ADV Router   Age    Seq#        Checksum

10.1.200.2     10.1.2.1     725    0x80000002  0x00D74F

(đã bỏ qua một số dòng)

Lệnh này hiển thị bảng cơ sở dữ liệu trạng thái đường liên kết trên router (LSDB – Link State DataBase).

Bước 4: Cho các cổng loopback tham gia OSPF

Cho các cổng loopback tham gia OSPF:

R1(config)# router ospf 1

R1(config-router)# network 10.1.1.0 0.0.0.255 area 0 

R2(config)# router ospf 1

R2(config-router)# network 10.1.2.0 0.0.0.255 area 0 

R3(config)# router ospf 1

R3(config-router)# network 10.1.3.0 0.0.0.255 area 0

Quan sát bảng định tuyến  trên các router khi các loopback đã tham gia định tuyến:

R1# show ip route

(đã bỏ qua một số dòng)

Gateway of last resort is not set

     10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks

O       10.1.2.1/32 [110/2] via 10.1.200.2, 00:00:03, FastEthernet0/0

O       10.1.3.1/32 [110/2] via 10.1.200.3, 00:00:03, FastEthernet0/0

C       10.1.1.0/24 is directly connected, Loopback1

C       10.1.100.0/24 is directly connected, Serial0/0/0

C       10.1.200.0/24 is directly connected, FastEthernet0/0

Để ý rằng các subnet trên các loopback đều được OSPF quảng bá đi với prefix – length là /32 bất kể prefix – length gốc của chúng là bao nhiêu. Để thay đổi điều này, vào các interface loopback gõ lệnh “ip ospf network point-to-point”:

R1(config)# interface loopback1    

R1(config-if)# ip ospf network point-to-point 

R2(config)# interface loopback2    

R2(config-if)# ip ospf network point-to-point 

R3(config)# interface loopback3    

R3(config-if)# ip ospf network point-to-point

Quan sát lại bảng định tuyến  trên các router:

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, 5 subnets

O       10.1.3.0 [110/2] via 10.1.200.3, 00:00:01, FastEthernet0/0

O       10.1.2.0 [110/2] via 10.1.200.2, 00:00:01, FastEthernet0/0

C       10.1.1.0 is directly connected, Loopback1

C       10.1.100.0 is directly connected, Serial0/0/0

C       10.1.200.0 is directly connected, FastEthernet0/0

Bước 5: Hiệu chỉnh cost trong OSPF

Sử dụng lệnh của mode config – interface “ip ospf cost” để hiệu chỉnh cost trên các cổng:

R1(config)# interface fastEthernet 0/0

R1(config-if)# ip ospf cost 50 

R2(config)# interface fastEthernet 0/0

R2(config-if)# ip ospf cost 50

R3(config)# interface fastEthernet 0/0

R3(config-if)# ip ospf cost 50 

Quan sát lại các route trong bảng định tuyến, ta thấy giá trị cost của các route OSPF đã thay đổi:

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, 5 subnets

O       10.1.3.0 [110/51] via 10.1.200.3, 00:01:40, FastEthernet0/0

O       10.1.2.0 [110/51] via 10.1.200.2, 00:01:40, FastEthernet0/0

C       10.1.1.0 is directly connected, Loopback1

C       10.1.100.0 is directly connected, Serial0/0/0

C       10.1.200.0 is directly connected, FastEthernet0/0

Một vài giá trị cost mặc định trên các cổng:

•   56-kbps serial link—Default cost is 1785. 

•   64-kbps serial link—Default cost is 1562. 

•   T1 (1.544-Mbps serial link)—Default cost is 64. 

•   E1 (2.048-Mbps serial link)—Default cost is 48. 

•   4-Mbps Token Ring—Default cost is 25. 

•   Ethernet—Default cost is 10. 

•   16-Mbps Token Ring—Default cost is 6.

•   FDDI—Default cost is 1. 

•   X25—Default cost is 5208. 

•   Asynchronous—Default cost is 10,000. 

•   ATM— Default cost is 1.

Bước 6: Chỉnh sửa Interface Priorities

Trên một kết nối multiaccess, DR và BDR sẽ được bầu chọn. Router với cổng multiaccess được cấu hình giá trị priority cao nhất sẽ trở thành DR, cao nhì sẽ trở thành BDR, các router còn lại sẽ trở thành DROther. Nếu các giá trị priority để bằng nhau hết thì sẽ dùng router – id để bầu chọn: router có router – id cao nhất sẽ trở thành DR, cao nhì trở thành BDR,… Trong môi trường multiacces ở trên, vì các giá trị priority để ở mặc định  (= 1) nên R3 được bầu làm DR vì có router – id cao nhất (10.1.3.1), R2 làm BDR vì có router – id cao nhì (10.1.2.1) và R1 làm DROther vì có router – id thấp nhất (10.1.1.1). Ta sẽ thực hiện hiệu chỉnh giá trị priority trên các cổng Fast Ethernet của các router để đảo nghịch kết quả bầu chọn: R1 làm DR, R2 làm BDR và R3 làm DROther. Ta sử dụng câu lệnh “ip ospf priority” trên cổng.

R1(config)# interface fastEthernet 0/0

R1(config-if)# ip ospf priority 10 

R2(config)# interface fastEthernet 0/0

R2(config-if)# ip ospf priority 5

 Ta thực hiện các lệnh show để kiểm tra lại:

R1# show ip ospf neighbor detail

 Neighbor 10.1.2.1, interface address 10.1.200.2

    In the area 0 via interface FastEthernet0/0 

    Neighbor priority is 5, State is FULL, 12 state changes

    DR is 10.1.200.1 BDR is 10.1.200.2

    Options is 0x52

    LLS Options is 0x1 (LR)

    Dead timer due in 00:00:37

    Neighbor is up for 00:01:32

    Index 3/3, retransmission queue length 0, number of retransmission 0

    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)

    Last retransmission scan length is 0, maximum is 0

    Last retransmission scan time is 0 msec, maximum is 0 msec

 Neighbor 10.1.3.1, interface address 10.1.200.3

    In the area 0 via interface FastEthernet0/0 

    Neighbor priority is 1, State is FULL, 12 state changes

    DR is 10.1.200.1 BDR is 10.1.200.2

(đã bỏ qua một số dòng)

Để câu lệnh thay đổi priority có hiệu lực, bạn cần phải sử dụng thêm lệnh “R#clear ip ospf process” trên tất cả các router .

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

R1# show run

!

hostname R1

!

interface Loopback1

 description Engineering Department

 ip address 10.1.1.1 255.255.255.0

 ip ospf network point-to-point

!

interface FastEthernet0/0

 ip address 10.1.200.1 255.255.255.0

 ip ospf cost 50

 ip ospf priority 10

 duplex auto

 speed auto

!

interface Serial0/0/0

 ip address 10.1.100.1 255.255.255.0

 clock rate 64000

!

router ospf 1

 network 10.1.1.0 0.0.0.255 area 0

 network 10.1.100.0 0.0.0.255 area 0

 network 10.1.200.1 0.0.0.0 area 0

!

end

R2# show run

!

hostname R2

!

interface Loopback2

 description Marketing Department

 ip address 10.1.2.1 255.255.255.0

 ip ospf network point-to-point

!

interface FastEthernet0/0

 ip address 10.1.200.2 255.255.255.0

 ip ospf priority 5

!

interface Serial0/0/0

 ip address 10.1.100.2 255.255.255.0

!

router ospf 1

 network 10.1.2.0 0.0.0.255 area 0

 network 10.1.100.0 0.0.0.255 area 0

 network 10.1.200.0 0.0.0.255 area 0

!

end

R3# show run

!

hostname R3

!

interface Loopback3

 description Accounting Department

 ip address 10.1.3.1 255.255.255.0 15

 ip ospf network point-to-point

!

interface FastEthernet0/0

 ip address 10.1.200.3 255.255.255.0

!

router ospf 1

 network 10.1.3.0 0.0.0.255 area 0

 network 10.1.200.0 0.0.0.255 area 0

!

End


FORM ĐĂNG KÝ MUA HÀNG
Đặt hàng
icon-cart
0