Skip to content

Commit

Permalink
Add interface names to myip, improve external lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrady committed Dec 15, 2016
1 parent d9d295a commit f469b5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions myip
@@ -1,4 +1,4 @@
#!/bin/sh
ifconfig | grep 'inet ' | grep -v 127.0.0.1 | awk '{ print $2 }'

dig +short myip.opendns.com @resolver1.opendns.com
ifconfig | ruby -n -e '$line=$_.chomp; $iface=$1 if $line=~/^([\S]+):/; puts "%8s: %s" % [$iface, $1] if $line =~ /inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/'
#echo External: `dig +short myip.opendns.com @resolver1.opendns.com`
echo External: `curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'`

0 comments on commit f469b5c

Please sign in to comment.