Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Created October 2, 2025 15:03
Show Gist options
  • Select an option

  • Save ThinGuy/260839e03e38daf1c24497f03b0457d4 to your computer and use it in GitHub Desktop.

Select an option

Save ThinGuy/260839e03e38daf1c24497f03b0457d4 to your computer and use it in GitHub Desktop.
Get ipinfo of an FQDN
# prereqs: dnsutils jq
# sudo apt install jq dnsutils -y
geoip() {
dig +short ${@}| \
xargs -rn1 -P1 bash -c \
'curl -sSlL ipinfo.io/${0}|jq -r '"'"'"\(.hostname)\n\(.ip)\n\(.city)\n\(.region)\n\(.country)"'"'"'|paste -sd,'|\
sort -t, -k5V
};export -f geoip
@ThinGuy
Copy link
Author

ThinGuy commented Oct 2, 2025

craigbender@cbpc:~$ geoip canonical.com
website-content-cache-1.ps5.canonical.com,185.125.190.20,London,England,GB
website-content-cache-2.ps5.canonical.com,185.125.190.21,London,England,GB
website-content-cache-3.ps5.canonical.com,185.125.190.29,London,England,GB

craigbender@cbpc:~$ geoip archive.ubuntu.com
actiontoad.canonical.com,185.125.190.36,London,England,GB
aerodent.canonical.com,185.125.190.39,London,England,GB
ubuntu-mirror-1.ps5.canonical.com,185.125.190.81,London,England,GB
ubuntu-mirror-2.ps5.canonical.com,185.125.190.82,London,England,GB
ubuntu-mirror-3.ps5.canonical.com,185.125.190.83,London,England,GB
ubuntu-mirror-1.ps6.canonical.com,91.189.91.81,Boston,Massachusetts,US
ubuntu-mirror-2.ps6.canonical.com,91.189.91.82,Boston,Massachusetts,US
ubuntu-mirror-3.ps6.canonical.com,91.189.91.83,Boston,Massachusetts,US

craigbender@cbpc:~$ geoip us.archive.ubuntu.com
ubuntu-mirror-1.ps6.canonical.com,91.189.91.81,Boston,Massachusetts,US
ubuntu-mirror-2.ps6.canonical.com,91.189.91.82,Boston,Massachusetts,US
ubuntu-mirror-3.ps6.canonical.com,91.189.91.83,Boston,Massachusetts,US

craigbender@cbpc:~$ geoip esm.ubuntu.com
esm-content-cache-1.ps5.canonical.com,185.125.190.23,London,England,GB
esm-content-cache-2.ps5.canonical.com,185.125.190.24,London,England,GB
esm-content-cache-3.ps5.canonical.com,185.125.190.75,London,England,GB
guppy.canonical.com,91.189.91.46,Boston,Massachusetts,US
hollykoopa.canonical.com,91.189.91.47,Boston,Massachusetts,US

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