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...


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM