要获取NAT之后的外网IP地址,可以用浏览器打开www.ip138.com。如果在shell里,可以用下面的方法:
$ curl ifconfig.me
$ curl ifconfig.me | ⇒ | |
$ curl ifconfig.me/ip | ⇒ | |
$ curl ifconfig.me/host | ⇒ | |
$ curl ifconfig.me/ua | ⇒ | |
$ curl ifconfig.me/port | ⇒ | |
$ curl ifconfig.me/lang | ⇒ | |
$ curl ifconfig.me/keepalive | ⇒ | |
$ curl ifconfig.me/connection | ⇒ | |
$ curl ifconfig.me/encoding | ⇒ | |
$ curl ifconfig.me/mime | ⇒ | |
$ curl ifconfig.me/charset | ⇒ | |
$ curl ifconfig.me/via | ⇒ | |
$ curl ifconfig.me/forwarded |
如果想知道怎么做到的,猛击这里:http://ifconfig.me/
转载自http://www.commandlinefu.com