How do I find out what my external IP address is?

后端 未结 13 1146
我寻月下人不归
我寻月下人不归 2020-12-13 04:15

My computers are sitting behind a router/firewall. How do I programmatically find out what my external IP address is. I can use http://www.whatsmyip.org/ for ad-hoc queries,

13条回答
  •  一整个雨季
    2020-12-13 04:35

    Since this question was asked a while back, there's now a freely available web service designed specifically to allow you to determine your IP address programmatically, called ipify.

    $ curl 'https://api.ipify.org?format=json'
    

    Results in

    {"ip": "1.2.3.4" /* your public IP */}
    

提交回复
热议问题