Home > Networking > Cisco > Learning cisco ospf start from zero

Learning cisco ospf start from zero


Teaching Guide: Configuring OSPF with Authentication on a Cisco Router

Level: Beginner (Zero IT Knowledge)
Topic: Basic OSPF in Area 0 with Peer Authentication
Date: March 09, 2025


What is OSPF?

  • OSPF stands for Open Shortest Path First. It’s a way routers talk to each other to share information about networks.
  • Think of it like a GPS for routers—it helps them find the best path to send data.
  • We’ll set it up in Area 0, which is like the main hub where all OSPF routers connect.

What is Authentication?

  • Authentication is like a secret password between routers.
  • It makes sure only trusted routers can join the OSPF “conversation.”
  • We’ll use MD5 authentication, which is a secure way to check the password.

Reference Link:

  • Learn more about OSPF basics: Visit Cisco’s official OSPF guide at https://www.cisco.com/c/en/us/support/docs/ip/open-shortest-path-first-ospf/7039-1.html.
  • Understand MD5 authentication: Check out this tutorial at https://networklessons.com/ospf/ospf-authentication.
  • Download Cisco Packet Tracer for practice: Get it from https://www.netacad.com/courses/packet-tracer.

What You’ll Learn:

  1. How to turn on OSPF on a router.
  2. How to add a network to OSPF in Area 0.
  3. How to set up a password (authentication) so only trusted routers connect.
  4. How to check if it works.

Sample Scenario

Imagine you have two routers (Router1 and Router2) connected by a cable. We’ll configure Router1 to use OSPF in Area 0 and add authentication. Router2 would need a similar setup to “talk” to Router1.

  • Router1 IP: 192.168.1.1 (on its GigabitEthernet0/0 port)
  • Network: 192.168.1.0/24 (a group of IP addresses)
  • Password: “cisco123” (our secret key)

Step-by-Step Configuration for Router1

Step 1: Get into Configuration Mode

  • When you turn on a Cisco router, you see a prompt like Router>.
  • Type these commands to start changing settings:
enable
configure terminal
  • What it does: enable gives you permission to change things, and configure terminal lets you edit the router’s settings.

Step 2: Start OSPF

  • OSPF needs a number to identify it (like a name tag). We’ll use “1”:
router ospf 1
  • Give the router a unique ID (like a nickname, e.g., 1.1.1.1):
router-id 1.1.1.1
  • What it does: This turns on OSPF and gives Router1 an ID so other routers know who it is.

Step 3: Tell OSPF Which Network to Share

  • We want Router1 to tell others about the network 192.168.1.0:
network 192.168.1.0 0.0.0.255 area 0
  • What it does:
  • 192.168.1.0 is the network address.
  • 0.0.0.255 is a “wildcard mask” (it means all IPs from 192.168.1.0 to 192.168.1.255).
  • area 0 puts this network in the main OSPF area.

Step 4: Turn On Authentication for Area 0

  • Add a password requirement for all routers in Area 0:
area 0 authentication message-digest
  • What it does: This says, “Every router in Area 0 must use a password with MD5 (a secure method).”

Step 5: Set Up the Router’s Port

  • Go to the port connected to Router2 (e.g., GigabitEthernet0/0):
interface GigabitEthernet0/0
  • Give it an IP address:
ip address 192.168.1.1 255.255.255.0
  • Turn on authentication for this port:
ip ospf authentication message-digest
  • Set the password (key) for this port:
ip ospf message-digest-key 1 md5 cisco123
  • Turn the port on:
no shutdown
  • What it does:
  • ip address sets the port’s address.
  • message-digest uses MD5 for the password.
  • key 1 md5 cisco123 means key number 1 uses the password “cisco123.”
  • no shutdown makes the port active.

Step 6: Exit and Save

  • Go back to the main prompt and save your work:
exit
end
write memory
  • What it does: write memory saves the config so it’s not lost when the router restarts.

Full Config for Router1

Here’s everything together:

enable
configure terminal
router ospf 1
 router-id 1.1.1.1
 network 192.168.1.0 0.0.0.255 area 0
 area 0 authentication message-digest
interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 ip ospf authentication message-digest
 ip ospf message-digest-key 1 md5 cisco123
 no shutdown
exit
end
write memory

Practice Task

  1. Set Up Router2:
  • Use the same steps, but change:
    • router-id to 2.2.2.2
    • ip address to 192.168.1.2 255.255.255.0
    • Keep the same password (cisco123) and key number (1).
  1. Connect the Routers:
  • In a simulator (like Packet Tracer), connect GigabitEthernet0/0 on Router1 to GigabitEthernet0/0 on Router2 with a cable.

How to Check if It Works

After configuring both routers, type these commands on Router1:

  1. show ip ospf neighbor
  • You should see Router2 listed with its ID (2.2.2.2) and “FULL” status.
  • If it’s empty, something’s wrong (e.g., password mismatch).
  1. show running-config
  • This shows your config—check for typos!

Why It Matters

  • OSPF: Helps routers share maps of the network so data gets where it needs to go.
  • Authentication: Keeps your network safe from untrusted routers.

Beginner Tips

  • Practice: Use a simulator like Cisco Packet Tracer to try this.
  • Mistakes to Avoid:
  • If the password or key number doesn’t match on both routers, they won’t connect.
  • Don’t forget no shutdown—the port won’t work without it!
  • Next Steps: Try adding more routers or networks to Area 0.

Leave a Comment