What Is a /32 CIDR Prefix (255.255.255.255) in Firewall Rules & Routing?
An IPv4 /32 CIDR block locks all 32 bits of the address (binary 11111111.11111111.11111111.11111111, subnet mask 255.255.255.255, wildcard mask 0.0.0.0), leaving 0 host bits (2^0 = 1 exact IPv4 address). Rather than defining a shared broadcast LAN, a /32 prefix represents a single-host route or exact IP match.
Whenever you whitelist a single static office IP in an AWS Security Group, Cloudflare WAF rule, PostgreSQL pg_hba.conf entry, nginx allow directive, OSPF/BGP router loopback interface (lo0), or WireGuard AllowedIPs peer configuration, you must append /32 (for example, 203.0.113.42/32) so the CIDR parser matches that exact host IP and no neighboring addresses.
- Exact Single-IP Matching (Wildcard 0.0.0.0): Every bit must match; zero neighboring addresses are included in the range.
- Router Loopbacks & Anycast VIPs: BGP and OSPF advertise /32 host routes for router loopbacks and global Anycast virtual IPs.
Using /32 Host Routes in WireGuard VPNs, BGP Loopbacks & pg_hba.conf
In modern point-to-point overlay networks such as WireGuard, Tailscale, and Calico eBPF Kubernetes dataplanes, each peer or container pod is assigned a /32 address in AllowedIPs (e.g., AllowedIPs = 10.8.0.4/32). Because Cryptokey Routing maps each /32 destination directly to a peer public key without requiring virtual Ethernet broadcast ARP tables, packets route with zero L2 overhead.
Similarly, in Longest Prefix Match (LPM) routing tables, a /32 host route always takes precedence over any overlapping /24, /16, or 0.0.0.0/0 default route—making /32 injection the standard mechanism for BGP blackhole DDoS mitigation (RTBH) and floating high-availability virtual IPs (Keepalived / VRRP).
- WireGuard AllowedIPs & PostgreSQL pg_hba.conf: Specify host all all 203.0.113.42/32 scram-sha-256 in pg_hba.conf to authorize a single application server IP.
- Longest Prefix Match (LPM) Priority: Because 32 is the maximum IPv4 prefix length, a /32 route overrides every broader subnet route in the kernel FIB.
Practical Real-World Use Cases
Security and infrastructure engineers use /32 host notation daily to lock down access controls and point-to-point overlays:
- SSH, RDS & Admin Bastion Allowlisting in Cloud Firewalls: Authorize a single static office WAN IP or VPN egress NAT IP (e.g., 203.0.113.42/32) on port 22/5432 in AWS Security Groups, Cloudflare WAF, and pg_hba.conf.
- WireGuard & Tailscale Peer-to-Peer Cryptokey Routing: Assign exact /32 client tunnel addresses in WireGuard [Peer] AllowedIPs blocks so traffic for each laptop or server routes strictly to its Curve25519 key.
- BGP Router Loopbacks, Anycast DNS VIPs & RTBH Mitigation: Advertise resilient /32 loopback and Anycast service VIPs across ECMP paths, or inject /32 blackhole routes during volumetric DDoS incidents.
Frequently Asked Questions
When do I need to add /32 to an IP address in AWS Security Groups or pg_hba.conf?
Both AWS Security Groups and PostgreSQL pg_hba.conf require CIDR notation rather than bare IP addresses. Appending /32 (e.g., 203.0.113.42/32) tells the firewall to allow traffic only from that single IPv4 host.
What is the subnet mask and wildcard mask for /32?
The subnet mask for /32 is 255.255.255.255 (all 32 bits set to 1) and the wildcard mask is 0.0.0.0.