Skip to content

Instantly share code, notes, and snippets.

@justinholmes
Created March 5, 2018 16:47
Show Gist options
  • Save justinholmes/78de0d095d2502257246872f84e40db1 to your computer and use it in GitHub Desktop.
Save justinholmes/78de0d095d2502257246872f84e40db1 to your computer and use it in GitHub Desktop.
Script to get Google Cloud IPv4 external address blocks
dig TXT _cloud-netblocks{1..6}.googleusercontent.com +short | grep ip4 | awk -F 'ip4:' '{for (i=2; i<=NF; i++) print $i}' | sed 's/\?all//g' | sed 's/ip6:.*//g'| sed 's/\"//g' | sed 's/^ *//;s/ *$//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment