Reputation: 21
I need to write a shell script for the purpose of unblocking the current ip from a server. The script must run on mac os.
The script is finished i just need to get the right ip adress, the one i connect to the internet with. If a hit 'ipconfig getifaddr en0' in the console i get the following adress: 127.168.X.XXX. But when I use a service like 'whatismyip.com' im getting 87.188.XXX.XXX. This is the one I need to get in the console.
Any ideas on which command i could use to get the right ip?
Thanks on advance.
Upvotes: 1
Views: 504
Reputation: 628
You are tying to find out your external ip address. If you have curl
installed on your system, the quickest way is to use:
curl ifconfig.co
That will return the ip you are looking for.
Upvotes: 2