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.

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.

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.

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.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions