1)配置OSPF实现全网互通。
2)使用命令验证配置。
搭建实验环境:
现此案例需要按照如下步骤进行。
//R1的配置
ospf 1 router-id 1.1.1.1
area 0
network 192.168.10.0 0.0.0.255
network 192.168.1.1 0.0.0.0
network 192.168.21.0 0.0.0.3
//R2的配置
ospf 1 router-id 2.2.2.2
area 0
network 192.168.21.0 0.0.0.3
network 192.168.23.0 0.0.0.3
network 192.168.2.1 0.0.0.0
//R3的配置
ospf 1 router-id 3.3.3.3
area 0
network 192.168.23.0 0.0.0.3
network 192.168.30.0 0.0.0.255
network 192.168.3.1 0.0.0.0
能够全网ping通。
[R1]dis ospf brief
OSPF Process 1 with Router ID 1.1.1.1
OSPF Protocol Information
RouterID: 1.1.1.1 Border Router:
Multi-VPN-Instance is not enabled
Global DS-TE Mode: Non-Standard IETF Mode
Graceful-restart capability: disabled
Helper support capability : not configured
Applications Supported: MPLS Traffic-Engineering
Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms
Default ASE parameters: Metric: 1 Tag: 1 Type: 2
Route Preference: 10
ASE Route Preference: 150
SPF Computation Count: 11
RFC 1583 Compatible
Retransmission limitation is disabled
Area Count: 1 Nssa Area Count: 0
ExChange/Loading Neighbors: 0
Process total up interface count: 3
Process valid up interface count: 1
Area: 0.0.0.0 (MPLS TE not enabled)
Authtype: None Area flag: Normal
SPF scheduled Count: 11
ExChange/Loading Neighbors: 0
Router ID conflict state: Normal
Area interface up count: 3
Interface: 192.168.21.1 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.21.1
Backup Designated Router: 192.168.21.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.1.1 (LoopBack0)
Cost: 0 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.10.1 (LoopBack1)
Cost: 0 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R2]dis ospf brief
OSPF Process 1 with Router ID 2.2.2.2
OSPF Protocol Information
RouterID: 2.2.2.2 Border Router:
Multi-VPN-Instance is not enabled
Global DS-TE Mode: Non-Standard IETF Mode
Graceful-restart capability: disabled
Helper support capability : not configured
Applications Supported: MPLS Traffic-Engineering
Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms
Default ASE parameters: Metric: 1 Tag: 1 Type: 2
Route Preference: 10
ASE Route Preference: 150
SPF Computation Count: 11
RFC 1583 Compatible
Retransmission limitation is disabled
Area Count: 1 Nssa Area Count: 0
ExChange/Loading Neighbors: 0
Process total up interface count: 3
Process valid up interface count: 2
Area: 0.0.0.0 (MPLS TE not enabled)
Authtype: None Area flag: Normal
SPF scheduled Count: 11
ExChange/Loading Neighbors: 0
Router ID conflict state: Normal
Area interface up count: 3
Interface: 192.168.21.2 (GigabitEthernet0/0/0)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.21.1
Backup Designated Router: 192.168.21.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.23.1 (GigabitEthernet0/0/1)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.23.1
Backup Designated Router: 192.168.23.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.2.1 (LoopBack0)
Cost: 0 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R3]dis ospf brief
OSPF Process 1 with Router ID 3.3.3.3
OSPF Protocol Information
RouterID: 3.3.3.3 Border Router:
Multi-VPN-Instance is not enabled
Global DS-TE Mode: Non-Standard IETF Mode
Graceful-restart capability: disabled
Helper support capability : not configured
Applications Supported: MPLS Traffic-Engineering
Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms
Default ASE parameters: Metric: 1 Tag: 1 Type: 2
Route Preference: 10
ASE Route Preference: 150
SPF Computation Count: 5
RFC 1583 Compatible
Retransmission limitation is disabled
Area Count: 1 Nssa Area Count: 0
ExChange/Loading Neighbors: 0
Process total up interface count: 3
Process valid up interface count: 1
Area: 0.0.0.0 (MPLS TE not enabled)
Authtype: None Area flag: Normal
SPF scheduled Count: 5
ExChange/Loading Neighbors: 0
Router ID conflict state: Normal
Area interface up count: 3
Interface: 192.168.23.2 (GigabitEthernet0/0/1)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.23.1
Backup Designated Router: 192.168.23.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.3.1 (LoopBack0)
Cost: 0 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
Interface: 192.168.30.1 (LoopBack1)
Cost: 0 State: P-2-P Type: P2P MTU: 1500
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R1]dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.2.1/32 OSPF 10 1 D 192.168.21.2 GigabitEthernet
0/0/0
192.168.3.1/32 OSPF 10 2 D 192.168.21.2 GigabitEthernet
0/0/0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 LoopBack1
192.168.10.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
192.168.10.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
192.168.21.0/30 Direct 0 0 D 192.168.21.1 GigabitEthernet
0/0/0
192.168.21.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.21.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.23.0/30 OSPF 10 2 D 192.168.21.2 GigabitEthernet
0/0/0
192.168.30.1/32 OSPF 10 2 D 192.168.21.2 GigabitEthernet
0/0/0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<R2>dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.1/32 OSPF 10 1 D 192.168.21.1 GigabitEthernet
0/0/0
192.168.2.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.3.1/32 OSPF 10 1 D 192.168.23.2 GigabitEthernet
0/0/1
192.168.10.1/32 OSPF 10 1 D 192.168.21.1 GigabitEthernet
0/0/0
192.168.21.0/30 Direct 0 0 D 192.168.21.2 GigabitEthernet
0/0/0
192.168.21.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.21.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.23.0/30 Direct 0 0 D 192.168.23.1 GigabitEthernet
0/0/1
192.168.23.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.30.1/32 OSPF 10 1 D 192.168.23.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
<R3>dis ip ro
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.1/32 OSPF 10 2 D 192.168.23.1 GigabitEthernet
0/0/1
192.168.2.1/32 OSPF 10 1 D 192.168.23.1 GigabitEthernet
0/0/1
192.168.3.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.10.1/32 OSPF 10 2 D 192.168.23.1 GigabitEthernet
0/0/1
192.168.21.0/30 OSPF 10 2 D 192.168.23.1 GigabitEthernet
0/0/1
192.168.23.0/30 Direct 0 0 D 192.168.23.2 GigabitEthernet
0/0/1
192.168.23.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.23.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.30.0/24 Direct 0 0 D 192.168.30.1 LoopBack1
192.168.30.1/32 Direct 0 0 D 127.0.0.1 LoopBack1
192.168.30.255/32 Direct 0 0 D 127.0.0.1 LoopBack1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0