Skip to content

Instantly share code, notes, and snippets.

@elnappo
Last active January 1, 2016 14:49
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 elnappo/8159765 to your computer and use it in GitHub Desktop.
Save elnappo/8159765 to your computer and use it in GitHub Desktop.
Get your IPv4, IPv6 and hostname
#!/usr/bin/env bash
ipv4=$(curl -s ipv4.icanhazip.com)
echo IPv4: $ipv4
hostname_ipv4=$(dig +noall +answer +short -x $ipv4)
echo rDNS: $hostname_ipv4
ipv6=$(curl -s ipv6.icanhazip.com)
echo IPv6: $ipv6
hostname_ipv6=$(dig +noall +answer +short -x $ipv6)
echo rDNS: $hostname_ipv6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment