Có gì mới Nội dung nổi bật Bài viết mới Bài mới trên hồ sơ Hoạt động mới nhất
Thành viên Thành viên trực tuyến Bài mới trên hồ sơ Tìm trong hồ sơ cá nhân
Đăng nhậpĐăng kýCó gì mới?Phong cách giao diện System Sáng Tối Tìm kiếm
Tìm kiếm
Everywhere Chủ đề This forum This thread Chỉ tìm trong tiêu đề NoteBởi:TìmTìm kiếm nâng cao…
Bài viết mới
Tìm chủ đề
Menu Đăng nhập Đăng ký Install the app Cài đặt How to install the app on iOS
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Diễn đàn
NETWORK SOLUTIONS
Switching & Routing
Cisco
Lab
You are using an out of date browser. It may not display this or other websites correctly.You should upgrade or use an alternative browser. CCNPLab 2.1 Cấu hình Cost và Priority trong OSPF
Thread starterThread starterroot
Ngày gửiNgày gửi 25/11/2014
root
Moderator
I. Yêu cầu - Mô hình - Yêu cầu:
Cấu hình IP theo sơ đồ
cấu hình định tuyến OSPF trên các Router và cấu hình cho phép các interface Loopback được tham gia định tuyến OSPF
Kiểm tra lại các cấu hình bằng lệnh Show
Cấu hình chỉnh sửa COST
Hiệu chỉnh Priority để: R1 làm DR, R2 làm BDR và R3 làm DROTHER
II. Triển khai 1. Cấu hình IP cho các Router - Thực hiện cấu hình IP như hình vẽ [TABLE="class: outer_border, width: 700"] [TR] [TD]//Router 1 R1(config)#interface loopback 1 R1(config-if)#description Engineering Department R1(config-if)#ip add 10.1.1.1 255.255.255.0 R1(config-if)#int f0/0 R1(config-if)#ip add 10.1.200.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s1/0 R1(config-if)#ip add 10.1.100.1 255.255.255.0 R1(config-if)#no shut //Router 2 R2(config-if)#interface loopback 2 R2(config-if)#description Marketing Department R2(config-if)#ip add 10.1.2.1 255.255.255.0 R2(config-if)#int f0/0 R2(config-if)#ip add 10.1.200.2 255.255.255.0 R2(config-if)#no shut R2(config-if)#int s1/0 R2(config-if)#ip add 10.1.100.2 255.255.255.0 R2(config-if)#no shut //Router 3 R3(config-if)#interface loopback 3 R3(config-if)#description Accounting Department R3(config-if)#ip add 10.1.3.1 255.255.255.0 R3(config-if)#int f0/0 R3(config-if)#ip add 10.1.200.3 255.255.255.0 R3(config-if)#no shut[/TD] [/TR] [/TABLE] - Cấu hình định tuyến OSPF trên các Router[TABLE="class: outer_border, width: 600"] [TR] [TD]//Router 1 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.0 0.0.0.255 area 0 //Router 2 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 //Router 3 R3(config)#router ospf 1 R3(config-router)#network 10.1.200.0 0.0.0.255 area 0[/TD] [/TR] [/TABLE] - Sau khi cấu hình định tuyến xong các bạn sẽ thấy các thông báo Neighbor trong OSPF Mã: R1(config-router)# *Mar 1 00:11:08.175: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on Serial1/0 from LOADING to FULL, Loading Done R1(config-router)# *Mar 1 00:11:17.287: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.2.1 on FastEthernet0/0 from LOADING to FULL, Loading Done R1(config-router)# *Mar 1 00:11:27.287: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.3.1 on FastEthernet0/0 from LOADING to FULL, Loading Done 2. Kiểm tra với các lệnh SHOW - Thứ kiểm tra định tuyến trên Router 1 ta thấy
Router-ID của R1 là: 10.1.1.1
R1 đã thực hiện định tuyến OSPF với các mạng 10.1.100.0/24 và 10.1.200.0/24
Mã: R1#[COLOR=#ff0000][B]sh ip protocols[/B][/COLOR] [COLOR=#ff0000]Routing Protocol is "ospf 1"[/COLOR] Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set [COLOR=#ff0000] Router ID 10.1.1.1[/COLOR] Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: [COLOR=#ff0000] 10.1.100.0 0.0.0.255 area 0[/COLOR] [COLOR=#ff0000] 10.1.200.0 0.0.0.255 area 0[/COLOR] Reference bandwidth unit is 100 mbps Routing Information Sources: Gateway Distance Last Update Distance: (default is 110) - Lệnh "show ip ospf" cho các bạn biết thêm được nhiều các thông số khác
Process-ID = 1
Router-ID = 10.1.1.1
Mã: R1#[COLOR=#ff0000][B]sh ip ospf[/B][/COLOR] [COLOR=#ff0000] Routing Process "ospf 1" with ID 10.1.1.1[/COLOR] Start time: 00:09:34.632, Time elapsed: 00:15:57.400 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 IETF NSF helper support enabled Cisco NSF helper support enabled Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm last executed 00:14:00.696 ago SPF algorithm executed 5 times Area ranges are Number of LSA 4. Checksum Sum 0x02F53D 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 "show ip ospf neighbor" cho ta biết các Neighbor của Router R1. Như dưới đây ta có thể thấy R1 có 3 Neighbor trao đổi thông tin định tuyến với nó qua các interface F0/0 và S1/0 - Riêng Neighbor 10.1.2.1 được học 2 lần
1 lần qua interface f0/0
1 lần qua interface s1/0
- Vì trên môi trường Multiaccess phải bầu chọn Router làm DR(Designated Router) và BDR (Backup DR) dự phòng chi DR. - Theo bảng Neighbor interface f0/0 của R1 ta thấy
R1 đang trao đổi thông tin với 1 Router có chức năng DR
R1 cũng đang trao đổi thông tin với 1 Router DROTHER
=> vầy là R1 đang làm chức năng của 1 DR Router Mã: R1#[COLOR=#ff0000][B]sh ip ospf neighbor[/B][/COLOR] Neighbor ID Pri State Dead Time Address Interface 10.1.2.1 1 FULL/[COLOR=#ff0000]BDR[/COLOR] 00:00:38 10.1.200.2 FastEthernet0/0 10.1.3.1 1 FULL/[COLOR=#ff0000]DROTHER[/COLOR] 00:00:34 10.1.200.3 FastEthernet0/0 10.1.2.1 0 FULL/ - 00:00:32 10.1.100.2 Serial1/0 - Lệnh "show ip ospf interface" Lệnh này cho chúng ta biết
Các interface tham gia vào định tuyến OSPF
Các thông số của Interface tham gia đinh tuyến như: Network type, helo-timer, dead-timer...
Mã: R1#[COLOR=#ff0000][B]sh ip ospf interface[/B][/COLOR] 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,[COLOR=#ff0000] Network Type BROADCAST[/COLOR], Cost: 10 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 10.1.1.1, Interface address 10.1.200.1 Backup Designated router (ID) 10.1.2.1, Interface address 10.1.200.2 Timer intervals configured, [COLOR=#ff0000]Hello 10, Dead 40, Wait 40, Retransmit 5[/COLOR] oob-resync timeout 40 Hello due in 00:00:00 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 2/2, 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 2, Adjacent neighbor count is 2 Adjacent with neighbor 10.1.2.1 (Backup Designated Router) Adjacent with neighbor 10.1.3.1 Suppress hello for 0 neighbor(s) Serial1/0 is up, line protocol is up Internet Address 10.1.100.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:03 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled 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 1, Adjacent neighbor count is 1 Adjacent with neighbor 10.1.2.1 Suppress hello for 0 neighbor(s) - Lệnh "show ip ospf database" để 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) Mã: R1#[COLOR=#ff0000][B]sh ip ospf database[/B][/COLOR] 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 1765 0x80000004 0x00B81E 3 10.1.2.1 10.1.2.1 1766 0x80000002 0x00BD18 3 10.1.3.1 10.1.3.1 1751 0x80000002 0x0093CB 1 Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 10.1.200.1 10.1.1.1 1755 0x80000002 0x00EC3C 3. Cho phép interface loopback tham gia OSPF - cấu hình Router để interface loopback được tham gia vào định tuyến OSPF [TABLE="class: outer_border, width: 600"] [TR] [TD]//Router 1 R1(config)#router ospf 1 R1(config-router)#network 10.1.1.0 0.0.0.255 area 0 //Router 2 R2(config)#router ospf 1 R2(config-router)#network 10.1.2.0 0.0.0.255 area 0 //Router 3 R3(config)#router ospf 1 R3(config-router)#network 10.1.3.0 0.0.0.255 area 0[/TD] [/TR] [/TABLE] - Kiểm tra lại bảng định tuyến sau khi config Mã: R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks [COLOR=#ff0000]O 10.1.2.1/32 [110/11] via 10.1.200.2, 00:01:17, FastEthernet0/0[/COLOR] [COLOR=#ff0000]O 10.1.3.1/32 [110/11] via 10.1.200.3, 00:00:51, FastEthernet0/0[/COLOR] C 10.1.1.0/24 is directly connected, Loopback1 C 10.1.100.0/24 is directly connected, Serial1/0 C 10.1.200.0/24 is directly connected, FastEthernet0/0 - Chúng ta để ý nhé. Subnet trang các Loopback lúc nào cũng được OSPF quảng bá đi với Prefix-length là /32. - Để thay đổi điều này, các bạn vào Loopback và lệnh sau [TABLE="class: outer_border, width: 600"] [TR] [TD]//Router 1 R1(config)#interface loopback 1 R1(config-if)#ip ospf network point-to-point //Router 2 R2(config)#interface loopback 2 R2(config-if)#ip ospf network point-to-point //Router 3 R3(config)#interface loopback 3 R3(config-if)#ip ospf network point-to-point[/TD] [/TR] [/TABLE] - Kiểm tra lại bảng định tuyến Mã: R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 5 subnets [COLOR=#ff0000]O 10.1.3.0 [110/11] via 10.1.200.3, 00:01:09, FastEthernet0/0[/COLOR] [COLOR=#ff0000]O 10.1.2.0 [110/11] via 10.1.200.2, 00:01:52, FastEthernet0/0[/COLOR] C 10.1.1.0 is directly connected, Loopback1 C 10.1.100.0 is directly connected, Serial1/0 C 10.1.200.0 is directly connected, FastEthernet0/0 Bài viết liên quan [Lab 1] - LACP với Switch: Cấu hình LACP để tăng băng thông và đảm bảo dự phòng. bởi Lê Triệu Phú, 12/11/2025 [A-III-4] [Lý thuyết + lab] Tìm hiểu và cấu hình giao thức định tuyến động OSPF bởi Đăng Duy, 04/09/2025 [A-III-3] [Lý thuyết + lab] Tìm hiểu và cấu hình giao thức dự phòng gateway (VRRP) bởi Đăng Duy, 03/09/2025 [A-III-2] [Lý thuyết + lab] Tìm hiểu và cấu hình định tuyến tĩnh, VLAN routing (static route) bởi Đăng Duy, 29/08/2025 [A-III-1] [Lý thuyết + lab] Tìm hiểu và cấu hình IPv4 address, hoạt động của router bởi Đăng Duy, 29/08/2025 [A-II-3] [Lab] Cấu hình giao thức dự phòng kết nối (LACP) bởi Đăng Duy, 28/08/2025 Bài viết mới [Lab 1] - LACP với Switch: Cấu hình LACP để tăng băng thông và đảm bảo dự phòng. bởi Lê Triệu Phú, 12/11/2025 [A-III-4] [Lý thuyết + lab] Tìm hiểu và cấu hình giao thức định tuyến động OSPF bởi Đăng Duy, 04/09/2025 [A-III-3] [Lý thuyết + lab] Tìm hiểu và cấu hình giao thức dự phòng gateway (VRRP) bởi Đăng Duy, 03/09/2025 [A-III-2] [Lý thuyết + lab] Tìm hiểu và cấu hình định tuyến tĩnh, VLAN routing (static route) bởi Đăng Duy, 29/08/2025 [A-III-1] [Lý thuyết + lab] Tìm hiểu và cấu hình IPv4 address, hoạt động của router bởi Đăng Duy, 29/08/2025 [A-II-3] [Lab] Cấu hình giao thức dự phòng kết nối (LACP) bởi Đăng Duy, 28/08/2025
root
Moderator
4. Hiệu chính COST trong OSPF - Một vài giá trị COST trên các interface [TABLE="class: grid, width: 600"] [TR] [TD]Serial Link[/TD] [TD]56 Kbps[/TD] [TD]1785[/TD] [/TR] [TR] [TD]Serial Link[/TD] [TD]64 Kbps[/TD] [TD]1562[/TD] [/TR] [TR] [TD]T1[/TD] [TD]1.544 Mbps[/TD] [TD]64[/TD] [/TR] [TR] [TD]E1[/TD] [TD]2048 Mbps[/TD] [TD]48[/TD] [/TR] [TR] [TD]Token Ring[/TD] [TD]4 Mbps[/TD] [TD]25[/TD] [/TR] [TR] [TD]Ethernet[/TD] [TD][/TD] [TD]10[/TD] [/TR] [TR] [TD]Token Ring[/TD] [TD]16 Mbps[/TD] [TD]6[/TD] [/TR] [TR] [TD]FDDI[/TD] [TD][/TD] [TD]1[/TD] [/TR] [TR] [TD]X25[/TD] [TD][/TD] [TD]5208[/TD] [/TR] [TR] [TD]Asynchronous[/TD] [TD][/TD] [TD]10.000[/TD] [/TR] [TR] [TD]ATM[/TD] [TD][/TD] [TD]1[/TD] [/TR] [/TABLE] - Để hiệu chỉnh COST trong OSPF các bạn vào interface và điều chỉnh COST như sau [TABLE="class: outer_border, width: 500"] [TR] [TD]R1(config)#interface f0/0 R1(config-if)#ip ospf cost 50[/TD] [/TR] [/TABLE] - Kiểm tra lại kết quả Mã: R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is not set 10.0.0.0/24 is subnetted, 5 subnets [COLOR=#ff0000]O 10.1.3.0 [110/51][/COLOR] via 10.1.200.3, 00:04:16, FastEthernet0/0 [COLOR=#ff0000]O 10.1.2.0 [110/51] [/COLOR]via 10.1.200.2, 00:04:16, FastEthernet0/0 C 10.1.1.0 is directly connected, Loopback1 C 10.1.100.0 is directly connected, Serial1/0 C 10.1.200.0 is directly connected, FastEthernet0/0 5. Chỉnh Interface Priority - Các thông số trong bầu chọn DR và BDR gồm: - Priority
Giá trị Priority cao nhất sẽ làm DR
Cao thứ 2 làm BDR
còn lại sẽ làm DROTHER
- Router ID: Nếu các Priority bằng nhau hết thì tới Router ID
Router ID cao nhất làm DR
- Chúng ta sẽ hiệu chỉnh Priority để
R1 làm DR
R2 làm BDR
R3 làm DROTHER
[TABLE="class: outer_border, width: 500"] [TR] [TD]//Router 1 R1(config)#interface f0/0 R1(config-if)#ip ospf priority 10 //Router 2 R2(config)#interface f0/0 R2(config-if)#ip ospf priority 5[/TD] [/TR] [/TABLE]- Để việc thay đổi priority áp phê bạn cần thêm câu lệnh sau [TABLE="class: outer_border, width: 500"] [TR] [TD]R1#clear ip ospf process[/TD] [/TR] [/TABLE] - Kiểm tra lại ta thấy
R1 đã làm DR
R2 làm BDR
R3 làm DROTHER
Mã: R1#sh ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.1.2.1 5 FULL/[COLOR=#ff0000]BDR [/COLOR]00:00:31 10.1.200.2 FastEthernet0/0 10.1.3.1 1 FULL/[COLOR=#ff0000]DROTHER [/COLOR]00:00:31 10.1.200.3 FastEthernet0/0 10.1.2.1 0 FULL/ - 00:00:32 10.1.100.2 Serial1/0 - chi tiết hơn Mã: R1#[B]sh ip ospf neighbor detail[/B] 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 [COLOR=#ff0000] DR is 10.1.200.1 BDR is 10.1.200.2[/COLOR] Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:33 Neighbor is up for 00:00:52 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, 6 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:33 Neighbor is up for 00:23:01 Index 2/2, 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.2.1, interface address 10.1.100.2 In the area 0 via interface Serial1/0 Neighbor priority is 0, State is FULL, 12 state changes DR is 0.0.0.0 BDR is 0.0.0.0 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:39 Neighbor is up for 00:00:57 Index 1/1, retransmission queue length 0, number of retransmission 2 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 2, maximum is 2 Last retransmission scan time is 0 msec, maximum is 0 msec Bạn phải đăng nhập hoặc đăng ký để bình luận. Chia sẻ:FacebookX (Twitter)LinkedInRedditPinterestTumblrWhatsAppEmailChia sẻLink
Diễn đàn
NETWORK SOLUTIONS
Switching & Routing
Cisco
Lab
Trang web này sử dụng cookie. Tiếp tục sử dụng trang web này đồng nghĩa với việc bạn đồng ý sử dụng cookie của chúng tôi. AcceptTìm hiểu thêm.…