Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TakashiSasaki/06cd0d77ce7cbad764a86b989ecdfe2e to your computer and use it in GitHub Desktop.
Save TakashiSasaki/06cd0d77ce7cbad764a86b989ecdfe2e to your computer and use it in GitHub Desktop.

Comparison of Network Interface Identification: Windows vs. Linux

This document summarizes how network interfaces are identified in Windows and Linux. In both systems, key fields are used to uniquely specify an interface, although the implementations differ.


Windows

In Windows, the IP_ADAPTER_ADDRESSES structure is used to represent network interfaces. The following fields contribute to interface identification:

  • AdapterName

    • A system-generated, permanent identifier for the network adapter.
    • Example: \Device\NPF_{F4B4E5C2-3B1A-4F89-A9B3-123456789ABC}
    • It is not intended for display; rather, it is used internally and by system APIs.
  • FriendlyName

    • A user-friendly, human-readable name for the adapter, intended for display in user interfaces (e.g., in ipconfig or the Network Connections folder).
    • Example: "Local Area Connection * 10" or "Wi-Fi"
    • This field is read-only from the IP Helper API and may be set by the driver or system configuration.
  • PhysicalAddress

    • The Media Access Control (MAC) address of the adapter.
    • It is used both for interface identification and for networking communication at the data-link layer.

These fields together allow both internal processes and end users to uniquely identify and differentiate between multiple network interfaces.


Linux

In Linux, network interfaces are represented by the net_device structure, which is used by the kernel’s network stack. The following fields are relevant for interface identification:

  • name

    • The system-assigned name for the interface (e.g., eth0, wlan0, or the newer predictable naming like enp3s0).
    • This name is used internally and by standard networking commands (e.g., ip link show) to refer to the device.
  • dev_addr

    • The hardware address (MAC address) of the network interface.
    • This serves a similar purpose to the PhysicalAddress field in Windows.
  • ifalias

    • An optional field that can store a descriptive label for the interface.
    • It can be set using a command such as:
      sudo ip link set dev enp3s0 alias "Local Area Connection"
    • While the alias is stored in the kernel (and visible with ip -d link show), it is less commonly used by standard user-space tools compared to the interface name.

Summary

  • Windows:

    • AdapterName provides a permanent, system-level identifier.
    • FriendlyName offers a human-readable label for user interfaces.
    • PhysicalAddress supplies the MAC address used in communication.
  • Linux:

    • name serves as the unique, system-assigned identifier (e.g., eth0, wlan0, enp3s0).
    • dev_addr is the hardware (MAC) address.
    • ifalias allows for an optional, descriptive label, though it is primarily used for internal or debugging purposes.

Both operating systems use similar pieces of information (a unique name, a MAC address, and an optional descriptive label) to identify network interfaces. However, the fields and mechanisms differ due to the distinct design philosophies and implementations of Windows and Linux networking subsystems.


Prepared for sharing with the community to highlight cross-platform interface identification techniques.

ネットワークインターフェース識別の比較:Windows と Linux

このドキュメントでは、Windows と Linux におけるネットワークインターフェースの識別方法について整理します。両システムとも、インターフェースを一意に特定するために重要なフィールドを使用していますが、その実装には違いがあります。


Windows

Windows では、IP_ADAPTER_ADDRESSES 構造体がネットワークインターフェースを表現するために使用されます。以下のフィールドがインターフェースの識別に寄与します:

  • AdapterName

    • システムによって生成されるネットワークアダプターの識別子で、内部的に使用されます。
    • 例:\Device\NPF_{F4B4E5C2-3B1A-4F89-A9B3-123456789ABC}
    • ユーザーインターフェース向けではなく、システム内部やAPIで使用されます。
  • FriendlyName

    • ユーザー向けのわかりやすい名前で、ユーザーインターフェース(例:ipconfig コマンドやネットワーク接続フォルダ)で表示されます。
    • 例:"ローカル エリア接続 * 10""Wi-Fi"
    • ドライバーやシステム設定によって設定される読み取り専用のフィールドです。
  • PhysicalAddress

    • アダプターのメディアアクセス制御(MAC)アドレスを示します。
    • データリンク層での通信やインターフェースの識別に使用されます。

これらのフィールドは、内部プロセスやエンドユーザーが複数のネットワークインターフェースを識別し、区別するのに役立ちます。


Linux

Linux では、net_device 構造体がカーネルのネットワークスタック内でネットワークインターフェースを表現します。以下のフィールドがインターフェースの識別に関連します:

  • name

    • インターフェースのシステム割り当て名(例:eth0wlan0、または新しい予測可能な命名規則に基づく enp3s0 など)。
    • システム内部や標準的なネットワークコマンド(例:ip link show)でデバイスを参照する際に使用されます。
  • dev_addr

    • ネットワークインターフェースのハードウェアアドレス(MACアドレス)。
    • Windows の PhysicalAddress フィールドと同様の役割を果たします。
  • ifalias

    • インターフェースに説明的なラベルを設定するためのオプションのフィールドです。
    • 以下のコマンドで設定できます:
      sudo ip link set dev enp3s0 alias "ローカル エリア接続"
    • このエイリアスはカーネル内に保存され、ip -d link show コマンドで確認できますが、標準的なユーザー空間ツールではあまり使用されません。

まとめ

  • Windows:

    • AdapterName は、システムレベルの永続的な識別子を提供します。
    • FriendlyName は、ユーザーインターフェース向けのわかりやすいラベルを提供します。
    • PhysicalAddress は、通信に使用されるMACアドレスを提供します。
  • Linux:

    • name は、システム割り当ての一意の識別子として機能します(例:eth0wlan0enp3s0)。
    • dev_addr は、ハードウェア(MAC)アドレスを示します。
    • ifalias は、オプションの説明ラベルを設定するためのフィールドですが、主に内部的またはデバッグ目的で使用されます。

両オペレーティングシステムは、ネットワークインターフェースを識別するために類似した情報(固有の名前、MACアドレス、オプションの説明ラベル)を使用していますが、Windows と Linux のネットワーキングサブシステムの設計哲学や実装の違いにより、これらのフィールドの使用方法や目的に差異があります。


このドキュメントは、コミュニティメンバーと共有し、クロスプラットフォームでのインターフェース識別手法を理解するために作成されました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment