Skip to content

Instantly share code, notes, and snippets.

@algermissen
Last active June 25, 2019 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save algermissen/6a2c1c3fcf6cbf41e59401a18be707cd to your computer and use it in GitHub Desktop.
Save algermissen/6a2c1c3fcf6cbf41e59401a18be707cd to your computer and use it in GitHub Desktop.
List primary and secondary range of a GCP VPC
gcloud beta container subnets list-usable --project myproject --format json | \
jq '.[] | select(.network | endswith("mynetwork")) | .ipCidrRange ' -r | \
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
10.0.0.0/24
10.0.1.0/27
10.0.1.32/27
10.0.1.64/27
10.0.1.96/27
gcloud beta container subnets list-usable --project myproject --format json | \
jq '.[] | select(.network | endswith("mynetwork")) | .secondaryIpRanges[].ipCidrRange ' -r | \
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
10.128.0.0/27
10.128.0.32/27
10.128.0.64/27
10.128.0.96/27
10.128.0.128/27
10.128.0.160/27
10.128.0.192/27
10.128.0.224/27
10.128.1.0/24
10.128.2.0/24
10.128.3.0/24
10.128.4.0/24
10.128.5.0/24
10.128.6.0/24
10.128.7.0/24
10.128.8.0/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment