有人可以解释一下Mac OS X中的ifconfig输出吗?


51

在Mac上执行ifconfig时,我得到以下接口的列表:

lo0
gif0
stf0
en0
fw0
en1
vmnet8
vmnet1

我想知道每个接口是什么。另外,这些是IP接口中的哪一个?我在任何地方都看不到eth0,我认为这是linux系统使用的标准接口名称。

Answers:


63

我想知道每个接口是什么。

  • lo0 =回送
  • gif0 =软件网络接口
  • stf0 = 6to4隧道接口
  • en0 =以太网0
  • fw0 =火线
  • en1 =以太网1
  • vmnet8 =虚拟接口
  • vmnet1 =虚拟接口

这样的事情。

另外,这些是IP接口中的哪一个?

自多年前就没有IP接口。所有这些都可以拥有IPv4和/或IPv6配置和运行。默认一到使用由路由表中定义(尤其是default0.0.0.0::/0条目)。

我在任何地方都看不到eth0,我认为这是linux系统使用的标准接口名称。

Mac OS X是BSD,不是Linux。


3
+1好答案。另外,有时您会看到ppp0,它也用于某些VPN隧道。
Mark E. Haase

5
另外,osx VPN客户端会创建一个utun0接口。
丹·普里兹

33

您可以通过运行networksetup -listallhardwareports以下命令查看某些设备的“系统偏好设置”中使用的名称:

Hardware Port: HUAWEIMobile-
Device: HUAWEIMobile-Modem
Ethernet Address: N/A

Hardware Port: Bluetooth DUN
Device: Bluetooth-Modem
Ethernet Address: N/A

Hardware Port: Ethernet
Device: en0
Ethernet Address: a8:20:66:31:95:57

Hardware Port: MBBEthernet
Device: en5
Ethernet Address: 00:1e:10:1f:00:01

Hardware Port: Wi-Fi
Device: en1
Ethernet Address: 8c:2d:aa:33:03:e9

Hardware Port: Bluetooth PAN
Device: en4
Ethernet Address: 8c:2d:aa:33:03:ea

Hardware Port: Thunderbolt 1
Device: en2
Ethernet Address: 32:00:1b:25:92:c0

Hardware Port: Thunderbolt 2
Device: en3
Ethernet Address: 32:00:1b:25:92:c1

Hardware Port: Thunderbolt Bridge
Device: bridge0
Ethernet Address: N/A

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

networksetup -listnetworkserviceorder 会产生类似的输出,但是会显示“按连接顺序联系网络服务的列表”,或者以与“系统偏好设置”相同的顺序显示服务。

networksetup不包括VMWare使用的vmnet1vmnet8设备。

您可以en通过运行defaults read /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist以下命令查看有关设备的更多信息:

{
    Interfaces =     (
                {
            Active = 1;
            "BSD Name" = en0;
            IOBuiltin = 1;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 0;
            IOMACAddress = <a8206631 9557>;
            IOPathMatch = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP03@1C,2/IOPP/GIGE@0/BCM5701Enet/en0";
            SCNetworkInterfaceInfo =             {
                UserDefinedName = Ethernet;
            };
            SCNetworkInterfaceType = Ethernet;
        },
                {
            Active = 1;
            "BSD Name" = en1;
            IOBuiltin = 1;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 1;
            IOMACAddress = <8c2daa33 03e9>;
            IOPathMatch = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP04@1C,3/IOPP/ARPT@0/AirPort_Brcm4360/en1";
            SCNetworkInterfaceInfo =             {
                UserDefinedName = "Wi-Fi";
            };
            SCNetworkInterfaceType = IEEE80211;
        },
                {
            Active = 1;
            "BSD Name" = en2;
            IOBuiltin = 1;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 2;
            IOMACAddress = <32001b25 92c0>;
            IOPathMatch = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP05@1C,4/IOPP/UPSB@0/IOPP/DSB0@0/IOPP/NHI0@0/AppleThunderboltHAL/AppleThunderboltNHIType2/IOThunderboltController/IOThunderboltLocalNode/AppleThunderboltIPService/AppleThunderboltIPPort/en2";
            SCNetworkInterfaceInfo =             {
                UserDefinedName = "Thunderbolt 1";
            };
            SCNetworkInterfaceType = Ethernet;
        },
                {
            Active = 1;
            "BSD Name" = en3;
            IOBuiltin = 1;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 3;
            IOMACAddress = <32001b25 92c1>;
            IOPathMatch = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/RP05@1C,4/IOPP/UPSB@0/IOPP/DSB0@0/IOPP/NHI0@0/AppleThunderboltHAL/AppleThunderboltNHIType2/IOThunderboltController/IOThunderboltLocalNode/AppleThunderboltIPService/AppleThunderboltIPPort/en3";
            SCNetworkInterfaceInfo =             {
                UserDefinedName = "Thunderbolt 2";
            };
            SCNetworkInterfaceType = Ethernet;
        },
                {
            "BSD Name" = en4;
            IOBuiltin = 0;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 4;
            IOMACAddress = <8c2daa33 03ea>;
            IOPathMatch = "Migrated_From: IOService:/IOResources/IOUserEthernetResource/IOUserEthernetResourceUserClient/IOUserEthernetController/en2";
            SCNetworkInterfaceInfo =             {
                UserDefinedName = "Bluetooth PAN";
            };
            SCNetworkInterfaceType = Ethernet;
        },
                {
            Active = 1;
            "BSD Name" = en5;
            IOBuiltin = 0;
            IOInterfaceNamePrefix = en;
            IOInterfaceType = 6;
            IOInterfaceUnit = 5;
            IOMACAddress = <001e101f 0001>;
            IOPathMatch = "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/EHC1@1D/AppleUSBEHCI/HUAWEI Mobile@1d110000/IOUSBInterface@4/HuaweiDataCardECMData/en5";
            SCNetworkInterfaceInfo =             {
                "USB Product Name" = "HUAWEI Mobile";
                UserDefinedName = MBBEthernet;
                idProduct = 5382;
                idVendor = 4817;
            };
            SCNetworkInterfaceType = Ethernet;
        }
    );
    Model = "iMac13,1";
}

除了en0在没有以太网端口的笔记本电脑中和en1在具有单个以太网端口的Mac中使用Wi-Fi的设备名称外,其他人都说得更好en2,至少在某些具有两个以太网端口的Mac Pro中也是如此。


15

在较旧的Apple便携式电脑上,en0是以太网,en1是Airport(WiFi)。

带有以太网插孔的较旧的Mac Pro将具有en3,并且具有两个以太网NIC和Airport(WiFi)。

在没有以太网插孔的新型MacBook中,en0是Airport(WiFi)。

vmnet#通常由VM(Parallels / VMWare)创建

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.