Area planning, network statements and passive interfaces. Cisco output uses wildcard masks, which are the inverse of the subnet mask.
The default of 100 gives every link above 100 Mbps a cost of 1, so the metric stops distinguishing them. Set it above your fastest link.
! Cisco IOS / IOS-XE — OSPF process 1, generated by NetField
! Router IDs must be unique in the domain — a duplicate silently breaks adjacency.
! MTU must match on both ends or adjacency sticks in EXSTART.
! Passive-interface default is on: only listed transit links form adjacency.
configure terminal
!
router ospf 1
router-id 10.255.0.1
auto-cost reference-bandwidth 100000
passive-interface default
network 10.0.0.0 0.0.0.3 area 0
network 10.20.0.0 0.0.0.255 area 0
network 10.21.0.0 0.0.0.255 area 1
!
end