Last active
July 7, 2024 10:38
-
-
Save sylvaincombes/b9cfd90ba47655048a6f to your computer and use it in GitHub Desktop.
View your external ip from linux / unix shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# with dig (fastest way) | |
dig +short myip.opendns.com @resolver1.opendns.com; | |
# alternative | |
dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}'; | |
###################################################################################################### | |
## Other method with curl / get and 3rd party, this choice is less judicious | |
###################################################################################################### | |
# with curl | |
curl ipinfo.io/ip; | |
# alternatives | |
curl ifconfig.me; | |
curl ifconfig.me/all; | |
curl icanhazip.com; | |
curl ipecho.net/plain; | |
curl ifconfig.co; | |
# with GET | |
GET ipinfo.io/ip; | |
# alternatives | |
GET ifconfig.me; | |
GET ifconfig.me/all; | |
GET icanhazip.com | |
GET ipecho.net/plain | |
GET ifconfig.co |
curl -4 ifconfig.me # to get ipv4 adress
curl -6 ifconfig.me # to get ipv6 adress
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regarding "ipecho.net"
Source (as of 2023-08)