xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

如何在 Apple Mac 上获得 IP 地址 All In One

如何在 Apple Mac 上获得 IP 地址 All In One

  1. 在 Mac 上,选取苹果菜单 >“系统偏好设置”,然后点按“网络” 。

  2. 在 "网络" 上,选取对应的 WI-FI,然后点按“高级” 。

  3. 在 "WI-FI" 上,若要获得入 IPv4 地址,请在“TCP”设置中查找。

https://support.apple.com/zh-cn/guide/mac-help/mchlp2718/mac

ifconfig

Virtual Private Network

# ifconfig filter the localhost ip address
$ ifconfig en0

$ ifconfig en0 | grep "inet "
# 空格,过滤掉 IPv6 `inet6` ✅


$ ifconfig en0 | grep "inet"
# 不过滤
# 等价于
$ ifconfig en0 | grep inet

$ ifconfig en0 | grep 'inet addr:'
# ??? addr 不是关键字 ❌

macOS

$ ipconfig getifaddr en0
# 192.168.18.207

$ ipconfig
usage: ipconfig <command> <args>
where <command> is one of waitall, getifaddr, ifcount, getoption, getiflist, getsummary, getpacket, getv6packet, getra, set, setverbose

$ man ipconfig

IPCONFIG(8)                  System Manager's Manual                 IPCONFIG(8)

NAME
     ipconfig – view and control IP configuration state

SYNOPSIS
     ipconfig waitall
     ipconfig getifaddr interface-name
     ipconfig ifcount
     ipconfig getoption interface-name (option-name | option-code)
     ipconfig getpacket interface-name
     ipconfig getv6packet interface-name
     ipconfig getra interface-name
     ipconfig setverbose level
     ipconfig set interface-name NONE
     ipconfig set interface-name (DHCP | BOOTP)
     ipconfig set interface-name (MANUAL | INFORM) ip-address subnet-mask
     ipconfig set interface-name NONE-V6
     ipconfig set interface-name AUTOMATIC-V6
     ipconfig set interface-name MANUAL-V6 ipv6-address prefix-length
     ipconfig set interface-name 6TO4

DESCRIPTION

https://stackoverflow.com/questions/13322485/how-to-get-the-primary-ip-address-of-the-local-machine-on-linux-and-os-x

$ ifconfig eth0
ifconfig: interface eth0 does not exist

$ ifconfig eth0 | grep 'inet addr:'
ifconfig: interface eth0 does not exist

https://www.cyberciti.biz/faq/how-to-find-out-the-ip-address-assigned-to-eth0-and-display-ip-only/

inet 192.168.18.207

$ 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 ::1 prefixlen 128 
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
	nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether ac:de:48:00:11:22 
	inet6 fe80::aede:48ff:fe00:1122%en5 prefixlen 64 scopeid 0x4 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX <full-duplex>)
	status: active
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether f2:18:98:36:0e:ab 
	media: autoselect
	status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=6463<RXCSUM,TXCSUM,TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
	ether f0:18:98:36:0e:ab 
	inet6 fe80::1065:84e4:721f:ebdd%en0 prefixlen 64 secured scopeid 0x6 
	inet 192.168.18.207 netmask 0xffffff00 broadcast 192.168.18.255
	inet6 fd80:eae6:1258:0:4a8:9d29:553e:8271 prefixlen 64 autoconf secured 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether f6:3f:23:6c:b8:92 
	inet6 fe80::f43f:23ff:fe6c:b892%awdl0 prefixlen 64 scopeid 0x7 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
llw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether f6:3f:23:6c:b8:92 
	inet6 fe80::f43f:23ff:fe6c:b892%llw0 prefixlen 64 scopeid 0x8 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:bf:64:46:e4:01 
	media: autoselect <full-duplex>
	status: inactive
en3: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:bf:64:46:e4:05 
	media: autoselect <full-duplex>
	status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:bf:64:46:e4:00 
	media: autoselect <full-duplex>
	status: inactive
en4: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=460<TSO4,TSO6,CHANNEL_IO>
	ether 82:bf:64:46:e4:04 
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 82:bf:64:46:e4:01 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x0
	member: en1 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 9 priority 0 path cost 0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 11 priority 0 path cost 0
	member: en3 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 10 priority 0 path cost 0
	member: en4 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 12 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: <unknown type>
	status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::8564:1cc2:eb84:f254%utun0 prefixlen 64 scopeid 0xe 
	nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::85a0:a9e7:a6f8:bb1%utun1 prefixlen 64 scopeid 0xf 
	nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1000
	inet6 fe80::ce81:b1c:bd2c:69e%utun2 prefixlen 64 scopeid 0x10 
	nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
	inet 10.8.0.63 --> 10.8.0.63 netmask 0xffffff00 

refs



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-04-10 21:22  xgqfrms  阅读(1712)  评论(0编辑  收藏  举报