Sub topic 17
Passive Interfaces and Authentication
This chapter assumes you can configure basic OSPF in area 0 and know how Hello packets form neighbors. It covers two controls on where and with whom a router forms adjacencies.
Passive Interfaces
A passive interface is an OSPF-enabled interface that sends and accepts no OSPF packets. OSPF still advertises the interface's subnet, so other routers can reach the LAN. The router just never forms a neighbor there.
Use it on interfaces that face end hosts. Without it, a router sends Hellos to every PC on the LAN. A rogue device on that segment could also try to become a neighbor and inject routes.
router ospf 1
passive-interface GigabitEthernet0/2On a router with many LAN-facing ports, flip the default and enable only the links that need neighbors:
router ospf 1
passive-interface default
no passive-interface GigabitEthernet0/0
no passive-interface GigabitEthernet0/1Authentication
Authentication makes a router prove its identity in every OSPF packet. A neighbor that fails the check has its packets dropped, and no adjacency forms. OSPFv2 defines three types:
| Type | Name | Protection |
|---|---|---|
| 0 | Null | None (default) |
| 1 | Simple password | Sent in clear text, so anyone capturing packets can read it |
| 2 | Cryptographic (MD5) | A keyed hash is sent, not the key |
Use cryptographic authentication. Simple passwords only stop accidental neighbors. Newer IOS releases also support HMAC-SHA through key chains, which is stronger than MD5.
Configuring MD5 on an Interface
interface GigabitEthernet0/0
ip ospf authentication message-digest
ip ospf message-digest-key 1 md5 S3cretKeyBoth ends of the link need the same key ID and the same key string. To enable authentication on every interface in an area at once, use area 0 authentication message-digest under router ospf. You still set the key on each interface.
Common Errors
- Key mismatch. The neighbor never appears. Run
debug ip ospf adjand look for authentication failure messages. - One side enabled. If only one router has authentication on, the other drops its packets for a type mismatch. Neither side reaches Full.
- Different key IDs. The strings may match, but the IDs must match too.
- Wrongly passive. The neighbor is missing, and
show ip ospf interfacereports the interface as passive.
Exercise
Router R1 has GigabitEthernet0/2 configured as a passive interface in OSPF area 0, and the interface's LAN is 192.168.1.0/24. Will R2 still learn the route to 192.168.1.0/24? Will R1 form a neighbor with a router plugged into that LAN?
Show answer
Yes, R2 still learns the route. A passive interface's subnet is still advertised in R1's Router LSA. No, R1 will not form a neighbor on that LAN, because a passive interface sends and accepts no Hellos.
Exercise
Two routers share a link. R1 uses ip ospf message-digest-key 1 md5 Blue and R2 uses ip ospf message-digest-key 2 md5 Blue. Both have message-digest authentication enabled. Will they become neighbors, and why?
Show answer
No. The key strings match but the key IDs differ, and both must match. Each router drops the other's packets as failed authentication.