Mac ifconfig 详解(ifconfig detail)-- 外婆送来的丁香(Grandma's clove)

引言 Intro

丁香

图片源链:https://pixnio.com/zh/植物/花/丁香花-叶子-园艺-花瓣-花园-自然-夏天-花

我知道的终端命令还不多,ifconfig在这些当中数最温柔的,像个丁香姑娘一样。

if config ? 这不是问你,R U ready吗 ? (而不是“你配吗?”)

正题 Contents

有一天,我听着Wake Me Up When Sept Ends,开始跟这个姑娘对话。

 ✔  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
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether 24:8c:89:8a:0c:a7 
	inet6 f380::5498:f96d:91e6:ab55%en0 prefixlen 64 secured scopeid 0x4 
	inet 192.168.6.15 netmask 0xffffff00 broadcast 192.168.6.255
	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 83:33:35:3c:3a:8080 
	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 86:23:25:2c:2a:21 
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 32:14:35:b6:55:8080 
	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 0x2
	member: en1 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 5 priority 0 path cost 0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 6 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: <unknown type>
	status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
	options=400<CHANNEL_IO>
	ether 56:44:33:4a:76:f7 
	media: autoselect
	status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
	options=400<CHANNEL_IO>
	ether fa:af:f8:06:38:b1 
	inet6 fe55::62af:f4ff:fe06:38b1%awdl0 prefixlen 64 scopeid 0x9 
	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 fa:ad:24:06:38:b1 
	inet6 fe80::88af:s4ff:6e06:38b1%llw0 prefixlen 64 scopeid 0xa 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::e8e6:6dfb:19b2:e1a8%utun0 prefixlen 64 scopeid 0xb 
	nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::f936:1e21:9f45:1a1f%utun1 prefixlen 64 scopeid 0xc 
	nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::1280:c301:e74e:6204%utun2 prefixlen 64 scopeid 0xd 
	nd6 options=201<PERFORMNUD,DAD>
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::e522:fc15:58c8:504d%utun3 prefixlen 64 scopeid 0xe 
	nd6 options=201<PERFORMNUD,DAD>
utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::70cc:fe62:f622:850f%utun4 prefixlen 64 scopeid 0xf 
	nd6 options=201<PERFORMNUD,DAD>
utun5: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::986f:ffbb:f421:7c8c%utun5 prefixlen 64 scopeid 0x10 
	nd6 options=201<PERFORMNUD,DAD>
utun6: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::7fc5:f4c2:afe2:5ba1%utun6 prefixlen 64 scopeid 0x12 
	nd6 options=201<PERFORMNUD,DAD>
utun7: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::efe6:afd3:3358:2af1%utun7 prefixlen 64 scopeid 0x13 
	nd6 options=201<PERFORMNUD,DAD>
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=400<CHANNEL_IO>
	ether 72:f0:87:7a:fb:48 
	inet6 fe80::cf:542f:e34d:7393%en5 prefixlen 64 secured scopeid 0x11 
	inet 169.254.116.211 netmask 0xffff0000 broadcast 169.254.255.255
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (100baseTX <full-duplex>)
	status: active

 ~ 

Photo by Andre Guerra on Unsplash
Photo by Andre Guerra on Unsplash

WHAT ?

What R U talking about? What the hell is?

啥,你说啥?每个字我都懂,就是不知道连起来是个啥???

Fine, 咱得研究。

问问知乎

果然有,知乎真是个哆唻A梦。

Mac ifconfig的详解

  • lo0 = loopback
  • gif0 = Software Network Interface
  • stf0 = 6to4 tunnel interface
  • en0 = Ethernet 0
  • fw0 = Firewire
  • en1 = Ethernet 1
  • vmnet8 = Virtual Interface
  • vmnet1 = Virtual Interface

作者:非著名开发者
链接:https://www.zhihu.com/question/36861098/answer/105332446
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

解析

1.lo0 - Loopback

第一行看到了端倪,LOOPBACK 回路。

不懂的代码,撸呗~

lo,取了前俩字母。想起了OC的runloop。

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384

lo 是表示主机的回坏地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。
比如把 httpd服务器的指定到回坏地址,在浏览器输入127.0.0.1就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道。 -- 引自CSDN聚优致成转载的ifconfig 详解(回环估计是写了错别字成回坏了)

2.gif0 - Software Network

OK, 我看了还是不懂,gif跟Software Network Interface占了啥亲???
if代表interface?g是general?

先缓缓,有不懂才会念念不忘。好比,要让个姑娘记住,就不能把才华全撒出去,得留点儿,要不一辈子辣么长,多没劲。

3.stf0 - 6to4 tunnel interface

six to four --> stf

4.en0 - Ethernet 0

5.fw0 - Firewire

6.en1 - Ethernet 1

7.vmnet8 - Virtual Interface

这个我又不懂了,为啥有个m啊。virtual micro net?

8.vmnet1 - Virtual Interface

还是不懂的en0

Ethernet 0, 以太网0,额,是个啥???

是时候祭出大招了。RRRRRR

只见摇身一晃,天空风起云涌起来,霎时间又彩彻区明,一段代码妖娆而飘飘忽忽,徐徐而来,如一缕清风

networksetup -listallhardwareports

当是时,有几段分外祥和可亲紧随其后

Hardware Port: Wi-Fi
Device: en0
Ethernet Address: f4:5c:89:ba:7c:f7

Hardware Port: iPhone USB
Device: en5
Ethernet Address: 72:f0:87:7a:ab:48

Hardware Port: Bluetooth PAN
Device: en3
Ethernet Address: f4:5c:89:ba:7c:f8

Hardware Port: Thunderbolt 1
Device: en1
Ethernet Address: 82:13:15:bc:5a:80

Hardware Port: Thunderbolt 2
Device: en2
Ethernet Address: 82:13:15:bc:5a:81

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: 82:13:15:bc:5a:80

VLAN Configurations
===================

好一个好外婆,Hardware Port.


欲知后事,请看下回...
To be continued...

posted @ 2019-12-10 15:31  rockbean  阅读(2350)  评论(0编辑  收藏  举报