macOS查看IP地址的命令
查看内网的 IP 地址:
ipconfig getifaddr en0
Last login: Thu Aug 11 17:13:00 on ttys000
grnt@wMacBook-Pro ~ % ipconfig getifaddr en0
192.168.0.107
grnt@wMacBook-Pro ~ % ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
ether 3c:06:30:49:2c:57
inet6 fe80::470:d967:f748:aa63%en0 prefixlen 64 secured scopeid 0xc
inet 192.168.0.107 netmask 0xffffff00 broadcast 192.168.0.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
grnt@wMacBook-Pro ~ %
查看公网 IP 地址:
[~]$ curl ifconfig.me
183.194.149.6%
[~]$ curl ipinfo.io/json
{
"ip": "183.194.149.6",
"city": "Shanghai",
"region": "Shanghai",
"country": "CN",
"loc": "31.2222,121.4581",
"org": "AS24400 Shanghai Mobile Communications Co.,Ltd.",
"timezone": "Asia/Shanghai",
"readme": "https://ipinfo.io/missingauth"
}%
[~]$ curl icanhazip.com
183.194.149.6
[~]$ curl ident.me
183.194.149.6%
[~]$ curl whatismyip.akamai.com
183.194.149.6%
[~]$ curl tnx.nl/ip
183.194.149.6%
[~]$ curl myip.dnsomatic.com
183.194.149.6%
[~]$ curl myip.ipip.net
当前 IP:183.194.149.6 来自于:中国 上海 上海 移动
[~]$ curl http://members.3322.org/dyndns/getip
183.194.149.6