The network command activates a routing protocol on router interfaces whose IP addresses match a specified range. Matching interfaces advertise their network prefixes to neighbors. For OSPF, enter router configuration mode with router ospf process-id, then use network ip-address wildcard-mask area area-id. section 17.4 section 17.5
Read the wildcard mask as a bit-by-bit matching rule:
- A 0 bit requires the corresponding bits in the command address and interface address to match. section 17.5
- A 1 bit allows the corresponding bits to differ, so the command can select an address range rather than one subnet. section 17.4 section 17.5
- The wildcard mask resembles an inverted netmask: 255.255.255.0 corresponds to 0.0.0.255, while /30 corresponds to 0.0.0.3. section 17.5
- Use area 0 in these OSPF examples; the process ID identifies the OSPF process entered before router configuration. section 17.4
Selecting several interfaces
R1(config)# router ospf 1 R1(config-router)# network 192.168.1.0 0.0.0.7 area 0 R1(config-router)# network 192.168.2.1 0.0.0.0 area 0 The first command matches interfaces at 192.168.1.1 and 192.168.1.5 because the final three bits may vary. The second matches only the interface at 192.168.2.1 because every bit must match.
