Sub topic 17
Passive Interfaces and Authentication
This chapter assumes you can configure basic OSPF as shown earlier in this tutorial. That means enabling OSPF on an interface, knowing what a Hello packet does, and understanding why two routers must agree on certain Hello parameters to become neighbors. Here you will control where OSPF speaks and make sure it only listens to routers you trust.
Why restrict OSPF on an interface
Enabling OSPF on an interface does two things. It advertises the interface's connected prefix to the area, and it sends and accepts OSPF packets on that link. On a link to another router you want both. On a LAN full of hosts you want only the first.
If you leave Hellos running on a user LAN, you create three problems:
- Every Hello is wasted traffic and processing on each host.
- Anyone who plugs in a device that speaks OSPF can try to become a neighbor and inject routes.
- On a broadcast segment a rogue device could even win the DR election.
Passive interfaces solve the first problem. Authentication solves the second and third wherever routers do need to talk.
Passive interfaces
A passive interface is an OSPF-enabled interface that sends no Hello packets and ignores any OSPF packets it receives. It never forms a neighbor relationship. The connected network is still advertised, as a stub link in the router's Type 1 LSA, so the rest of the network can reach hosts on that LAN.
router ospf 1
passive-interface GigabitEthernet0/2Passive means "do not form adjacencies here". It does not mean "do not advertise". If you want the prefix hidden from OSPF, do not enable OSPF on the interface at all.
Passive by default
On a router with many edge interfaces, it is safer to make everything passive and then open up only the router-to-router links:
router ospf 1
passive-interface default
no passive-interface GigabitEthernet0/0
no passive-interface GigabitEthernet0/1A new interface added later is silent until someone deliberately enables it. The cost of this approach is a common mistake: you forget the no passive-interface line on an inter-router link, and the adjacency never forms.
FRRouting equivalent
router ospf
ospf router-id 1.1.1.1
network 192.168.1.0/24 area 0
passive-interface eth2How Hello processing decides whether to accept a packet
Authentication is checked on every OSPF packet, not just Hellos. The check comes early, before the router looks at timers or area IDs.
This ordering explains a symptom you will see in practice. With an authentication mismatch the neighbor never appears in show ip ospf neighbor, because the packet is discarded before any neighbor entry is created.
OSPFv2 authentication types
The OSPFv2 packet header has an AuType field. Three values are defined.
| AuType | Name | What is sent | Notes |
|---|---|---|---|
| 0 | Null | Nothing | Default. Any router can join. |
| 1 | Simple password | The password in clear text | Up to 8 characters. Anyone who captures one packet reads it. |
| 2 | Cryptographic | A message digest (MD5, or HMAC-SHA with key chains) | The secret is never sent. Packets carry a key ID and a sequence number that blocks replays. |
Use type 2. Type 1 gives almost no protection. Authentication also does not encrypt anything. Anyone on the wire can still read your topology. It only proves that a packet came from a router holding the shared key and was not altered.
Configuring MD5 authentication
On Cisco IOS you enable the mode and the key on the interface:
interface GigabitEthernet0/0
ip address 10.0.12.1 255.255.255.252
ip ospf 1 area 0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 S3cretKeyThe neighbor must use the same key ID (1) and the same key string. You can also turn the mode on for a whole area, so that every interface in it requires digests:
router ospf 1
area 0 authentication message-digestThe area command only sets the mode. You still configure the key on each interface. Without a key, the interface sends no valid digest and neighbors drop its packets.
HMAC-SHA with a key chain
MD5 is considered weak. Newer IOS releases support HMAC-SHA through a key chain (RFC 5709):
key chain OSPF-KEYS
key 1
key-string S3cretKey
cryptographic-algorithm hmac-sha-256
!
interface GigabitEthernet0/0
ip ospf authentication key-chain OSPF-KEYSKey chains also support send and accept lifetimes, which makes key rotation possible without an outage. Check that every router in your network supports the algorithm before you switch.
FRRouting equivalent
interface eth0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 S3cretKeyVerifying and troubleshooting
Start with the interface view, which shows both features:
show ip ospf interface GigabitEthernet0/2
show ip ospf interface GigabitEthernet0/0
show ip protocolsFor a passive interface, the output includes a line saying no Hellos are sent because the interface is passive. For an authenticated interface, it reports that message digest authentication is enabled and shows the key ID in use. show ip protocols lists passive interfaces under the OSPF process.
When an adjacency fails and you suspect authentication, turn on debug ip ospf adjacency (briefly, on a lab or quiet router). Look for messages about a mismatched authentication type or a mismatched key. Typical causes are:
- One side has authentication enabled and the other has none.
- The key strings differ, often by a trailing space or a typo.
- The key IDs differ, even though the strings match.
- The two sides use different modes, such as simple password on one and message-digest on the other.
- A passive interface was configured on a link that should have a neighbor.
Exercise
Router R1 has GigabitEthernet0/2 facing a user LAN, and the LAN prefix must be reachable from the rest of the network. A colleague removes the ip ospf 1 area 0 line from that interface instead of using passive-interface. What goes wrong, and why is passive the better choice? Separately, R1 and R2 both run ip ospf authentication message-digest, with key ID 1 on R1 and key ID 2 on R2, using the same key string. Will they form an adjacency?
Show answer
Removing the OSPF enablement line stops OSPF from advertising the LAN prefix, so remote routers lose the route to the LAN. A passive interface keeps the prefix in the router's Type 1 LSA as a stub link while sending no Hellos and forming no neighbors. R1 and R2 will not form an adjacency. The key ID is part of the digest in the packet header, and a router looks up the key by that ID. A mismatch means the receiver drops the packets as an authentication failure, even though the strings are the same.