Subnet Mask vs Wild Card Mask

Subnet Mask vs Wild Card Mask 

Subnet Mask vs Wild Card Mask

 1. Subnet Mask

A subnet mask is a key element in IP networking used to determine which part of an IP address belongs to the network and which part identifies a host within that network. It works by "masking" the network portion of the IP address.

  • Like an IP address, a subnet mask consists of 32 bits for IPv4 and is usually represented in dotted decimal format (e.g., 255.255.255.0).
  • Subnet masks help divide large networks into smaller subnetworks, enhancing routing efficiency.
  • A subnet mask is composed of contiguous 1s followed by contiguous 0s.
  • The 1s represent the network portion of the address, while the 0s represent the host portion.
  • For an IPv4 address 192.168.10.100, with a subnet mask of 255.255.255.0

In binary:

IP address : 11000000.10101000.00001010.01100100
Subnet Mask: 11111111.11111111.11111111.00000000

Here, the first 24 bits (192.168.10) represent the network, and the last 8 bits (100) represent the host. The subnet mask allows devices to:
  • Identify their own network segment.
  • Determine whether another device is within the same network or needs routing.
  • Class A: 255.0.0.0 or /8
  • Class B: 255.255.0.0 or /16
  • Class C: 255.255.255.0 or /24

 2. Wildcard Mask

Wildcard masks are primarily used in network configurations on devices like routers for access control or in routing protocols such as OSPF (Open Shortest Path First). They complement subnet masks by performing matching and filtering tasks.
  • Wildcard masks are the inverse of subnet masks.
  • While a subnet mask indicates the fixed network part (1s) and host part (0s), a wildcard mask does the opposite — it identifies bits to ignore rather than match.
  • Wildcard masks use 0s to indicate that bits must match and 1s to indicate bits can vary.
  • For example, if the subnet mask is 255.255.255.0, its wildcard mask is 0.0.0.255.

In binary:

Given an IP address 192.168.10.100 with a subnet mask 255.255.255.0:
Subnet Mask (binary): 11111111.11111111.11111111.00000000
Wildcard Mask (binary): 00000000.00000000.00000000.11111111

Matching bits: 0s in the wildcard mask mean those bits must exactly match.
Ignored bits: 1s in the wildcard mask mean those bits can vary.

Where we are using wild card mask