Resize subnets and maintain outbound connectivity
The primary range 10.40.4.0/24 is full. A neighboring subnet occupies 10.40.5.0/24. Can the first subnet expand to 10.40.4.0/23?
Resize subnets and maintain outbound connectivity
Expand an exhausted subnet’s primary IPv4 range with a shorter prefix after checking for overlap.
Work through the decision
The primary range 10.40.4.0/24 is full. A neighboring subnet occupies 10.40.5.0/24. Can the first subnet expand to 10.40.4.0/23?
Check your reasoning
The proposed /23 contains both /24s. Choose a non-overlapping allocation or redesign the address plan before requesting the change. Expansion consumes contiguous address space.
Interpret the evidence
- Subnet expansion
- A shorter prefix grows an existing primary IPv4 range when the larger aligned range is available.
- Cloud NAT
- Allows eligible instances without external IPv4 addresses to start outbound connections and receive their replies.
- Cloud DNS private zone
- Publishes names only to authorized networks. Check visibility and the requested suffix.
- Reserved static address
- A reservation allows an address to persist beyond the lifetime of a particular resource.
- Custom static route
- Specifies a destination prefix and eligible next hop for traffic matching the route.
Practice the guide skills
- Write the old and proposed primary prefixes as address intervals. Verify containment, regional scope and lack of overlap before expansion.
- Compare reserving a regional internal address with promoting an ephemeral external address. Record which resource must keep the IP after recreation.
- Trace a destination through candidate routes, next hop and effective firewall policy. Check priority, direction, tag membership and logs.
- Separate private DNS visibility from egress translation. Check DNS answers, route, NAT coverage and flow direction for a VM without an external IP.
Official objectives for this lesson
Lab · test a subnet expansion before allocating it
The change request lists a candidate supernet and all neighboring allocations in the VPC. Run this Python 3 model locally, then compare the evidence for the two proposed ranges. It uses only the standard library.
from ipaddress import ip_network
allocations = {
"analytics": ip_network("10.40.4.0/24"),
"ingest": ip_network("10.40.5.0/24"),
"workers": ip_network("10.40.8.0/24"),
}
def preview(owner, proposed):
current = allocations[owner]
target = ip_network(proposed)
if target == current or not current.subnet_of(target):
return "rejected: new range must strictly contain the old range"
conflicts = [name for name, block in allocations.items()
if name != owner and target.overlaps(block)]
if conflicts:
return "overlap with " + ", ".join(sorted(conflicts))
return f"available in this plan: {target.num_addresses} total addresses"
print("analytics:", preview("analytics", "10.40.4.0/23"))
print("workers:", preview("workers", "10.40.8.0/23"))
Check the result
analytics: overlap with ingest workers: available in this plan: 512 total addresses
Add an allocation at 10.40.9.128/25 and rerun. The workers expansion now overlaps it. The model counts all addresses; Google Cloud reserves addresses within primary ranges. Before an actual resize, check connected networks and the full project inventory.
Related lesson · Fit the transfer to the volume and cutover window
Resize subnets and maintain outbound connectivity quiz
Answer 3 questions. Check each answer for an explanation.
Worked example · Resize subnets and maintain outbound connectivity