Skip to content

Instantly share code, notes, and snippets.

@chadmayfield
Last active June 3, 2019 19:36
Show Gist options
  • Save chadmayfield/013668e0bccac5fda663aec916f7b18e to your computer and use it in GitHub Desktop.
Save chadmayfield/013668e0bccac5fda663aec916f7b18e to your computer and use it in GitHub Desktop.

Revisions

  1. chadmayfield revised this gist Jun 3, 2019. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,14 @@

    Beginning in Systemd v197, network interfaces assigned by systemd/udev are "predicatble";

    Names are now based on;
    * Index numbers for on-board devices (eno1)
    * PCI-ehotplug slot index numbers (ens1)
    * Physical/geographical location of hardware connector (enp2s0)
    * MAC address (enx78e7d1ea46da)
    * Classic, unpredictable kernel-native naming (eth0)

    Links;
    * [Predicatable Network Interface names](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/)
    * [udev-builtin-net_id.c @ freedesktop.org](https://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c)
    * [udev-builtin-net_id.c @ github.com/systemd](https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L12)
  2. chadmayfield revised this gist Jun 3, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ Two character prefixes based on the type of interface:

    #### Find network interface
    ````
    ls /sys/class/net | grep -E "^e(m|n(o|p|s)|th[0-9])|wl(an|p)"
    ls /sys/class/net | grep -E "^e(m|n(o|p|s)|th)[0-9]|wl(an|p)"
    find /sys/class/net ! -type d | xargs --max-args=1 realpath | awk -F\/ '/pci/{print $NF}'
    ````

  3. chadmayfield revised this gist Jun 3, 2019. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -17,16 +17,20 @@ Two character prefixes based on the type of interface:
    [SO Answer: Find available network interfaces](https://unix.stackexchange.com/a/125401)

    #### Find network interface
    `ls /sys/class/net | grep -E "^e(m|n(o|p|s)|th[0-9])|wl(an|p)"
    find /sys/class/net ! -type d | xargs --max-args=1 realpath | awk -F\/ '/pci/{print $NF}'`
    ````
    ls /sys/class/net | grep -E "^e(m|n(o|p|s)|th[0-9])|wl(an|p)"
    find /sys/class/net ! -type d | xargs --max-args=1 realpath | awk -F\/ '/pci/{print $NF}'
    ````

    #### Find available network interfaces
    `ip r | grep " src "|cut -d " " -f 3,12 | xargs
    ````
    ip r | grep " src "|cut -d " " -f 3,12 | xargs
    ip addr show | awk '/inet.*brd/{print $NF}'
    ip -o link show up | awk -F': ' '{print $2}'
    ip -o -4 addr show
    ip -o link ls up
    lshw -class network`
    lshw -class network
    ````

    #### Observed Interface Names
    ````
  4. chadmayfield revised this gist Jun 3, 2019. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,8 @@ ip -o link ls up
    lshw -class network`

    #### Observed Interface Names
    `em1
    ````
    em1
    eno1
    enp0s31f6
    enp0s29u1u2
    @@ -48,4 +49,5 @@ wlp3s0
    wlp3s0b1
    wlp19s0
    wwp0s29u1u4i6`
    wwp0s29u1u4i6
    ````
  5. chadmayfield revised this gist Jun 3, 2019. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,10 @@
    # Network Interface Notes

    https://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c
    https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L12
    https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
    Beginning in Systemd v197, network interfaces assigned by systemd/udev are "predicatble";

    * [Predicatable Network Interface names](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/)
    * [udev-builtin-net_id.c @ freedesktop.org](https://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c)
    * [udev-builtin-net_id.c @ github.com/systemd](https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L12)

    ````
    Two character prefixes based on the type of interface:
  6. chadmayfield created this gist Jun 3, 2019.
    49 changes: 49 additions & 0 deletions network_interface_notes.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    # Network Interface Notes

    https://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c
    https://github.com/systemd/systemd/blob/master/src/udev/udev-builtin-net_id.c#L12
    https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

    ````
    Two character prefixes based on the type of interface:
    * en -- ethernet
    * sl -- serial line IP (slip)
    * wl -- wlan
    * ww -- wwan
    ````

    [SO Answer: Find available network interfaces](https://unix.stackexchange.com/a/125401)

    #### Find network interface
    `ls /sys/class/net | grep -E "^e(m|n(o|p|s)|th[0-9])|wl(an|p)"
    find /sys/class/net ! -type d | xargs --max-args=1 realpath | awk -F\/ '/pci/{print $NF}'`

    #### Find available network interfaces
    `ip r | grep " src "|cut -d " " -f 3,12 | xargs
    ip addr show | awk '/inet.*brd/{print $NF}'
    ip -o link show up | awk -F': ' '{print $2}'
    ip -o -4 addr show
    ip -o link ls up
    lshw -class network`

    #### Observed Interface Names
    `em1
    eno1
    enp0s31f6
    enp0s29u1u2
    enp2s0
    enp2s0f1
    enp5s0
    enp7s0
    ens1
    enx78e7d1ea46da
    eth0
    p7p1

    wlan0
    wlp0s12f0
    wlp3s0
    wlp3s0b1
    wlp19s0

    wwp0s29u1u4i6`