Courseiva
OSPFRouter Config

network [ip] [wildcard] area [area]

Enables OSPF on an interface by specifying the network prefix and wildcard mask, assigning it to a specific OSPF area.

Definition: network [ip] [wildcard] area [area] is a Cisco IOS router config command. Enables OSPF on an interface by specifying the network prefix and wildcard mask, assigning it to a specific OSPF area.

Overview

The 'network' command in OSPF router configuration mode is the primary method for enabling OSPF on interfaces in Cisco IOS. It specifies which interfaces participate in the OSPF process by matching the interface IP address against a network prefix and wildcard mask, and assigns those interfaces to a specific OSPF area. This command is fundamental because OSPF is a link-state routing protocol that requires interfaces to be explicitly enabled; without it, no OSPF adjacencies form and no routes are exchanged.

The concept behind the command is that OSPF operates on a per-interface basis, and the network statement acts as a filter: any interface whose IP address falls within the range defined by the network and wildcard mask will have OSPF enabled on it and will be placed in the specified area. This allows engineers to enable OSPF on multiple interfaces with a single statement (e.g., using a summary address like 10.0.0.0 0.255.255.255 to cover all subnets in the 10.0.0.0/8 range) or to be very specific (e.g., 192.168.1.0 0.0.0.255 for a single subnet). The wildcard mask is the inverse of a subnet mask; a common mistake is using a subnet mask instead of a wildcard mask.

The command fits into the broader OSPF configuration workflow: after enabling OSPF with 'router ospf [process-id]', you use the 'network' command to define which interfaces run OSPF and in which area. Alternatively, in later IOS versions (15.x+), you can use the 'ip ospf [process-id] area [area]' interface-level command, which is often preferred for granular control. The 'network' command is still widely used in legacy configurations and for enabling OSPF on many interfaces at once.

Important IOS behavior: the 'network' command is stored in the running configuration as entered; if you use a wildcard mask that covers multiple interfaces, all matching interfaces are enabled. The command requires privilege level 15 (enable mode) to enter global configuration and then router configuration mode. It does not produce immediate output; its effect is seen in the OSPF database and neighbor relationships.

The command can be removed with 'no network [ip] [wildcard] area [area]'. When troubleshooting, verifying the 'show ip ospf interface' command confirms which interfaces are enabled. The command is available in all IOS versions from 12.x onward, including IOS-XE, but not in NX-OS (which uses 'interface' configuration with 'ip router ospf [process-id] area [area]').

Understanding this command is critical for CCNA and CCNP candidates as it appears in both configuration and troubleshooting scenarios.

Syntax·Router Config
network [ip] [wildcard] area [area]

When to Use This Command

  • Advertise a directly connected subnet into OSPF, such as 192.168.1.0/24, to allow neighbor discovery and route sharing.
  • Enable OSPF on multiple interfaces with a single network statement using a wildcard mask, e.g., 10.0.0.0 0.255.255.255 area 0.
  • Place a specific loopback interface into OSPF area 0 to advertise it as a router ID or for management purposes.
  • Configure OSPF on a point-to-point link between two routers, using the exact subnet and wildcard mask to avoid enabling OSPF on unintended interfaces.

Parameters

ParameterSyntaxDescription
ipA.B.C.DThe network prefix (IP address) that, combined with the wildcard mask, defines the range of interface IP addresses to enable OSPF on. Typically this is the network address of a subnet (e.g., 10.0.1.0 for the 10.0.1.0/24 subnet). A common mistake is using a host IP address instead of the network address; while it may work if the wildcard mask is 0.0.0.0, it is not best practice.
wildcardA.B.C.DThe wildcard mask that determines which bits of the IP address must match. It is the inverse of a subnet mask: bits set to 0 must match exactly, bits set to 1 are ignored. For example, 0.0.0.255 matches any host in a /24 subnet. A common mistake is using a subnet mask (e.g., 255.255.255.0) instead of a wildcard mask (0.0.0.255), which will cause the command to be rejected or produce unexpected results.
area<0-4294967295> or A.B.C.DThe OSPF area to which the matching interfaces will be assigned. Can be specified as a decimal number (0 to 4294967295) or in dotted-decimal format (e.g., 0.0.0.0 for area 0). Area 0 is the backbone area; all other areas must connect to area 0. A common mistake is using area 0 for non-backbone links or forgetting that area numbers must be consistent across routers for adjacency to form.

Command Examples

Basic OSPF network statement for a single subnet

network 192.168.1.0 0.0.0.255 area 0
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config-router)#

The command enables OSPF on any interface whose IP address falls within 192.168.1.0/24 (wildcard 0.0.0.255 matches the last octet). The interface is placed into OSPF area 0 (backbone area). No output is shown if successful; use 'show ip ospf interface' to verify.

Using a wildcard mask to match multiple subnets

network 10.0.0.0 0.255.255.255 area 0
Router(config-router)# network 10.0.0.0 0.255.255.255 area 0
Router(config-router)#

This command matches any interface with an IP address starting with 10.x.x.x (wildcard 0.255.255.255 ignores the last three octets). All such interfaces are enabled for OSPF in area 0. Use with caution as it may enable OSPF on unintended interfaces.

Understanding the Output

The 'network' command itself produces no output on success; it simply configures OSPF. To verify, use 'show ip ospf interface' which lists interfaces enabled for OSPF, their area, state (e.g., DR/BDR/DROTHER), and neighbor count. A correctly configured interface will show 'OSPF enabled' and the area number.

If an interface is not listed, the network statement may not match its IP address. Also check 'show ip protocols' to see the list of networks being advertised. In a real network, ensure the wildcard mask is correct: it is the inverse of the subnet mask (e.g., 0.0.0.255 for /24).

A common mistake is using the subnet mask instead of wildcard, which will not match any interface.

Configuration Scenarios

Enable OSPF on a single subnet between two routers

Two routers, R1 and R2, are connected via a point-to-point link using subnet 10.0.12.0/30. OSPF must be enabled on both routers' interfaces in area 0 to exchange routes.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2

Steps

  1. 1.Step 1: Enter privileged EXEC mode on R1: enable
  2. 2.Step 2: Enter global configuration mode: configure terminal
  3. 3.Step 3: Enter OSPF router configuration mode: router ospf 1
  4. 4.Step 4: Enable OSPF on the interface matching 10.0.12.0/30 in area 0: network 10.0.12.0 0.0.0.3 area 0
  5. 5.Step 5: Exit configuration mode: end
  6. 6.Step 6: Repeat steps 1-5 on R2 with the same network statement.
Configuration
! R1 configuration
interface GigabitEthernet0/0
 ip address 10.0.12.1 255.255.255.252
!
router ospf 1
 network 10.0.12.0 0.0.0.3 area 0

Verify: Use 'show ip ospf neighbor' on either router. Expected output shows a FULL adjacency with the neighbor router ID. Example: Neighbor 2.2.2.2, interface GigabitEthernet0/0, state FULL.

Watch out: The wildcard mask 0.0.0.3 matches only the 10.0.12.0/30 subnet. If you mistakenly use 0.0.0.0, it would match only the exact IP address 10.0.12.0 (the network address), not the interface IPs 10.0.12.1 or 10.0.12.2, so OSPF would not enable on the interfaces.

Enable OSPF on multiple subnets with a single network statement

A router has several interfaces in the 10.0.0.0/8 range (e.g., 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24) all in area 0. Instead of writing three separate network statements, a single statement can cover all of them.

Topology

R1(Gi0/0)---10.0.1.0/24, R1(Gi0/1)---10.0.2.0/24, R1(Gi0/2)---10.0.3.0/24

Steps

  1. 1.Step 1: Enter privileged EXEC mode: enable
  2. 2.Step 2: Enter global configuration mode: configure terminal
  3. 3.Step 3: Enter OSPF router configuration mode: router ospf 1
  4. 4.Step 4: Use a single network statement with a wildcard mask that matches all 10.0.x.x subnets: network 10.0.0.0 0.255.255.255 area 0
  5. 5.Step 5: Exit configuration mode: end
Configuration
! R1 configuration
interface GigabitEthernet0/0
 ip address 10.0.1.1 255.255.255.0
!
interface GigabitEthernet0/1
 ip address 10.0.2.1 255.255.255.0
!
interface GigabitEthernet0/2
 ip address 10.0.3.1 255.255.255.0
!
router ospf 1
 network 10.0.0.0 0.255.255.255 area 0

Verify: Use 'show ip ospf interface brief' to see all interfaces enabled for OSPF. Expected output lists GigabitEthernet0/0, GigabitEthernet0/1, and GigabitEthernet0/2 with their IP addresses and OSPF area 0.

Watch out: Be careful with the wildcard mask: 0.255.255.255 matches any IP starting with 10. This could unintentionally enable OSPF on interfaces that should not run OSPF (e.g., a management interface with IP 10.0.100.1). Always verify which interfaces are enabled using 'show ip ospf interface'.

Troubleshooting with This Command

When troubleshooting OSPF adjacency issues, the 'network' command is often the first place to look. A healthy configuration shows that the intended interfaces are enabled for OSPF, as verified by 'show ip ospf interface'. For each interface, you should see 'OSPF enabled on interface' and the correct area.

Problem indicators include: 'OSPF not enabled on interface' (meaning no matching network statement), 'Area mismatch' (if the area on the neighbor is different), or 'Network type mismatch' (if the interface is not broadcast or point-to-point as expected). Common symptoms that the 'network' command helps diagnose include: no OSPF neighbors appearing, routes missing, or OSPF not running on an interface. A step-by-step diagnostic flow: 1) Check 'show ip ospf neighbor' – if no neighbors, proceed. 2) Check 'show ip ospf interface' for the specific interface – look for 'OSPF not enabled'. 3) If not enabled, review the 'network' statements in 'show running-config | section router ospf'. 4) Verify the interface IP address matches the network/wildcard pair.

For example, if the interface IP is 192.168.1.1/24 and the network statement is 'network 192.168.2.0 0.0.0.255 area 0', OSPF will not enable because the IP is in a different subnet. 5) Check for wildcard mask errors: using 255.255.255.0 instead of 0.0.0.255 will cause the command to be rejected or match nothing. 6) Ensure the area number matches on both sides; use 'show ip ospf interface' to see the configured area. 7) If the network statement is correct but OSPF still doesn't enable, check if the interface is administratively down or if there is an ACL blocking OSPF (protocol 89). Correlate with 'debug ip ospf hello' to see if hello packets are sent/received. The 'show ip ospf' command shows the OSPF process and router ID, but does not directly show network statements.

For deeper troubleshooting, 'show ip protocols' lists the networks being advertised under OSPF. Remember that the 'network' command only enables OSPF on the interface; it does not control route advertisement (that is handled by the 'passive-interface' command or 'default-information originate'). If OSPF is enabled but no routes are learned, check for passive interfaces or mismatched authentication.

In summary, the 'network' command is the gatekeeper for OSPF interface participation; verifying its correct application is essential for any OSPF troubleshooting.

CCNA Exam Tips

1.

Remember that the wildcard mask is the inverse of the subnet mask; for /24, use 0.0.0.255, not 255.255.255.0.

2.

The 'network' command must be entered under router ospf configuration mode; it is not a global config command.

3.

CCNA exam may test that OSPF only enables on interfaces matching the network statement; mismatched wildcard masks are a common trick.

4.

You can use multiple network statements for different subnets or areas; the most specific match takes precedence.

Common Mistakes

Using the subnet mask instead of wildcard mask (e.g., 255.255.255.0 instead of 0.0.0.255), causing no interfaces to match.

Forgetting to enter router ospf configuration mode before issuing the network command.

Using a network statement that is too broad (e.g., 0.0.0.0 255.255.255.255) which enables OSPF on all interfaces, potentially causing security issues.

network [ip] [wildcard] area [area] vs router ospf [process-id]

The 'network' and 'router ospf' commands are often confused because both are essential for OSPF configuration but serve different roles: 'router ospf' enables the OSPF process globally, while 'network' assigns specific interfaces to OSPF areas. Understanding their distinct functions is critical for correct OSPF deployment.

Aspectnetwork [ip] [wildcard] area [area]router ospf [process-id]
ScopeInterface-specific (advertises matching interfaces)Global (enables OSPF process on the router)
Configuration modeRouter configuration modeGlobal configuration mode
Effect on OSPF processDoes not enable OSPF; only advertises interfacesEnables OSPF and enters OSPF configuration context
Persistence in configPersists as part of OSPF configurationPersists as OSPF process definition
Typical useDefine which interfaces participate in OSPF and assign areasInitialize OSPF and set global parameters like router-id

Use network [ip] [wildcard] area [area] when you have already enabled OSPF and need to advertise specific interfaces or networks into an OSPF area.

Use router ospf [process-id] when you need to enable OSPF routing on the router, create an OSPF process, and enter the configuration mode to define OSPF parameters.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches), the 'network' command syntax is identical to classic IOS. However, IOS-XE also supports the interface-level 'ip ospf [process-id] area [area]' command, which is often recommended for newer designs. The output of 'show ip ospf interface' may include additional fields like 'BFD' or 'Fast Hello' in newer versions.

In NX-OS (e.g., Nexus switches), the 'network' command does not exist. Instead, OSPF is enabled on interfaces using the interface configuration command 'ip router ospf [process-id] area [area]'. For example: 'interface Ethernet1/1; ip router ospf 1 area 0'.

NX-OS also uses the 'router ospf [process-id]' command to enter OSPF configuration, but there is no 'network' statement. In ASA firewalls, OSPF configuration is similar to IOS but uses the 'router ospf [process-id]' command followed by 'network [ip] [mask] area [area]' where the mask is a subnet mask (not wildcard). For example: 'network 10.0.0.0 255.255.255.0 area 0'.

This is a key difference: ASA uses a subnet mask, not a wildcard mask. In IOS-XR, the equivalent is the 'router ospf [process-id]' configuration, and OSPF is enabled on interfaces using the 'interface [type] [instance]' command with 'router ospf [process-id] area [area]'. There is no 'network' command in IOS-XR.

Between IOS versions, the 'network' command behavior is consistent from 12.x to 16.x, but in 15.x and later, the interface-level command is preferred for granularity. Always check the specific platform documentation, as some older IOS versions (12.0) may have quirks with wildcard masks in certain scenarios.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions