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

macOS & ifconfig & ipconfig commands All In One

macOS & ifconfig & ipconfig commands All In One

IP address / ipconfig / ifconfig

ifconfig

$ ifconfig

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 8e:68:cf:03:d2:8f 
	inet6 fe80::8c68:cfff:fe03:d28f%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 8e:68:cf:03:d2:8f 
	inet6 fe80::8c68:cfff:fe03:d28f%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 
➜  ~ 

$ man ifconfig

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

NAME
     ifconfig – configure network interface parameters

SYNOPSIS
     ifconfig [-L] [-m] [-r] interface [create] [address_family] [address [dest_address]]
              [parameters]
     ifconfig interface destroy
     ifconfig -a [-L] [-d] [-m] [-r] [-u] [-v] [address_family]
     ifconfig -l [-d] [-u] [address_family]
     ifconfig [-L] [-d] [-m] [-r] [-u] [-v] [-C]
     ifconfig interface vlan vlan-tag vlandev iface
     ifconfig interface -vlandev iface
     ifconfig interface bonddev iface
     ifconfig interface -bonddev iface
     ifconfig interface bondmode lacp | static
     ifconfig -X pattern [parameters]

DESCRIPTION
     The ifconfig utility is used to assign an address to a network interface and/or
     configure network interface parameters.

:

ifconfig & grep

# ifconfig filter the localhost ip address
$ ifconfig en0

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

# 不过滤
$ ifconfig en0 | grep "inet"

# 等价于
$ ifconfig en0 | grep inet

ipconfig

$ 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


man ifconfig

$ ipconfig getifaddr
# usage: ipconfig getifaddr <interface name>

$ ipconfig getifaddr en0
# 192.168.18.207

get localhost IP address

$ ipconfig getifaddr en0
# 192.168.18.207

macOS 上如何获取本机的 IP 地址

在 Mac 上使用 DHCP 或手动 IP 地址

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

https://zh.wikihow.com/在Mac上找到IP地址

$ ifconfig | grep "inet " | grep -v 127.0.0.1

$ ifconfig | grep "inet "

路由器,查看

refs

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

https://www.cnblogs.com/xgqfrms/p/16127607.html



©xgqfrms 2012-2020

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

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


posted @ 2022-10-14 16:24  xgqfrms  阅读(576)  评论(1编辑  收藏  举报