NAT Source Range Doesn't Cover Full Internal Network

Advanced Troubleshoot

Question

An organization has internal network 172.16.0.0/16. The NAT rule on the firewall translates source addresses 172.16.0.0/24 to the external IP 203.0.113.1. Hosts in 172.16.1.0 through 172.16.255.255 cannot access the internet. Identify the misconfiguration and explain which hosts are affected.

Given

{
  "internal": "172.16.0.0/16",
  "nat_source": "172.16.0.0/24",
  "external": "203.0.113.1"
}

Answer

{
  "problem": "NAT source only covers /24 (256 addresses) but internal network is /16 (65,536 addresses)",
  "hosts_covered": 254,
  "total_internal_hosts": 65534,
  "affected_range": "172.16.1.0 - 172.16.255.255",
  "affected_hosts": 65280,
  "fix": "Change NAT source from 172.16.0.0/24 to 172.16.0.0/16 to cover the full internal range"
}

Try to solve it first, then click Reveal Answer

Step-by-Step Explanation

Step 1: Understand what the current NAT rule covers

Current NAT source: 172.16.0.0/24 - /24 = 256 addresses - Covers: 172.16.0.0 – 172.16.0.255 - Translates to: 203.0.113.1 (source NAT / masquerade)

Step 2: Identify the full internal range

Internal network: 172.16.0.0/16 - /16 = 65,536 addresses - Range: 172.16.0.0 – 172.16.255.255 - Usable: 172.16.0.1 – 172.16.254.254 (65,534 hosts)

Step 3: Calculate uncovered hosts

Covered by NAT (/24): 172.16.0.0 – 172.16.0.255 (256 addresses) NOT covered by NAT: 172.16.1.0 – 172.16.255.255 (65,280 addresses)

Affected hosts: 65,534 - 254 = 65,280 hosts cannot reach the internet.

Step 4: What happens to uncovered hosts

When a host at 172.16.50.100 sends a packet to the internet: 1. Packet arrives at firewall with source 172.16.50.100 2. Firewall checks NAT rules: does 172.16.50.100 match 172.16.0.0/24? → NO 3. No NAT translation occurs 4. Packet forwarded with private source IP 172.16.50.100 5. Internet router drops packet (RFC 1918 address not routable on internet) 6. Host receives no reply → connection timeout

Step 5: Fix the NAT rule

On a Linux/iptables firewall:

# Remove incorrect rule
iptables -t nat -D POSTROUTING -s 172.16.0.0/24 -j MASQUERADE

# Add correct rule covering full /16
iptables -t nat -A POSTROUTING -s 172.16.0.0/16 -j MASQUERADE

# Save
iptables-save > /etc/iptables/rules.v4

On Cisco ASA:

# Remove old NAT
no nat (inside,outside) source static 172.16.0.0 255.255.255.0 interface

# Add correct NAT for full /16
nat (inside,outside) source dynamic 172.16.0.0 255.255.0.0 interface

On pfSense/OPNsense: Navigate to Firewall → NAT → Outbound → Edit rule Change Source: 172.16.0.0/24 → 172.16.0.0/16

Step 6: Verify

# From a host in 172.16.50.x — should now work
curl -4 https://ifconfig.me
# Should return 203.0.113.1 (the NAT external IP)

# From 172.16.0.x — should still work
curl -4 https://ifconfig.me

Key lesson

Always match your NAT source range exactly to your internal network range. A /24 NAT rule for a /16 network is a common misconfiguration that silently breaks internet access for 99.6% of hosts.

Related Terms

More Troubleshoot Worksheets