Skip to content

Instantly share code, notes, and snippets.

@zipall
zipall / wanip.sh
Last active October 5, 2020 05:57
Get external IP address
#!/bin/sh
# get external IP address
# via opendns
# used for outgoing Internet connections
# METHOD can be: dns (default), http, https, ftp, telnet
case "$1" in
""|dns) dig +short myip.opendns.com @resolver1.opendns.com ;;
http) curl -s http://whatismyip.akamai.com/ && echo ;;