Mac 查看本地/代理 IP 命令行

1,109 阅读1分钟

查看本地 IP

Mac 查看本地 IP 是ifconfig
Win 是 ipconfig
前者开头是if后者是ip

Mac常规查看 IP(局域网)

ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000 
	inet6 xxx
	inet6 xxx
	nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
XHC20: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether 4c:32:75:8b:06:11 
	inet6 xxx 
	inet xxx
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active

当然,也可以在网络偏好设置里查看

图片.png

查看公网 IP 地址(国内)

curl http://members.3322.org/dyndns/getip

// 返回 117.xxx.xxx.197

查看省份

curl cip.cc
IP	: 117.xxx.xxx.197
地址	: 中国  四川  成都
运营商	: 移动

数据二	: 四川省 | 移动数据上网公共出口

数据三	: 中国四川省成都市 | 移动

URL	: http://www.cip.cc/117.xxx.xxx.197
curl myip.ipip.net
当前 IP:117.xxx.xxx.197  来自于:中国 四川 成都  移动

查看代理 IP(如果有)

只返回代理 IP

curl ifconfig.me

// 103.xxx.xxx.239

返回代理所在城市

curl ipinfo.io
{
  "ip": "103.xxx.xxx.239",
  "city": "Singapore",
  "region": "Singapore",
  "country": "SG",
  "loc": "xxx,xxx",
  "org": "xxx",
  "postal": "018989",
  "timezone": "Asia/Singapore",
  "readme": "https://ipinfo.io/missingauth"
}

一键测试

ip111.cn/

图片.png

以上内容仅供学习交流参考。