Tutorial 5 – Basic OSPF Configuration
In this video tutorial, we configure OSPF between two IP Infusion OcNOS routers so that two PCs on different networks can reach each other. OSPF is the most widely used interior gateway protocol: routers exchange the state of their links and each calculates the best paths with the SPF algorithm.
What You Will Learn
Starting an OSPF process and setting the router ID
Advertising networks in the backbone area
Checking the OSPF neighbors
Reading the OSPF routes in the routing table
Testing end-to-end connectivity
Lab Topology
Network | Where |
|---|---|
10.10.10.0/24 | PC1, behind the first router |
20.20.20.0/24 | PC2, behind the second router |
192.168.1.0/24 | Link between the two routers |
Without a routing protocol, each router only knows its own connected networks, so PC1 can't reach PC2.
Step 1: Configure OSPF on the First Router
OcNOS#configure terminal
OcNOS(config)#router ospf 1
OcNOS(config-router)#router-id 1.1.1.1
OcNOS(config-router)#network 192.168.1.0/24 area 0
OcNOS(config-router)#network 10.10.10.0/24 area 0
OcNOS(config-router)#commitrouter ospf 1 starts OSPF process 1. The process ID is local to the router and doesn't need to match on the neighbor.
router-id 1.1.1.1 sets the router ID, which identifies the router in the OSPF domain. It must be unique.
network 192.168.1.0/24 area 0 enables OSPF on the interfaces in this network and advertises it. Area 0 is the backbone area.
The network towards PC1, 10.10.10.0/24, is advertised the same way, then commit applies the configuration.
Step 2: Configure the Second Router
OcNOS#configure terminal
OcNOS(config)#router ospf 1
OcNOS(config-router)#router-id 2.2.2.2
OcNOS(config-router)#network 192.168.1.0/24 area 0
OcNOS(config-router)#network 20.20.20.0/24 area 0
OcNOS(config-router)#commitThe second router uses its own router ID and advertises the link and the PC2 network. 2.2.2.2 is an example router ID.
Verify the Configuration
OcNOS#show ip ospf neighbor
OcNOS#show ip route ospfshow ip ospf neighbor lists the OSPF neighbors: the other router must appear in the Full state, which means the link-state databases are synchronized. show ip route ospf shows the routes learned through OSPF: the first router must have a route to 20.20.20.0/24, and the second to 10.10.10.0/24. The ping between the PCs then succeeds, as shown in the video.
Common Mistakes
Duplicate router ID: two routers with the same router ID cause unstable adjacencies.
Area mismatch: both ends of a link must be in the same area.
Network not advertised: if the PC network is missing from the network commands, the other router never learns it.
MTU mismatch: different MTUs on the two ends keep the neighbors stuck before the Full state.
Go Further
IS-IS is the other link-state protocol used in service provider networks: see Tutorial 12 – IS-IS Configuration.
Previous video: Tutorial 4 – Link Aggregation Configuration.
Next video: Tutorial 6 – MOTD Banner Configuration.
