Basic OSPF configuration example
Network requirements
As shown in Figure 22:
Enable OSPF on all switches, and split the AS into three areas.
Configure Switch A and Switch B as ABRs.
Figure 22: Network diagram
Configuration procedure
Configure IP addresses for interfaces. (Details not shown.)
Enable OSPF:
# Configure Switch A.
<SwitchA> system-view [SwitchA] router id 10.2.1.1 [SwitchA] ospf [SwitchA-ospf-1] area 0 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] quit [SwitchA-ospf-1] area 1 [SwitchA-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.1] quit [SwitchA-ospf-1] quit
# Configure Switch B.
<SwitchB> system-view [SwitchB] router id 10.3.1.1 [SwitchB] ospf [SwitchB-ospf-1] area 0 [SwitchB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [SwitchB-ospf-1-area-0.0.0.0] quit [SwitchB-ospf-1] area 2 [SwitchB-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255 [SwitchB-ospf-1-area-0.0.0.2] quit [SwitchB-ospf-1] quit
# Configure Switch C.
<SwitchC> system-view [SwitchC] router id 10.4.1.1 [SwitchC] ospf [SwitchC-ospf-1] area 1 [SwitchC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255 [SwitchC-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255 [SwitchC-ospf-1-area-0.0.0.1] quit [SwitchC-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view [SwitchD] router id 10.5.1.1 [SwitchD] ospf [SwitchD-ospf-1] area 2 [SwitchD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255 [SwitchD-ospf-1-area-0.0.0.2] network 10.5.1.0 0.0.0.255 [SwitchD-ospf-1-area-0.0.0.2] quit [SwitchD-ospf-1] quit
Verifying the configuration
# Display information about neighbors on Switch A.
[SwitchA] display ospf peer verbose OSPF Process 1 with Router ID 10.2.1.1 Neighbors Area 0.0.0.0 interface 10.1.1.1(Vlan-interface100)'s neighbors Router ID: 10.3.1.1 Address: 10.1.1.2 GR State: Normal State: Full Mode: Nbr is Master Priority: 1 DR: 10.1.1.1 BDR: 10.1.1.2 MTU: 0 Options is 0x02 (-|-|-|-|-|-|E|-) Dead timer due in 37 sec Neighbor is up for 06:03:59 Authentication Sequence: [ 0 ] Neighbor state change count: 5 BFD status: Disabled Area 0.0.0.1 interface 10.2.1.1(Vlan-interface200)'s neighbors Router ID: 10.4.1.1 Address: 10.2.1.2 GR State: Normal State: Full Mode: Nbr is Master Priority: 1 DR: 10.2.1.1 BDR: 10.2.1.2 MTU: 0 Options is 0x02 (-|-|-|-|-|-|E|-) Dead timer due in 32 sec Neighbor is up for 06:03:12 Authentication Sequence: [ 0 ] Neighbor state change count: 5
# Display OSPF routing information on Switch A.
[SwitchA] display ospf routing OSPF Process 1 with Router ID 10.2.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 10.2.1.0/24 1 Transit 10.2.1.1 10.2.1.1 0.0.0.1 10.3.1.0/24 2 Inter 10.1.1.2 10.3.1.1 0.0.0.0 10.4.1.0/24 2 Stub 10.2.1.2 10.4.1.1 0.0.0.1 10.5.1.0/24 3 Inter 10.1.1.2 10.3.1.1 0.0.0.0 10.1.1.0/24 1 Transit 10.1.1.1 10.2.1.1 0.0.0.0 Total Nets: 5 Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
# Display OSPF routing information on Switch D.
[SwitchD] display ospf routing OSPF Process 1 with Router ID 10.5.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 10.2.1.0/24 3 Inter 10.3.1.1 10.3.1.1 0.0.0.2 10.3.1.0/24 1 Transit 10.3.1.2 10.3.1.1 0.0.0.2 10.4.1.0/24 4 Inter 10.3.1.1 10.3.1.1 0.0.0.2 10.5.1.0/24 1 Stub 10.5.1.1 10.5.1.1 0.0.0.2 10.1.1.0/24 2 Inter 10.3.1.1 10.3.1.1 0.0.0.2 Total Nets: 5 Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
# On Switch D, ping the IP address 10.4.1.1 to test reachability.
[SwitchD] ping 10.4.1.1 Ping 10.4.1.1 (10.4.1.1): 56 data bytes, press CTRL_C to break 56 bytes from 10.4.1.1: icmp_seq=0 ttl=253 time=1.549 ms 56 bytes from 10.4.1.1: icmp_seq=1 ttl=253 time=1.539 ms 56 bytes from 10.4.1.1: icmp_seq=2 ttl=253 time=0.779 ms 56 bytes from 10.4.1.1: icmp_seq=3 ttl=253 time=1.702 ms 56 bytes from 10.4.1.1: icmp_seq=4 ttl=253 time=1.471 ms --- Ping statistics for 10.4.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.779/1.408/1.702/0.323 ms