visualsubnetcalc icon indicating copy to clipboard operation
visualsubnetcalc copied to clipboard

Add GCP (Google Cloud Platform) mode support

Open cbaugus opened this issue 3 months ago • 4 comments

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

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

cbaugus avatar Sep 05 '25 15:09 cbaugus

@ckabalan can you please review this PR?

cbaugus avatar Sep 08 '25 13:09 cbaugus

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

ckabalan avatar Sep 16 '25 04:09 ckabalan

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 avatar Sep 22 '25 15:09 cbaugus

Any update on this review?

cbaugus avatar Nov 09 '25 03:11 cbaugus