Cisco OSPF: Three-Router Single-Area Configuration Example

1. What OSPF does

Open Shortest Path First (OSPF) is a link-state interior gateway protocol for routing within an autonomous system. Routers exchange link-state information and calculate paths with Dijkstra’s shortest-path-first algorithm. Topology changes trigger routing updates. OSPF supports VLSM/CIDR and hierarchical areas; summarization applies at appropriate area/domain boundaries, not arbitrarily on every router.

2. Address the lab

The source refers to a topology picture, but no picture is present in the stored article. The following networks are taken from its commands: Router0 and Router1 share 192.168.1.0/30; Router1 and Router2 share 192.168.1.4/30. Each router has its own /24 LAN. This is an interpretation of those commands, not a recovered topology drawing.

PCIP addressSubnet mask
PC010.1.1.1255.255.255.0
PC110.1.1.2255.255.255.0
PC210.1.2.1255.255.255.0
PC310.1.2.2255.255.255.0
PC410.1.3.1255.255.255.0
PC510.1.3.2255.255.255.0

For these conventional /24 LANs, .0 is the network address, .255 the broadcast address, and .1 through .254 are host addresses. That is specific to these masks, not a rule for all subnets. The source chooses .254 for the router LAN interface. Choosing .254 does not itself grant every PC permission or connectivity; PCs also need an appropriate gateway and working interfaces/routes.

Router0 LAN and serial-interface examples:

Router(config)#int fa0/0
Router(config-if)#ip add 10.1.1.254 255.255.255.0
Router(config)#int se0/0
Router(config-if)#ip add 192.168.1.1 255.255.255.252

ip add abbreviates ip address on the source IOS CLI. The serial link uses a /30 mask, 255.255.255.252. Configure the other routers’ correct interface addresses and operational link settings for the real lab; the source does not supply every peer-interface command.

3. Enable OSPF in area 0

Enter global configuration and select the local OSPF process with router ospf 1. A network address wildcard area area-id statement selects matching local interfaces for OSPF; its wildcard mask is not a prefix-length field. The examples use 0.0.0.255 for /24 networks and 0.0.0.3 for /30 networks.

The source creates a /32 loopback before starting OSPF on each router to provide a stable router-ID candidate: 1.1.1.1, 2.2.2.2 and 3.3.3.3. Use unique, planned addresses; arbitrary production addresses can conflict. The loopback interface number is local and does not determine the router ID.

Router0 source configuration

Router# conf t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int loopback 0

Router(config-if)#ip add 1.1.1.1 255.255.255.255
! Example loopback address; use a unique planned address

Router(config-if)#exit

Router(config)#router ospf 1

Router(config-router)#network 10.1.1.0 0.0.0.255 area 0
! Network address, wildcard mask and area

Router(config-router)#network 192.168.1.0 0.0.0.3 area 0

Router(config-router)#end

Router1 source configuration

Router#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int loopback 1

Router(config-if)#ip add 2.2.2.2 255.255.255.255
! Example loopback address; use a unique planned address

Router(config-if)#exit

Router(config)#router ospf 1

Router(config-router)#network 10.1.2.0 0.0.0.255 area 0
! Network address, wildcard mask and area

Router(config-router)#network 192.168.1.0 0.0.0.3 area 0

Router(config-router)#network 192.168.1.4 0.0.0.3 area 0

Router(config-router)#end

Router2 source configuration

Router#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int loopback 2

Router(config-if)#ip add 3.3.3.3 255.255.255.255
! Example loopback address; use a unique planned address

Router(config-if)#exit

Router(config)#router ospf 1

Router(config-router)#network 192.168.1.4 0.0.0.3 area 0
! Network address, wildcard mask and area

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

Router(config-router)#end

These network statements do not enable OSPF on the loopbacks themselves; selecting a loopback for the router ID does not advertise its /32. If a process already selected a router ID before the loopback existed, creating the loopback does not necessarily change the running ID. Confirm the running state and plan any explicit router-ID change/process restart; no disruptive clear command is part of this lab.

Official English references: OSPF duplicate router IDs; OSPF frequently asked questions.

Can't find an answer?

Upload a log for AI diagnosis, or ask the AI assistant directly in the console.