Lab 2 – OSPF ĐA VÙNG
Sơ đồ
Hình 1 – Sơ đồ bài Lab
Bảng phân hoạch địa chỉ IP
Mô tả:
+ Multilayer Switch: vios_12-ADCENTERPRISEK9-M, Version 15.2(CML_NIGHTLY_20180619)FLO_DSGS7
Yêu cầu:
Bước 1: Thiết lập sơ đồ và cấu hình địa chỉ IP cho các thiết bị.
Học viên thực hiện đấu nối các thiết bị và đặt địa chỉ IP theo sơ đồi mạng trên Hình 1.
Cấu hình:
R1
hostname R1
interface g0/0/0
ip add 172.16.0.2 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 10.10.0.1 255.255.255.252
no shut
exit
R2
hostname R2
interface g0/0/0
ip add 172.16.0.1 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 172.16.1.1 255.255.255.252
no shut
exit
interface lo0
ip add 209.165.200.225 255.255.255.224
exit
R3
hostname R3
interface g0/0/0
ip add 172.16.1.2 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 10.10.4.1 255.255.255.252
no shut
exit
D1
hostname D1
interface g1/0/5
no switchport
ip address 10.10.0.2 255.255.255.252
no shut
exit
interface g1/0/23
no switchport
ip address 10.10.1.1 255.255.255.0
no shut
exit
D2
hostname D2
interface g1/0/11
no switchport
ip address 10.10.4.2 255.255.255.252
no shut
exit
interface g1/0/23
no switchport
ip address 10.10.5.1 255.255.255.0
no shut
exit
Kiểm tra:
R1# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.0.2 YES manual up up
GigabitEthernet0/0/1 10.10.0.1 YES manual up up
R2# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.0.1 YES manual up up
GigabitEthernet0/0/1 172.16.1.1 YES manual up up
Loopback0 209.165.200.225 YES manual up up
R3# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.1.2 YES manual up up
GigabitEthernet0/0/1 10.10.4.1 YES manual up up
D1# show ip interface brief | include manual
GigabitEthernet1/0/5 10.10.0.2 YES manual up up
GigabitEthernet1/0/23 10.10.1.1 YES manual up up
D2# show ip interface brief | include manual
GigabitEthernet1/0/11 10.10.4.2 YES manual up up
GigabitEthernet1/0/23 10.10.5.1 YES manual up up
Từ R1 thực hiện Ping kiểm tra kết nối đến D1 và R2 với địa chỉ IP lần lượt là 10.10.0.2 172.16.0.1
R1# ping 10.10.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.0.2, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 2/2/2 ms
R1# ping 172.16.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
Bước 2: Cấu hình Multi-Area OSPFv2
Cấu hình OSPF trên D1 bằng wildcard masks
D1(config)# ip routing
D1(config)# router ospf 123
D1(config-router)# router-id 1.1.1.2
D1(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
D1(config-router)# network 10.10.0.0 0.0.0.3 area 1
D1(config-router)# network 10.10.1.0 0.0.0.255 area 1
D1(config-router)# end
Lưu ý: Việc thiết lập giá trị cost tham chiếu quá cao có thể gây ra một số vấn đề khi mà interface có băng thông thấp.
Kiểm tra:
D1# show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 1.1.1.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.0.0 0.0.0.3 area 1
10.10.1.0 0.0.0.255 area 1
Routing Information Sources:
Gateway Distance Last Update
1.1.1.2 110 00:02:19
Distance: (default is 110)
D1# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi1/0/23 123 1 10.10.1.1/24 10 DR 0/0
Gi1/0/5 123 1 10.10.0.2/30 10 DR 0/0
Cấu hình OSPF trên R1
R1 là ABR với một interface trong Area 1 và interface khác nằm trong backbone
R1(config)# router ospf 123
R1(config-router)# router-id 1.1.1.1
R1(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
R1(config-router)# network 172.16.0.0 0.0.0.3 area 0
R1(config-router)# network 10.10.0.0 0.0.0.3 area 1
R1(config-router)# end
*Jan 4 11:55:32.064: %OSPF-5-ADJCHG: Process 123, Nbr 1.1.1.2 on GigabitEthernet0/0/1 from LOADING to FULL, Loading Done
Kiểm tra:
Kiểm tra cấu hình OSPF trên R1 với câu lệnh show ip protocols
R1# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 1.1.1.1
It is an area border router
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.0.0 0.0.0.3 area 1
172.16.0.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:07:55
1.1.1.2 110 00:07:55
Distance: (default is 110)
Kiểm tra bandwidth tham chiếu với câu lệnh show ip ospf | begin Ref
R1# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0) (Inactive)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:14:41.606 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 3. Checksum Sum 0x01ABED
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
Area 1
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:15:07.141 ago
SPF algorithm executed 5 times
Area ranges are
Number of LSA 4. Checksum Sum 0x0292B8
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
Kiểm tra các interface đang chạy OSPF và các area được gán bằng câu lệnh show ip ospf interface brief
R1# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/0 123 0 172.16.0.2/30 1 DR 0/0
Gi0/0/1 123 1 10.10.0.1/30 1 BDR 1/1
Kiểm tra neighbor OSPF của R1 thiết lập adjacency với router khác bằng câu lệnh show ip ospf neighbor [detail]
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.2 1 FULL/DR 00:00:31 10.10.0.2 GigabitEthernet0/0/1
R1# show ip ospf neighbor detail
Neighbor 1.1.1.2, interface address 10.10.0.2, interface-id 38
In the area 1 via interface GigabitEthernet0/0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 10.10.0.2 BDR is 10.10.0.1
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:34
Neighbor is up for 00:19:09
Kiểm tra các route OSPF trong bảng định tuyến bằng câu lệnh show ip route ospf
R1# show ip route ospf | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O 10.10.1.0/24 [110/11] via 10.10.0.2, 00:24:43, GigabitEthernet0/0/1
Cuối cùng kiểm tra thông tin chi tiết cách R1 đã học entry OSPF bằng câu lệnh show ip route OSPF 10.10.1.0
R1# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 11, type intra area
Last update from 10.10.0.2 on GigabitEthernet0/0/1, 00:25:25 ago
Routing Descriptor Blocks:
* 10.10.0.2, from 1.1.1.2, 00:25:25 ago, via GigabitEthernet0/0/1
Route metric is 11, traffic share count is 1
Cấu hình OSPF trên R2
R2(config)# router ospf 123
R2(config-router)# router-id 2.2.2.1
R2(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
R2(config-router)# network 172.16.0.0 0.0.0.3 area 0
R2(config-router)# network 172.16.1.0 0.0.0.3 area 0
*Dec 28 16:22:42.530: %OSPF-5-ADJCHG: Process 123, Nbr 1.1.1.1 on GigabitEthernet0/0/0 from LOADING to FULL, Loading Done
R2(config-router)# default-information originate
R2(config-router)# exit
R2(config)# ip route 0.0.0.0 0.0.0.0 lo0
%Default route without gateway, if not a point-to-point interface, may impact performance
R2(config)# exit
Kiểm tra:
Kiểm tra cấu hình OSPF trên R2 với câu lệnh show ip protocols
R2# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 2.2.2.1
It is an autonomous system boundary router
Redistributing External Routes from,
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
172.16.0.0 0.0.0.3 area 0
172.16.1.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:24:29
2.2.2.1 110 00:24:29
Distance: (default is 110)
Kiểm tra bandwidth tham chiếu đã được thay đổi với câu lệnh show ip ospf | begin Ref
R2# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm last executed 00:02:27.531 ago
SPF algorithm executed 5 times
Area ranges are
Number of LSA 5. Checksum Sum 0x01C25B
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
Kiểm tra các interface đang chạy OSPF và các area được gán bằng câu lệnh show ip ospf interface brief
R2# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/1 123 0 172.16.1.1/30 1 DR 0/0
Gi0/0/0 123 0 172.16.0.1/30 1 BDR 1/1
Kiểm tra neighbor OSPF của R2 thiết lập adjacency với router khác bằng câu lệnh show ip ospf neighbor [detail]
R2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:36 172.16.0.2 GigabitEthernet0/0/0
R2# show ip ospf neigh detail
Neighbor 1.1.1.1, interface address 172.16.0.2, interface-id 5
In the area 0 via interface GigabitEthernet0/0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 172.16.0.2 BDR is 172.16.0.1
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:34
Neighbor is up for 00:27:48
Kiểm tra các route OSPF trong bảng định tuyến với câu lệnh show ip route ospf
R2# show ip route ospf | begin Gateway
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 10.10.0.0/30 [110/2] via 172.16.0.2, 00:28:19, GigabitEthernet0/0/0
O IA 10.10.1.0/24 [110/12] via 172.16.0.2, 00:28:19, GigabitEthernet0/0/0
R2# show ip route static | begin Gateway
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
S* 0.0.0.0/0 is directly connected, Loopback0
Kiểm tra thông tin chi tiết cách R1 đã học entry OSPF bằng câu lệnh show ip route OSPF 10.10.1.0
R2# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 12, type inter area
Last update from 172.16.0.2 on GigabitEthernet0/0/0, 00:31:08 ago
Routing Descriptor Blocks:
* 172.16.0.2, from 1.1.1.1, 00:31:08 ago, via GigabitEthernet0/0/0
Route metric is 12, traffic share count is 1
Cấu hình OSPF trên R3
R3(config)# router ospf 123
R3(config-router)# router-id 3.3.3.1
R3(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
R3(config-router)# network 172.16.1.0 0.0.0.3 area 0
R3(config-router)# network 10.10.4.0 0.0.0.3 area 2
R3(config-router)# end
R3#
*Jan 5 19:28:25.146: %OSPF-5-ADJCHG: Process 123, Nbr 2.2.2.1 on GigabitEthernet0/0/0 from LOADING to FULL, Loading Done
Kiểm tra:
R3# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 3.3.3.1
It is an area border router
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.4.0 0.0.0.3 area 2
172.16.1.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:01:43
2.2.2.1 110 00:01:43
Distance: (default is 110)
R3# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:10:38.256 ago
SPF algorithm executed 4 times
Area ranges are
Number of LSA 8. Checksum Sum 0x0396BA
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
Area 2
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:10:13.755 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 6. Checksum Sum 0x0362CF
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
R3# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/0 123 0 172.16.1.2/30 1 BDR 1/1
Gi0/0/1 123 2 10.10.4.1/30 1 DR 0/0
R3# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.1 1 FULL/DR 00:00:31 172.16.1.1 GigabitEthernet0/0/0
R3# show ip ospf neighbor detail
Neighbor 2.2.2.1, interface address 172.16.1.1, interface-id 6
In the area 0 via interface GigabitEthernet0/0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 172.16.1.1 BDR is 172.16.1.2
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:37
Neighbor is up for 00:21:50
Index 1/1/1, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0)/0x0(0) Next 0x0(0)/0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
R3# show ip route ospf | begin Gateway
Gateway of last resort is 172.16.1.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O IA 10.10.0.0/30 [110/3] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
O IA 10.10.1.0/24 [110/13] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O 172.16.0.0/30 [110/2] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
R3# show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "ospf 123", distance 110, metric 1, candidate default path
Tag 123, type extern 2, forward metric 1
Last update from 172.16.1.1 on GigabitEthernet0/0/0, 00:28:41 ago
Routing Descriptor Blocks:
* 172.16.1.1, from 2.2.2.1, 00:28:41 ago, via GigabitEthernet0/0/0
Route metric is 1, traffic share count is 1
Route tag 123
R3# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 13, type inter area
Last update from 172.16.1.1 on GigabitEthernet0/0/0, 00:29:10 ago
Routing Descriptor Blocks:
* 172.16.1.1, from 1.1.1.1, 00:29:10 ago, via GigabitEthernet0/0/0
Route metric is 13, traffic share count is 1
Cấu hình OSPF trên D2
D2(config)# ip routing
D2(config)# router ospf 123
D2(config-router)# router-id 3.3.3.2
D2(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
D2(config-router)# network 10.10.4.0 0.0.0.3 area 2
D2(config-router)# network 10.10.5.0 0.0.0.255 area 2
D2(config-router)# end
D2#
*Mar 1 01:52:03.888: %OSPF-5-ADJCHG: Process 123, Nbr 3.3.3.1 on GigabitEthernet1/0/11 from LOADING to FULL, Loading Done
Kiểm tra
D2# show ip protocols
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 3.3.3.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.4.0 0.0.0.3 area 2
10.10.5.0 0.0.0.255 area 2
Routing Information Sources:
Gateway Distance Last Update
3.3.3.1 110 00:09:35
2.2.2.1 110 00:04:38
Distance: (default is 110)
D2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.1 1 FULL/BDR 00:00:33 10.10.4.1 GigabitEthernet1/0/11
D2# show ip route ospf | begin Gateway
Gateway of last resort is 10.10.4.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.10.4.1, 00:09:25, Gigabitthernet1/0/11
10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
O IA 10.10.0.0/30 [110/4] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
O IA 10.10.1.0/24 [110/14] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
172.16.0.0/30 is subnetted, 2 subnets
O IA 172.16.0.0 [110/3] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
O IA 172.16.1.0 [110/2] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
D2# show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "ospf 123", distance 110, metric 1, candidate default path
Tag 123, type extern 2, forward metric 2
Last update from 10.10.4.1 on GigabitEthernet1/0/11, 00:18:31 ago
Routing Descriptor Blocks:
* 10.10.4.1, from 2.2.2.1, 00:18:31 ago, via GigabitEthernet1/0/11
Route metric is 1, traffic share count is 1
Route tag 123
Kiểm tra kết nối end-to-end
Từ PC1, kiểm tra kết nối bằng cách ping và traceroute đến PC3.
PC> ping 10.10.5.10
Pinging 10.10.5.10 with 32 bytes of data:
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Ping statistics for 10.10.5.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC> tracert 10.10.5.10
Tracing route to DESKTOP-3FR7RKA [10.10.5.10]
over a maximum of 30 hops:
1 1 ms 1 ms 1 ms 10.10.1.1
2 <1 ms <1 ms <1 ms 10.10.0.1
3 1 ms <1 ms <1 ms 172.16.0.1
4 1 ms 1 ms <1 ms 172.16.1.2
5 1 ms 2 ms 2 ms 10.10.4.2
6 1 ms <1 ms <1 ms DESKTOP-3RF7RKA [10.10.5.10]
Trace complete.
Bước 3: Tìm hiểu các LSA (Link-State Advertisemens)
Trong phần này, các học viên sẽ kiểm tra rằng mạng đã hội tụ và tìm hiểu làm thế nào các link-state advertisemens (LSAs) được sử dụng để xây dựng nên bảng link-state database (LSDB).
Router OSPF tạo ra LSAs cho mọi interface chạy OSPF được kết nối trực tiếp. Sau đó, nó gửi các LSA đến các router OSPF adjacencies. LSA là các bản ghi cơ sở dữ liệu cung cấp thông tin chi tiết về mạng cụ thể chạy OSPF. Chính vì điều này, chúng mô tả toàn bộ topology của một area OSPF.
Router OSPF sẽ sử dụng 6 LSA Type cho định tuyến IPv4:
Trên D1, hiển thị danh sách các neighbor với câu lệnh show ip ospf neighbors
D1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:32 10.10.0.1 GigabitEthernet1/0/11
Kiểm tra bảng định tuyến với câu lệnh show ip router ospf | begin Gateway
D1# show ip route ospf | begin Gateway
Gateway of last resort is 10.10.0.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.10.0.1, 01:15:48, GigabitEthernet1/0/11
10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
O IA 10.10.4.0/30 [110/4] via 10.10.0.1, 00:52:50, GigabitEthernet1/0/11
O IA 10.10.5.0/24 [110/14] via 10.10.0.1, 00:24:49, GigabitEthernet1/0/11
172.16.0.0/30 is subnetted, 2 subnets
O IA 172.16.0.0 [110/2] via 10.10.0.1, 02:05:06, GigabitEthernet1/0/11
O IA 172.16.1.0 [110/3] via 10.10.0.1, 01:18:11, GigabitEthernet1/0/11
D1 học được các mạng từ các LSA. Router duy trì LSDB trong mỗi area mà có interface của nó tham gia vào OSPF. Vì D1 là một router OSPF nội vùng nên nó chỉ có các entries của Area 1. Để hiện thị nội dung của LSDB D1, các học viên sử dụng câu lệnh show ip ospf database
D1# show ip ospf database
OSPF Router with ID (1.1.1.2) (Process ID 123)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1806 0x80000005 0x00DC15 1
1.1.1.2 1.1.1.2 167 0x80000005 0x001AA6 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.10.0.2 1.1.1.2 167 0x80000003 0x00B462
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.10.4.0 1.1.1.1 1806 0x80000002 0x00A86E
10.10.5.0 1.1.1.1 1807 0x80000002 0x0014F4
172.16.0.0 1.1.1.1 1807 0x80000002 0x00DBA1
172.16.1.0 1.1.1.1 1807 0x80000002 0x00DAA0
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.1 1.1.1.1 1807 0x80000002 0x00131C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 2.2.2.1 1939 0x80000002 0x009F90 123
Để xem chi tiết thông tin LSA Type 1 dùng câu lệnh
D1# show ip ospf database router
OSPF Router with ID (1.1.1.2) (Process ID 123)
Router Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 843
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000007
Checksum: 0xD817
Length: 36
Area Border Router
Number of Links: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.10.0.2
(Link Data) Router Interface address: 10.10.0.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 1196
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.2
Advertising Router: 1.1.1.2
LS Seq Number: 80000006
Checksum: 0x18A7
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.10.0.2
(Link Data) Router Interface address: 10.10.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.10.1.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 10
Để tìm hiểu thêm về LSA Type 2 dùng câu lệnh
D1# show ip ospf database network
OSPF Router with ID (1.1.1.2) (Process ID 123)
Net Link States (Area 1)
LS age: 845
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 10.10.0.2 (address of Designated Router)
Advertising Router: 1.1.1.2
LS Seq Number: 80000005
Checksum: 0xB064
Length: 32
Network Mask: /30
Attached Router: 1.1.1.2
Attached Router: 1.1.1.1
Thông tin về LSA Type 3
D1# show ip ospf database summary
OSPF Router with ID (1.1.1.2) (Process ID 123)
Summary Net Link States (Area 1)
LS age: 987
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.4.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xA271
Length: 28
Network Mask: /30
MTID: 0 Metric: 3
LS age: 987
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.5.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xEF7
Length: 28
Network Mask: /24
MTID: 0 Metric: 13
LS age: 988
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 172.16.0.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xD5A4
Length: 28
Network Mask: /30
MTID: 0 Metric: 1
LS age: 989
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 172.16.1.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xD4A3
Length: 28
Network Mask: /30
MTID: 0 Metric: 2
Thông tin về LSA Type 4
D1# show ip ospf database asbr-summary
OSPF Router with ID (1.1.1.2) (Process ID 123)
Summary ASB Link States (Area 1)
LS age: 591
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 2.2.2.1 (AS Boundary Router address)
Advertising Router: 1.1.1.1
LS Seq Number: 80000006
Checksum: 0xB20
Length: 28
Network Mask: /0
MTID: 0 Metric: 1
Thông tin về LSA Type 5
D1# show ip ospf database external
OSPF Router with ID (1.1.1.2) (Process ID 123)
Type-5 AS External Link States
LS age: 1024
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number )
Advertising Router: 2.2.2.1
LS Seq Number: 80000006
Checksum: 0x9794
Length: 36
Network Mask: /0
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 123
Kiểm tra thông tin các LSA trên R1 và R2 với câu lệnh tương tự:
show ip ospf database
show ip ospf database router
show ip ospf database network
show ip ospf database summary
show ip ospf database asbr-summary
show ip ospf database external
Close configuration window
Sơ đồ
Hình 1 – Sơ đồ bài Lab
Bảng phân hoạch địa chỉ IP
| Device | Interface | IPv4 Address |
| R1 | G0/0/0 | 172.16.0.2/30 |
| R1 | G0/0/1 | 10.10.0.1/30 |
| R2 | Lo0 | 209.165.200.225/27 |
| R2 | G0/0/0 | 172.16.0.1/30 |
| R2 | G0/0/1 | 172.16.1.1/30 |
| R3 | G0/0/0 | 172.16.1.2/30 |
| R3 | G0/0/1 | 10.10.4.1/30 |
| D1 | G1/0/5 | 10.10.0.2/30 |
| D1 | G1/0/23 | 10.10.1.1/24 |
| D2 | G1/0/11 | 10.10.4.2/30 |
| D2 | G1/0/23 | 10.10.5.1/24 |
| PC1 | NIC | 10.10.1.10/24 |
| PC2 | NIC | 10.10.5.10/24 |
- Bài lab được dựng trên EVE gồm 3 Router và 2 Multilayer Switch được đấu nối với nhau và đặt địa chỉ IP như được chỉ ra trên hình 1.
- File IOL sử dụng:
+ Multilayer Switch: vios_12-ADCENTERPRISEK9-M, Version 15.2(CML_NIGHTLY_20180619)FLO_DSGS7
Yêu cầu:
- Thực hiện thiết lập sơ đồ và cấu hình địa chỉ IP trên các thiết bị như được chỉ ra trên Hình 1.
- Cấu hình và kiểm tra Multi-Area OSPFv2 trên R1, D1 và D2
- Tìm hiểu về các bản tin LSA (Link-State Advertisemens)
Bước 1: Thiết lập sơ đồ và cấu hình địa chỉ IP cho các thiết bị.
Học viên thực hiện đấu nối các thiết bị và đặt địa chỉ IP theo sơ đồi mạng trên Hình 1.
Cấu hình:
R1
hostname R1
interface g0/0/0
ip add 172.16.0.2 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 10.10.0.1 255.255.255.252
no shut
exit
R2
hostname R2
interface g0/0/0
ip add 172.16.0.1 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 172.16.1.1 255.255.255.252
no shut
exit
interface lo0
ip add 209.165.200.225 255.255.255.224
exit
R3
hostname R3
interface g0/0/0
ip add 172.16.1.2 255.255.255.252
no shut
exit
interface GigabitEthernet0/0/1
ip address 10.10.4.1 255.255.255.252
no shut
exit
D1
hostname D1
interface g1/0/5
no switchport
ip address 10.10.0.2 255.255.255.252
no shut
exit
interface g1/0/23
no switchport
ip address 10.10.1.1 255.255.255.0
no shut
exit
D2
hostname D2
interface g1/0/11
no switchport
ip address 10.10.4.2 255.255.255.252
no shut
exit
interface g1/0/23
no switchport
ip address 10.10.5.1 255.255.255.0
no shut
exit
Kiểm tra:
R1# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.0.2 YES manual up up
GigabitEthernet0/0/1 10.10.0.1 YES manual up up
R2# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.0.1 YES manual up up
GigabitEthernet0/0/1 172.16.1.1 YES manual up up
Loopback0 209.165.200.225 YES manual up up
R3# show ip interface brief | include manual
GigabitEthernet0/0/0 172.16.1.2 YES manual up up
GigabitEthernet0/0/1 10.10.4.1 YES manual up up
D1# show ip interface brief | include manual
GigabitEthernet1/0/5 10.10.0.2 YES manual up up
GigabitEthernet1/0/23 10.10.1.1 YES manual up up
D2# show ip interface brief | include manual
GigabitEthernet1/0/11 10.10.4.2 YES manual up up
GigabitEthernet1/0/23 10.10.5.1 YES manual up up
Từ R1 thực hiện Ping kiểm tra kết nối đến D1 và R2 với địa chỉ IP lần lượt là 10.10.0.2 172.16.0.1
R1# ping 10.10.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.0.2, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 2/2/2 ms
R1# ping 172.16.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
Bước 2: Cấu hình Multi-Area OSPFv2
Cấu hình OSPF trên D1 bằng wildcard masks
D1(config)# ip routing
D1(config)# router ospf 123
D1(config-router)# router-id 1.1.1.2
D1(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
D1(config-router)# network 10.10.0.0 0.0.0.3 area 1
D1(config-router)# network 10.10.1.0 0.0.0.255 area 1
D1(config-router)# end
Lưu ý: Việc thiết lập giá trị cost tham chiếu quá cao có thể gây ra một số vấn đề khi mà interface có băng thông thấp.
Kiểm tra:
D1# show ip protocols
*** IP Routing is NSF aware ***
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 1.1.1.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.0.0 0.0.0.3 area 1
10.10.1.0 0.0.0.255 area 1
Routing Information Sources:
Gateway Distance Last Update
1.1.1.2 110 00:02:19
Distance: (default is 110)
D1# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi1/0/23 123 1 10.10.1.1/24 10 DR 0/0
Gi1/0/5 123 1 10.10.0.2/30 10 DR 0/0
Cấu hình OSPF trên R1
R1 là ABR với một interface trong Area 1 và interface khác nằm trong backbone
R1(config)# router ospf 123
R1(config-router)# router-id 1.1.1.1
R1(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
R1(config-router)# network 172.16.0.0 0.0.0.3 area 0
R1(config-router)# network 10.10.0.0 0.0.0.3 area 1
R1(config-router)# end
*Jan 4 11:55:32.064: %OSPF-5-ADJCHG: Process 123, Nbr 1.1.1.2 on GigabitEthernet0/0/1 from LOADING to FULL, Loading Done
Kiểm tra:
Kiểm tra cấu hình OSPF trên R1 với câu lệnh show ip protocols
R1# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 1.1.1.1
It is an area border router
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.0.0 0.0.0.3 area 1
172.16.0.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:07:55
1.1.1.2 110 00:07:55
Distance: (default is 110)
Kiểm tra bandwidth tham chiếu với câu lệnh show ip ospf | begin Ref
R1# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0) (Inactive)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:14:41.606 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 3. Checksum Sum 0x01ABED
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
Area 1
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:15:07.141 ago
SPF algorithm executed 5 times
Area ranges are
Number of LSA 4. Checksum Sum 0x0292B8
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
Kiểm tra các interface đang chạy OSPF và các area được gán bằng câu lệnh show ip ospf interface brief
R1# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/0 123 0 172.16.0.2/30 1 DR 0/0
Gi0/0/1 123 1 10.10.0.1/30 1 BDR 1/1
Kiểm tra neighbor OSPF của R1 thiết lập adjacency với router khác bằng câu lệnh show ip ospf neighbor [detail]
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.2 1 FULL/DR 00:00:31 10.10.0.2 GigabitEthernet0/0/1
R1# show ip ospf neighbor detail
Neighbor 1.1.1.2, interface address 10.10.0.2, interface-id 38
In the area 1 via interface GigabitEthernet0/0/1
Neighbor priority is 1, State is FULL, 6 state changes
DR is 10.10.0.2 BDR is 10.10.0.1
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:34
Neighbor is up for 00:19:09
Kiểm tra các route OSPF trong bảng định tuyến bằng câu lệnh show ip route ospf
R1# show ip route ospf | begin Gateway
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O 10.10.1.0/24 [110/11] via 10.10.0.2, 00:24:43, GigabitEthernet0/0/1
Cuối cùng kiểm tra thông tin chi tiết cách R1 đã học entry OSPF bằng câu lệnh show ip route OSPF 10.10.1.0
R1# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 11, type intra area
Last update from 10.10.0.2 on GigabitEthernet0/0/1, 00:25:25 ago
Routing Descriptor Blocks:
* 10.10.0.2, from 1.1.1.2, 00:25:25 ago, via GigabitEthernet0/0/1
Route metric is 11, traffic share count is 1
Cấu hình OSPF trên R2
R2(config)# router ospf 123
R2(config-router)# router-id 2.2.2.1
R2(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
R2(config-router)# network 172.16.0.0 0.0.0.3 area 0
R2(config-router)# network 172.16.1.0 0.0.0.3 area 0
*Dec 28 16:22:42.530: %OSPF-5-ADJCHG: Process 123, Nbr 1.1.1.1 on GigabitEthernet0/0/0 from LOADING to FULL, Loading Done
R2(config-router)# default-information originate
R2(config-router)# exit
R2(config)# ip route 0.0.0.0 0.0.0.0 lo0
%Default route without gateway, if not a point-to-point interface, may impact performance
R2(config)# exit
Kiểm tra:
Kiểm tra cấu hình OSPF trên R2 với câu lệnh show ip protocols
R2# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 2.2.2.1
It is an autonomous system boundary router
Redistributing External Routes from,
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
172.16.0.0 0.0.0.3 area 0
172.16.1.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:24:29
2.2.2.1 110 00:24:29
Distance: (default is 110)
Kiểm tra bandwidth tham chiếu đã được thay đổi với câu lệnh show ip ospf | begin Ref
R2# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0)
Number of interfaces in this area is 2
Area has no authentication
SPF algorithm last executed 00:02:27.531 ago
SPF algorithm executed 5 times
Area ranges are
Number of LSA 5. Checksum Sum 0x01C25B
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
Kiểm tra các interface đang chạy OSPF và các area được gán bằng câu lệnh show ip ospf interface brief
R2# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/1 123 0 172.16.1.1/30 1 DR 0/0
Gi0/0/0 123 0 172.16.0.1/30 1 BDR 1/1
Kiểm tra neighbor OSPF của R2 thiết lập adjacency với router khác bằng câu lệnh show ip ospf neighbor [detail]
R2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:36 172.16.0.2 GigabitEthernet0/0/0
R2# show ip ospf neigh detail
Neighbor 1.1.1.1, interface address 172.16.0.2, interface-id 5
In the area 0 via interface GigabitEthernet0/0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 172.16.0.2 BDR is 172.16.0.1
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:34
Neighbor is up for 00:27:48
Kiểm tra các route OSPF trong bảng định tuyến với câu lệnh show ip route ospf
R2# show ip route ospf | begin Gateway
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
O IA 10.10.0.0/30 [110/2] via 172.16.0.2, 00:28:19, GigabitEthernet0/0/0
O IA 10.10.1.0/24 [110/12] via 172.16.0.2, 00:28:19, GigabitEthernet0/0/0
R2# show ip route static | begin Gateway
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
S* 0.0.0.0/0 is directly connected, Loopback0
Kiểm tra thông tin chi tiết cách R1 đã học entry OSPF bằng câu lệnh show ip route OSPF 10.10.1.0
R2# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 12, type inter area
Last update from 172.16.0.2 on GigabitEthernet0/0/0, 00:31:08 ago
Routing Descriptor Blocks:
* 172.16.0.2, from 1.1.1.1, 00:31:08 ago, via GigabitEthernet0/0/0
Route metric is 12, traffic share count is 1
Cấu hình OSPF trên R3
R3(config)# router ospf 123
R3(config-router)# router-id 3.3.3.1
R3(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
R3(config-router)# network 172.16.1.0 0.0.0.3 area 0
R3(config-router)# network 10.10.4.0 0.0.0.3 area 2
R3(config-router)# end
R3#
*Jan 5 19:28:25.146: %OSPF-5-ADJCHG: Process 123, Nbr 2.2.2.1 on GigabitEthernet0/0/0 from LOADING to FULL, Loading Done
Kiểm tra:
R3# show ip protocols | begin ospf
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 3.3.3.1
It is an area border router
Number of areas in this router is 2. 2 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.4.0 0.0.0.3 area 2
172.16.1.0 0.0.0.3 area 0
Routing Information Sources:
Gateway Distance Last Update
1.1.1.1 110 00:01:43
2.2.2.1 110 00:01:43
Distance: (default is 110)
R3# show ip ospf | begin Ref
Reference bandwidth unit is 1000 mbps
Area BACKBONE(0)
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:10:38.256 ago
SPF algorithm executed 4 times
Area ranges are
Number of LSA 8. Checksum Sum 0x0396BA
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
Area 2
Number of interfaces in this area is 1
Area has no authentication
SPF algorithm last executed 00:10:13.755 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 6. Checksum Sum 0x0362CF
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
R3# show ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Gi0/0/0 123 0 172.16.1.2/30 1 BDR 1/1
Gi0/0/1 123 2 10.10.4.1/30 1 DR 0/0
R3# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.1 1 FULL/DR 00:00:31 172.16.1.1 GigabitEthernet0/0/0
R3# show ip ospf neighbor detail
Neighbor 2.2.2.1, interface address 172.16.1.1, interface-id 6
In the area 0 via interface GigabitEthernet0/0/0
Neighbor priority is 1, State is FULL, 6 state changes
DR is 172.16.1.1 BDR is 172.16.1.2
Options is 0x12 in Hello (E-bit, L-bit)
Options is 0x52 in DBD (E-bit, L-bit, O-bit)
LLS Options is 0x1 (LR)
Dead timer due in 00:00:37
Neighbor is up for 00:21:50
Index 1/1/1, retransmission queue length 0, number of retransmission 0
First 0x0(0)/0x0(0)/0x0(0) Next 0x0(0)/0x0(0)/0x0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec
R3# show ip route ospf | begin Gateway
Gateway of last resort is 172.16.1.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O IA 10.10.0.0/30 [110/3] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
O IA 10.10.1.0/24 [110/13] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
O 172.16.0.0/30 [110/2] via 172.16.1.1, 00:26:08, GigabitEthernet0/0/0
R3# show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "ospf 123", distance 110, metric 1, candidate default path
Tag 123, type extern 2, forward metric 1
Last update from 172.16.1.1 on GigabitEthernet0/0/0, 00:28:41 ago
Routing Descriptor Blocks:
* 172.16.1.1, from 2.2.2.1, 00:28:41 ago, via GigabitEthernet0/0/0
Route metric is 1, traffic share count is 1
Route tag 123
R3# show ip route 10.10.1.0
Routing entry for 10.10.1.0/24
Known via "ospf 123", distance 110, metric 13, type inter area
Last update from 172.16.1.1 on GigabitEthernet0/0/0, 00:29:10 ago
Routing Descriptor Blocks:
* 172.16.1.1, from 1.1.1.1, 00:29:10 ago, via GigabitEthernet0/0/0
Route metric is 13, traffic share count is 1
Cấu hình OSPF trên D2
D2(config)# ip routing
D2(config)# router ospf 123
D2(config-router)# router-id 3.3.3.2
D2(config-router)# auto-cost reference-bandwidth 1000
% OSPF: Reference bandwidth is changed.
Please ensure reference bandwidth is consistent across all routers.
D2(config-router)# network 10.10.4.0 0.0.0.3 area 2
D2(config-router)# network 10.10.5.0 0.0.0.255 area 2
D2(config-router)# end
D2#
*Mar 1 01:52:03.888: %OSPF-5-ADJCHG: Process 123, Nbr 3.3.3.1 on GigabitEthernet1/0/11 from LOADING to FULL, Loading Done
Kiểm tra
D2# show ip protocols
Routing Protocol is "ospf 123"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 3.3.3.2
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
10.10.4.0 0.0.0.3 area 2
10.10.5.0 0.0.0.255 area 2
Routing Information Sources:
Gateway Distance Last Update
3.3.3.1 110 00:09:35
2.2.2.1 110 00:04:38
Distance: (default is 110)
D2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.1 1 FULL/BDR 00:00:33 10.10.4.1 GigabitEthernet1/0/11
D2# show ip route ospf | begin Gateway
Gateway of last resort is 10.10.4.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.10.4.1, 00:09:25, Gigabitthernet1/0/11
10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
O IA 10.10.0.0/30 [110/4] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
O IA 10.10.1.0/24 [110/14] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
172.16.0.0/30 is subnetted, 2 subnets
O IA 172.16.0.0 [110/3] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
O IA 172.16.1.0 [110/2] via 10.10.4.1, 00:09:00, GigabitEthernet1/0/11
D2# show ip route 0.0.0.0
Routing entry for 0.0.0.0/0, supernet
Known via "ospf 123", distance 110, metric 1, candidate default path
Tag 123, type extern 2, forward metric 2
Last update from 10.10.4.1 on GigabitEthernet1/0/11, 00:18:31 ago
Routing Descriptor Blocks:
* 10.10.4.1, from 2.2.2.1, 00:18:31 ago, via GigabitEthernet1/0/11
Route metric is 1, traffic share count is 1
Route tag 123
Kiểm tra kết nối end-to-end
Từ PC1, kiểm tra kết nối bằng cách ping và traceroute đến PC3.
PC> ping 10.10.5.10
Pinging 10.10.5.10 with 32 bytes of data:
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Reply from 10.10.5.10: bytes=32 time=1ms TTL=123
Ping statistics for 10.10.5.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC> tracert 10.10.5.10
Tracing route to DESKTOP-3FR7RKA [10.10.5.10]
over a maximum of 30 hops:
1 1 ms 1 ms 1 ms 10.10.1.1
2 <1 ms <1 ms <1 ms 10.10.0.1
3 1 ms <1 ms <1 ms 172.16.0.1
4 1 ms 1 ms <1 ms 172.16.1.2
5 1 ms 2 ms 2 ms 10.10.4.2
6 1 ms <1 ms <1 ms DESKTOP-3RF7RKA [10.10.5.10]
Trace complete.
Bước 3: Tìm hiểu các LSA (Link-State Advertisemens)
Trong phần này, các học viên sẽ kiểm tra rằng mạng đã hội tụ và tìm hiểu làm thế nào các link-state advertisemens (LSAs) được sử dụng để xây dựng nên bảng link-state database (LSDB).
Router OSPF tạo ra LSAs cho mọi interface chạy OSPF được kết nối trực tiếp. Sau đó, nó gửi các LSA đến các router OSPF adjacencies. LSA là các bản ghi cơ sở dữ liệu cung cấp thông tin chi tiết về mạng cụ thể chạy OSPF. Chính vì điều này, chúng mô tả toàn bộ topology của một area OSPF.
Router OSPF sẽ sử dụng 6 LSA Type cho định tuyến IPv4:
- Type 1, router LSA
- Type 2, network LSA
- Type 3, summary LSA
- Type 4, ASBR summary LSA
- Type 5, AS external LSA
- Type 7, NSSA external LSA
Trên D1, hiển thị danh sách các neighbor với câu lệnh show ip ospf neighbors
D1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:00:32 10.10.0.1 GigabitEthernet1/0/11
Kiểm tra bảng định tuyến với câu lệnh show ip router ospf | begin Gateway
D1# show ip route ospf | begin Gateway
Gateway of last resort is 10.10.0.1 to network 0.0.0.0
O*E2 0.0.0.0/0 [110/1] via 10.10.0.1, 01:15:48, GigabitEthernet1/0/11
10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
O IA 10.10.4.0/30 [110/4] via 10.10.0.1, 00:52:50, GigabitEthernet1/0/11
O IA 10.10.5.0/24 [110/14] via 10.10.0.1, 00:24:49, GigabitEthernet1/0/11
172.16.0.0/30 is subnetted, 2 subnets
O IA 172.16.0.0 [110/2] via 10.10.0.1, 02:05:06, GigabitEthernet1/0/11
O IA 172.16.1.0 [110/3] via 10.10.0.1, 01:18:11, GigabitEthernet1/0/11
D1 học được các mạng từ các LSA. Router duy trì LSDB trong mỗi area mà có interface của nó tham gia vào OSPF. Vì D1 là một router OSPF nội vùng nên nó chỉ có các entries của Area 1. Để hiện thị nội dung của LSDB D1, các học viên sử dụng câu lệnh show ip ospf database
D1# show ip ospf database
OSPF Router with ID (1.1.1.2) (Process ID 123)
Router Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1806 0x80000005 0x00DC15 1
1.1.1.2 1.1.1.2 167 0x80000005 0x001AA6 2
Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.10.0.2 1.1.1.2 167 0x80000003 0x00B462
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
10.10.4.0 1.1.1.1 1806 0x80000002 0x00A86E
10.10.5.0 1.1.1.1 1807 0x80000002 0x0014F4
172.16.0.0 1.1.1.1 1807 0x80000002 0x00DBA1
172.16.1.0 1.1.1.1 1807 0x80000002 0x00DAA0
Summary ASB Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
2.2.2.1 1.1.1.1 1807 0x80000002 0x00131C
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 2.2.2.1 1939 0x80000002 0x009F90 123
Để xem chi tiết thông tin LSA Type 1 dùng câu lệnh
D1# show ip ospf database router
OSPF Router with ID (1.1.1.2) (Process ID 123)
Router Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 843
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000007
Checksum: 0xD817
Length: 36
Area Border Router
Number of Links: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.10.0.2
(Link Data) Router Interface address: 10.10.0.1
Number of TOS metrics: 0
TOS 0 Metrics: 1
LS age: 1196
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.2
Advertising Router: 1.1.1.2
LS Seq Number: 80000006
Checksum: 0x18A7
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 10.10.0.2
(Link Data) Router Interface address: 10.10.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 10.10.1.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 10
Để tìm hiểu thêm về LSA Type 2 dùng câu lệnh
D1# show ip ospf database network
OSPF Router with ID (1.1.1.2) (Process ID 123)
Net Link States (Area 1)
LS age: 845
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 10.10.0.2 (address of Designated Router)
Advertising Router: 1.1.1.2
LS Seq Number: 80000005
Checksum: 0xB064
Length: 32
Network Mask: /30
Attached Router: 1.1.1.2
Attached Router: 1.1.1.1
Thông tin về LSA Type 3
D1# show ip ospf database summary
OSPF Router with ID (1.1.1.2) (Process ID 123)
Summary Net Link States (Area 1)
LS age: 987
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.4.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xA271
Length: 28
Network Mask: /30
MTID: 0 Metric: 3
LS age: 987
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 10.10.5.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xEF7
Length: 28
Network Mask: /24
MTID: 0 Metric: 13
LS age: 988
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 172.16.0.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xD5A4
Length: 28
Network Mask: /30
MTID: 0 Metric: 1
LS age: 989
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 172.16.1.0 (summary Network Number)
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xD4A3
Length: 28
Network Mask: /30
MTID: 0 Metric: 2
Thông tin về LSA Type 4
D1# show ip ospf database asbr-summary
OSPF Router with ID (1.1.1.2) (Process ID 123)
Summary ASB Link States (Area 1)
LS age: 591
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 2.2.2.1 (AS Boundary Router address)
Advertising Router: 1.1.1.1
LS Seq Number: 80000006
Checksum: 0xB20
Length: 28
Network Mask: /0
MTID: 0 Metric: 1
Thông tin về LSA Type 5
D1# show ip ospf database external
OSPF Router with ID (1.1.1.2) (Process ID 123)
Type-5 AS External Link States
LS age: 1024
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 0.0.0.0 (External Network Number )
Advertising Router: 2.2.2.1
LS Seq Number: 80000006
Checksum: 0x9794
Length: 36
Network Mask: /0
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 1
Forward Address: 0.0.0.0
External Route Tag: 123
Kiểm tra thông tin các LSA trên R1 và R2 với câu lệnh tương tự:
show ip ospf database
show ip ospf database router
show ip ospf database network
show ip ospf database summary
show ip ospf database asbr-summary
show ip ospf database external
Close configuration window