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

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

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

lo0
gif0
stf0
en0
fw0
en1
vmnet8
vmnet1

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

答案1

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

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

类似这样的。

另外,以下哪一个是 IP 接口?

很多年前就已经不再有“那个” IP 接口了。全部其中可以配置并运行 IPv4 和/或 IPv6。默认使用哪个由路由表(特别是default或条目)定义。0.0.0.0::/0

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

Mac OS X 是 BSD,而不是 Linux。

答案2

您可以通过运行以下命令查看系统偏好设置中某些设备所使用的名称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 使用的设备vmnet1等设备。vmnet8

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";
}

en0iklier 所说的除了没有以太网端口的笔记本电脑和en1只有一个以太网端口的 Mac 中的Wi-Fi 设备名称之外,en2至少在一些带有两个以太网端口的 Mac Pro 中也存在这个名称。

答案3

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

旧款 Mac Pro 配有以太网插孔,并且配有 en3,因为它们有两个以太网网卡和 Airport(WiFi)。

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

vmnet# 通常由虚拟机(Parallels/VMWare)创建

相关内容