Course contents

Module 4: OSPF FeaturesLesson 4.1 (1 of 5 in this module)12 of 29 in the OSPF course

OSPF passive interfaces

How can R2 tell the other routers about a user LAN without trying to discover an OSPF router beside every PC? Let's separate advertising the network from forming a neighbour.

Intermediate · 9 min read

The LAN needs a route, but it does not need a neighbour

PC-A, 192.168.1.10/24, sends traffic through R1 towards PC-B, 192.168.2.10/24. PC-B connects through SW2 to R2's Gi0/2 interface, 192.168.2.1/24. That address is PC-B's default gateway: the router used for destinations outside its own subnet.

R1 needs a route to 192.168.2.0/24. R2 can advertise that network through OSPF (Open Shortest Path First), but PC-B does not run this routing protocol. There is no reason for R2 to send discovery packets onto this user LAN.

A passive interface solves those two requirements separately. It remains selected for OSPF, so its subnet can be advertised through R2's other adjacencies. It sends no OSPF Hellos, the packets used to discover and maintain neighbours, and does not use received Hellos to form an adjacency on that interface. Passive does not stop Ethernet frames from physically arriving at the port.

Compare three settings on the same LAN interface

Change only R2 Gi0/2 in these snapshots. Its link to R1 stays active.

Enabled and active

R2 includes LAN 2 in OSPF and sends Hellos on Gi0/2. The subnet is advertised, but no neighbour forms because PC-B is an end host. This works for route learning, yet it leaves unnecessary OSPF discovery active on the user network.

1 · OSPF enabled and active on the user LAN
1 · OSPF enabled and active on the user LANGrey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering. R2 advertises LAN 2 towards R1. Gi0/2 sends Hellos, although there is no intended OSPF peer on the LAN.R1 · Full to R2R2SW2PC-B10.0.12.0/30 · area 0Advertise 192.168.2.0/24Gi0/2 active192.168.2.10/24LAN Hellos sent · subnet advertised
Router link
R1 (RID 1.1.1.1) Gi0/1 10.0.12.1/30 ↔ R2 (RID 2.2.2.2) Gi0/0 10.0.12.2/30. Area 0; P2P; Full; Hello/Dead 10/40 s; no authentication; MTU 1500.
LAN devices and ports
R2 Gi0/2 192.168.2.1/24 → SW2 Gi0/1; SW2 Gi0/2 → PC-B Ethernet 192.168.2.10/24, gateway 192.168.2.1. SW2: Layer 2. No OSPF peer on this VLAN.
Prefix and cost key
LAN prefix: 192.168.2.0/24. Masks: /24 = 255.255.255.0; /30 = 255.255.255.252. Local process 1; gigabit interfaces, reference 10000 Mbps, cost 10.
Snapshot conditions
Active Gi0/2 is in area 0. PC-B runs no OSPF. R1 learns LAN 2 via R2 at cost 20.
Grey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering.

Enabled and passive

R2 still includes LAN 2 in its OSPF information. The difference is local activity on Gi0/2: no Hellos and no adjacency. R1 keeps its route to LAN 2 through R2. This is the intended configuration for this example.

2 · OSPF enabled, user LAN made passive
2 · OSPF enabled, user LAN made passiveGrey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering. R2 advertises LAN 2 towards R1. Gi0/2 sends no Hellos and forms no adjacency; data forwarding still works.R1 · Full to R2R2SW2PC-B10.0.12.0/30 · area 0Advertise 192.168.2.0/24Gi0/2 passive192.168.2.10/24No LAN Hellos · subnet stays advertised
Router link
R1 (RID 1.1.1.1) Gi0/1 10.0.12.1/30 ↔ R2 (RID 2.2.2.2) Gi0/0 10.0.12.2/30. Area 0; P2P; Full; Hello/Dead 10/40 s; no authentication; MTU 1500.
LAN devices and ports
R2 Gi0/2 192.168.2.1/24 → SW2 Gi0/1; SW2 Gi0/2 → PC-B Ethernet 192.168.2.10/24, gateway 192.168.2.1. SW2: Layer 2. No OSPF peer on this VLAN.
Prefix and cost key
LAN prefix: 192.168.2.0/24. Masks: /24 = 255.255.255.0; /30 = 255.255.255.252. Local process 1; gigabit interfaces, reference 10000 Mbps, cost 10.
Snapshot conditions
Passive Gi0/2 remains in area 0. R1 retains O 192.168.2.0/24 [110/20] via 10.0.12.2.
Grey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering.

Excluded from OSPF

Removing all OSPF activation from Gi0/2 has a different result. R2 still has a connected LAN route because the interface is up, but it no longer advertises that LAN through interface participation. With no other advertisement in this lab, R1 loses the learned /24 after convergence. That is why deleting the network statement is not a substitute for passive.

3 · LAN interface excluded from OSPF
3 · LAN interface excluded from OSPFGrey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering. Gi0/2 is not enabled for OSPF. R2 still has LAN 2 as a connected network, but no LAN 2 prefix is advertised by interface participation. No redistribution or alternate advertisement exists in this example.R1 · Full to R2R2SW2PC-B10.0.12.0/30 · area 0No LAN 2 advertisementGi0/2 excluded192.168.2.10/24No LAN Hellos · no OSPF LAN advertisement
Router link
R1 (RID 1.1.1.1) Gi0/1 10.0.12.1/30 ↔ R2 (RID 2.2.2.2) Gi0/0 10.0.12.2/30. Area 0; P2P; Full; Hello/Dead 10/40 s; no authentication; MTU 1500.
LAN devices and ports
R2 Gi0/2 192.168.2.1/24 → SW2 Gi0/1; SW2 Gi0/2 → PC-B Ethernet 192.168.2.10/24, gateway 192.168.2.1. SW2: Layer 2. No OSPF peer on this VLAN.
Prefix and cost key
LAN prefix: 192.168.2.0/24. Masks: /24 = 255.255.255.0; /30 = 255.255.255.252. Local process 1; gigabit interfaces, reference 10000 Mbps, cost 10.
Snapshot conditions
Gi0/2 has no OSPF activation. No other source advertises LAN 2. R2 keeps its connected LAN; R1 loses this OSPF /24 after convergence.
Grey lines are Ethernet links. Purple dashed arrow is LAN-prefix information towards R1; teal dashed arrow is Hello delivery. A short gold/coral mark changes OSPF behaviour, not the physical link or user-packet filtering.

Use passive on an OSPF-enabled LAN where no neighbour is intended. An excluded prefix could still be advertised by redistribution or another source.

Passive prevents unintended adjacency on the LAN; authentication and access controls still matter.

Configure one LAN interface

Use these Cisco IOS/IOS XE style commands on the router and interface shown. Interface names can differ by image. router ospf 1 enters the local OSPF process configuration; passive-interface then names the interface whose neighbour activity should stop. It does not itself select that interface for OSPF.

Start from privileged EXEC, R2#, and enter configure terminal to reach R2(config)#. The first line below changes the prompt to R2(config-router)#. Process number 1 is local to R2 and need not match its peers. The final exit returns to global configuration; use end before running show commands.

router ospf 1 passive-interface GigabitEthernet0/2 exit

R2 only, from global configuration mode. Gi0/2 is already enabled in area 0. The command belongs under router ospf, not under interface configuration.

If Gi0/2 is not already enabled, use ip ospf 1 area 0 under interface GigabitEthernet0/2, or a matching network statement under the OSPF process. See the configuration lesson.

Make passive the default, then allow router links

With several LANs it is easier to make passive the process default and explicitly allow only the router links. On R2, Gi0/0 reaches R1 at 10.0.12.1, and Gi0/1 reaches R3 at 10.0.23.2. These two links need active discovery. Gi0/2 reaches PC-B's LAN and should remain passive.

See the active exceptions on R2
R2 policy: only the two router links are active
R2 policy: only the two router links are activeGrey lines are Ethernet. Teal links are the allowed OSPF neighbour locations; gold marks the passive user LAN. Passive-default is a policy for OSPF behaviour, not interface activation. R2 uses passive-interface default. Gi0/0 towards R1 and Gi0/1 towards R3 are explicitly non-passive; Gi0/2 towards SW2 and PC-B remains passive. All three interfaces are enabled for OSPF in area 0.R1R2R3SW2PC-BGi0/0 · non-passiveGi0/1 · non-passiveGi0/2 · passiveLAN 2 · 192.168.2.0/24Expected neighbours on R2: R1 and R3 only
Router ports and IDs
R1 RID 1.1.1.1, Gi0/1 10.0.12.1/30 ↔ R2 RID 2.2.2.2, Gi0/0 10.0.12.2/30. R2 Gi0/1 10.0.23.1/30 ↔ R3 RID 3.3.3.3, Gi0/0 10.0.23.2/30. Both links: area 0, P2P, Hello 10 / Dead 40 s, expected Full.
LAN and configuration
R2 Gi0/2 192.168.2.1/24 → SW2 Gi0/1; SW2 Gi0/2 → PC-B Ethernet 192.168.2.10/24, gateway 192.168.2.1. All R2 interfaces already have OSPF activation in local process 1. New interfaces also need activation before their networks can be advertised.
Grey lines are Ethernet. Teal links are the allowed OSPF neighbour locations; gold marks the passive user LAN. Passive-default is a policy for OSPF behaviour, not interface activation.
router ospf 1 passive-interface default no passive-interface GigabitEthernet0/0 no passive-interface GigabitEthernet0/1 exit

R2 only, from global configuration mode. Intended final policy for an initial lab build: Gi0/0 towards R1 and Gi0/1 towards R3 are active; Gi0/2 towards PC-B remains passive. Interfaces are already enabled for OSPF.

Changing passive policy can interrupt adjacencies. This is an initial-build configuration; plan a live migration separately.

New interfaces still need OSPF activation; new router links also need a non-passive exception.

Verify the passive setting and the active neighbours

Start with the detailed interface output. The area and process identify its OSPF participation. The line No Hellos (Passive interface) confirms the intended behaviour. A blank neighbour table on a PC-only LAN is expected; the important neighbours are on R2's two router-facing interfaces.

The following outputs are written examples, not router captures. The router links in this main lab use OSPF point-to-point network type, as in the configuration lesson; FULL/ - therefore has no DR or BDR role. Their interfaces and LANs already have the configured addresses and are up.

Example output
R2#show ip ospf interface GigabitEthernet0/2
Internet Address 192.168.2.1/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 10
No Hellos (Passive interface)
Neighbor Count is 0, Adjacent neighbor count is 0
The address, area and cost confirm OSPF participation; No Hellos confirms passive. Zero neighbours on this user LAN is expected. Do not infer a DR election from a passive interface's displayed state, which can vary by software.
Example output
R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           0   FULL/  -        00:00:37    10.0.12.1       GigabitEthernet0/0
3.3.3.3           0   FULL/  -        00:00:34    10.0.23.2       GigabitEthernet0/1
R2 should still be Full with its two router peers. If one disappears, inspect passive status on the affected interface at both ends; a passive setting at one end is enough to prevent the adjacency.
show ip protocols

Privileged EXEC on R2: inspect the passive-interface policy and configured network selection. Use the detailed interface and live neighbour outputs to confirm the result.

Verify the remote route and the user's packet path

On R1, look for LAN 2's prefix rather than R2's router ID. The route's next hop, 10.0.12.2, is R2's address on the link R1 can reach directly. Traffic can then leave R2 Gi0/2 towards PC-B even though that interface is passive for OSPF.

Follow the user's packet across the passive LAN interface
Follow the packet through the passive LAN
PC-A reaches PC-B through SW1, R1, R2 and SW2PC-A 192.168.1.10/24 uses gateway 192.168.1.1 on R1 Gi0/0. R1 Gi0/1 10.0.12.1/30 connects to R2 Gi0/0 10.0.12.2/30 in OSPF area 0. R2 Gi0/2 192.168.2.1/24 connects through SW2 to PC-B 192.168.2.10/24. Both LAN interfaces are passive. Router IDs identify the OSPF routers and are not interface addresses.LAN 1 · VLAN 10LAN 2 · VLAN 2010.0.12.0/30 · area 0 · Full adjacencyR1R2Router ID: 1.1.1.1Router ID: 2.2.2.2Gi0/110.0.12.1/30Gi0/010.0.12.2/30Gi0/0 · passive192.168.1.1/24Gi0/2 · passive192.168.2.1/24PC-A192.168.1.10/24SW1SW2PC-B192.168.2.10/24Gateway: 192.168.1.1Gateway: 192.168.2.1Passive stops OSPF neighbours on the LAN; it does not block this user packet.
Hop 1 of 5
PC-A sends to its default gateway

192.168.2.10 is outside PC-A’s /24 subnet. PC-A addresses the Ethernet frame to R1’s LAN MAC address and sends through SW1.

Ports, settings and assumptions

SW1 Gi0/2 connects PC-A; Gi0/1 connects R1 Gi0/0. SW2 Gi0/1 connects R2 Gi0/2; Gi0/2 connects PC-B. R1/R2: area 0, point-to-point transit, interface cost 10, process 1, MTU 1500. R1 has O 192.168.2.0/24 [110/20] via 10.0.12.2. Routes, ARP, host gateways and permitting policy are assumed ready; no NAT. Grey lines are Ethernet; blue arrows show the selected hop; orange marks the packet. This is a forwarding illustration, not a device lab or complete ping exchange.

Assume no competing preferred route to LAN 2 in this lab. We are checking that OSPF supplies the route, rather than a static route hiding a missing advertisement.

Example output
R1#show ip route 192.168.2.0
Routing entry for 192.168.2.0/24
  Known via "ospf 1", distance 110, metric 20
  Routing Descriptor Blocks:
  * 10.0.12.2, via GigabitEthernet0/1
This lab uses reference bandwidth 10000 Mbps on gigabit interfaces. R1's outgoing transit cost 10 plus R2's LAN cost 10 gives metric 20. Switches add no routed interface cost.

Test PC-A 192.168.1.10 to PC-B 192.168.2.10 and back. If a prefix is missing, check activation, advertisement and route selection.

Short lab: prove that passive keeps the route

Start with the working three-router configuration in an isolated lab. Record R1's route to LAN 2 and R2's active neighbours. Make only R2 Gi0/2 passive using the first configuration block, then repeat these checks.

show ip ospf interface GigabitEthernet0/2 show ip ospf neighbor

R2, privileged EXEC. Confirm No Hellos on the LAN while the R1 and R3 router adjacencies remain Full.

show ip route 192.168.2.0

R1, privileged EXEC. The route should still use R2 at 10.0.12.2 with metric 20 under this lesson's reference-bandwidth assumptions.

Ping PC-B from PC-A and confirm the return traffic works. If the route remains but ping fails, check the hosts' masks, gateways and any filtering. Changing passive again will not repair an incorrect PC gateway. Keep Gi0/2 passive as the final intended state.

Recover a router link that was made passive by mistake

In this isolated chain, making R2 Gi0/1 passive removes the R3 adjacency and the paths that depend on it after the change is detected. Gi0/1 can still show up/up, because the cable has not failed. R2's Gi0/0 adjacency to R1 should remain Full. If you test this fault, record the working state first and use the lab console so you can restore the setting.

To restore that link under the passive-default policy, return to R2's global configuration mode and apply the exception below. Keep the default policy and Gi0/2's passive state; removing the entire policy would enable discovery on user LANs too.

router ospf 1 no passive-interface GigabitEthernet0/1 end

Recovery on R2, starting at R2(config)#. This exception permits neighbour discovery on the R3 link; it does not repair an area, timer or addressing mismatch.

Run show ip ospf interface GigabitEthernet0/1 on R2 and check that it is no longer passive. Then confirm R3 returns to Full in show ip ospf neighbor, the expected LAN 3 route returns, and the affected host traffic works in both directions. If no neighbour returns, inspect R3's corresponding interface too. A passive setting at either end prevents the relationship.

Reference: Cisco IOS XE default passive interfaces.

Practise LAN and transit behaviour on R1

This companion lab switches to the OSPF overview's R1 topology. Use R1 Gi0/0 for LAN 1 and Gi0/1 towards R2; the earlier R2 Gi0/2 commands belong to the lesson above. This practice link uses broadcast OSPF, with R2 as DR.

Network statements select interfaces; passive controls Hellos
Network statements select interfaces; passive controls HellosOn R1, network 192.168.1.0 0.0.0.255 area 0 selects Gi0/0 at 192.168.1.1/24, made passive. Network 10.0.12.0 0.0.0.3 area 0 selects active Gi0/1 at 10.0.12.1/30. Gi0/2 at 203.0.113.2/30 is not selected; it reaches the ISP. Wildcards do not change interface subnet masks.network 192.168.1.0 0.0.0.255 area 0network 10.0.12.0 0.0.0.3 area 0R1Gi0/0 · 192.168.1.1/24LAN: advertise prefix, no HellosSelected + passiveGi0/1 · 10.0.12.1/30Transit: Hellos and neighboursSelected + activeGi0/2 · 203.0.113.2/30ISP: no OSPF participationNot selected
This diagram maps configuration to interfaces, rather than packet movement. An operational passive LAN is advertised through OSPF neighbours on active interfaces. The ISP interface is excluded; a separate static default may still use it.

Success means the LAN stays passive while the router link stays active. Open the guided exercise below to compare both settings yourself.

Simulated R1 terminal. Type supported IOS commands and inspect the result. R2 and R3 are preconfigured. Outputs are simplified teaching examples, not responses from real equipment. Changes last until reset or page reload.

R1 is ready. Try show ip ospf neighbor, or ? for help.

One command at a time. Enter runs it; ↑ and ↓ recall recent commands. Use ? for help in the current mode.

R1 reference: 10000 Mbps · transit: active · LAN: passive

Ready. Type a command and press Enter.

Try a guided troubleshooting exercise
  1. Run show ip ospf interface Gi0/0. LAN 1 is OSPF-enabled but passive: no Hellos, no neighbours, and its prefix remains advertised.
  2. Enter enable, configure terminal, then router ospf 1.
  3. Try no passive-interface Gi0/0, then do show ip ospf interface Gi0/0. Hellos are enabled, but no neighbour appears: this LAN contains end devices only.
  4. Restore passive-interface Gi0/0. Check do show ip ospf neighbor: R2 remains Full over the separate Gi0/1 transit link.
  5. Make the wrong interface passive with passive-interface Gi0/1. Compare do show ip route ospf and do ping 10.0.12.2: learned routes disappear, but the directly connected peer still answers.
  6. Recover with no passive-interface Gi0/1. Verify the neighbour and remote routes return. The desired policy is LAN passive, transit active.

Test yourself on passive interfaces

Predict · scenario 1

R2's OSPF-enabled Gi0/2 (LAN 2, 192.168.2.0/24) is made passive; its R1 adjacency remains Full. What happens to R1's route to 192.168.2.0/24?

Predict · scenario 2

R2 has passive-interface default and no non-passive exceptions. After the change has taken effect, how many OSPF neighbours does it have?

Predict · scenario 3

Where do you type passive-interface GigabitEthernet0/2?

Predict · scenario 4

Which interface in the lab should NOT be passive?