Skip to content

Conversation

@cbaugus
Copy link

@cbaugus cbaugus commented Sep 5, 2025

Summary

  • Added support for GCP (Google Cloud Platform) subnet mode to the Visual Subnet Calculator
  • GCP reserves 4 IP addresses per subnet according to their VPC documentation
  • Implemented proper address calculation and validation for GCP subnets

Details

This PR adds GCP mode alongside the existing AWS, Azure, and OCI modes. According to Google Cloud VPC documentation, GCP reserves 4 addresses in each subnet:

  1. Network address (first address in range)
  2. Default gateway (second address in range)
  3. Reserved for future use (second-to-last address in range)
  4. Broadcast address (last address in range)

Changes Made:

  • Added "Mode - GCP" option to the Tools dropdown menu in dist/index.html
  • Implemented GCP-specific logic in dist/js/main.js:
    • Set minimum subnet size to /29
    • Added validation patterns for GCP mode
    • Updated subnet_usable_first() and subnet_usable_last() functions to correctly calculate usable IP ranges
    • Added GCP-specific error messages with documentation links
    • Added GCP mode to all relevant switch statements
  • Updated README.md to document GCP mode and its reserved addresses

Testing

The implementation correctly:

  • Enforces minimum subnet size of /29
  • Reserves the first 2 and last 2 addresses in each subnet
  • Displays accurate usable IP ranges when GCP mode is selected
  • Shows appropriate error messages with links to GCP documentation

Test Plan

  • Switch to GCP mode from the Tools dropdown
  • Verify minimum subnet size /29 is enforced
  • Confirm correct calculation of usable IPs (total IPs - 4 reserved)
  • Test subnet splitting respects the /29 minimum
  • Verify error messages display correctly with working documentation links

Implements GCP subnet mode which reserves 4 addresses per subnet according to Google Cloud VPC documentation:
- Network address (first address)
- Default gateway (second address)
- Reserved for future use (second-to-last address)
- Broadcast address (last address)

Changes:
- Added GCP mode to the Tools dropdown menu
- Configured minimum subnet size as /29 for GCP
- Updated address calculation logic to reserve correct addresses
- Added appropriate validation and error messages
- Updated documentation in README.md
- Included links to official GCP documentation

This aligns with GCP's subnet requirements as documented at:
https://cloud.google.com/vpc/docs/subnets#unusable-ip-addresses-in-every-subnet
@cbaugus
Copy link
Author

cbaugus commented Sep 8, 2025

@ckabalan can you please review this PR?

@ckabalan
Copy link
Owner

Hey thanks for your patience. I've been focusing on family the last few weeks. I'll take a look at this.

@cbaugus
Copy link
Author

cbaugus commented Sep 22, 2025

Hey thanks for your patience. I've been focusing on family the last few weeks. I'll take a look at this.

Thanks I have a copy running in my Lab but want to share with others https://visualsubnetcalc.edge.baugus-lab.com/#

@cbaugus
Copy link
Author

cbaugus commented Nov 9, 2025

Any update on this review?

@cbaugus
Copy link
Author

cbaugus commented Dec 22, 2025

@ckabalan any update on this PR it would be supper handy to have for out use case of splitting networks in GCP regions and projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants