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
  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

grant_wtt

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值