Sub topic 14
Configuring OSPF on a Small Network
This chapter assumes you know IPv4 addressing and subnet masks, basic router interface configuration, and how the Hello protocol and router IDs work. You will build a working OSPF configuration for one router, using Cisco IOS-style commands.
The Scenario
Router R1 connects to R2 and R3 over point-to-point links. It also has a LAN, 192.168.1.0/24, where only hosts live. All interfaces are in area 0.
The Configuration
router ospf 1
router-id 1.1.1.1
auto-cost reference-bandwidth 10000
passive-interface GigabitEthernet0/2
!
interface GigabitEthernet0/0
ip address 10.0.12.1 255.255.255.252
ip ospf 1 area 0
ip ospf network point-to-point
!
interface GigabitEthernet0/1
ip address 10.0.13.1 255.255.255.252
ip ospf 1 area 0
ip ospf cost 20
!
interface GigabitEthernet0/2
ip address 192.168.1.1 255.255.255.0
ip ospf 1 area 0What Each Part Does
router ospf 1starts an OSPF process. The number is local to the router. Neighbors do not need to use the same one.router-id 1.1.1.1fixes the router ID. Without it, the router picks its highest loopback address, then its highest active interface address. Setting it by hand keeps the ID stable when interfaces change.auto-cost reference-bandwidth 10000sets the reference to 10 Gbps. Cost is the reference bandwidth divided by the interface bandwidth. The old default of 100 Mbps gives Fast Ethernet and Gigabit Ethernet the same cost of 1. Set the same value on every router, or costs will be inconsistent.ip ospf 1 area 0enables OSPF on that interface and places it in area 0. The router then advertises the interface's network.ip ospf network point-to-pointskips DR/BDR election on that link. This suits a two-router link, and the adjacency forms faster.ip ospf cost 20overrides the calculated cost. Use it to steer traffic toward a preferred path.passive-interfacestops Hellos on the LAN. The LAN is still advertised, but no one can form a neighbor relationship there.
Both ends of a link must agree on network type, Hello and dead timers, area, and subnet. R2 and R3 need matching settings, or the adjacency will stall.
Same Setup in FRRouting
The concepts carry across vendors. FRRouting uses network statements instead:
router ospf
ospf router-id 1.1.1.1
network 10.0.12.0/30 area 0
network 192.168.1.0/24 area 0
passive-interface eth2Exercise
R1's Gi0/2 faces a LAN with only hosts. You want the LAN reachable through OSPF but want no OSPF neighbors formed there. Which command do you use, and why must the interface still have ip ospf 1 area 0?
Show answer
Use passive-interface GigabitEthernet0/2 under router ospf 1. Passive stops Hellos, so no neighbors form. The interface still needs ip ospf 1 area 0 so OSPF includes its network in the router's advertisements. Without that line, the LAN would not be advertised at all.
Exercise
A link with a 10 Gbps interface has a cost of 1 under the default reference bandwidth of 100 Mbps. After you set auto-cost reference-bandwidth 10000, what is its cost, and what is the cost of a 1 Gbps interface?
Show answer
The 10 Gbps interface has a cost of 1 (10000 / 10000). The 1 Gbps interface has a cost of 10 (10000 / 1000). The two links are now distinguishable, so SPF can prefer the faster one.