引言 Intro

图片源链:https://pixnio.com/zh/%E6%A4%8D%E7%89%A9/%E8%8A%B1/%E4%B8%81%E9%A6%99%E8%8A%B1-%E5%8F%B6%E5%AD%90-%E5%9B%AD%E8%89%BA-%E8%8A%B1%E7%93%A3-%E8%8A%B1%E5%9B%AD-%E8%87%AA%E7%84%B6-%E5%A4%8F%E5%A4%A9-%E8%8A%B1

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

正题 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

WHAT ?

What R U talking about? What the hell is?

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

Fine, 咱得研究。

问问知乎

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

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

解析

1.lo0 - Loopback

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

不懂的代码,撸呗~

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

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

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

02-09 21:31