Last active
June 15, 2020 09:11
-
-
Save SwagDevOps/b2daafd7a5ece37e11d5624f927be708 to your computer and use it in GitHub Desktop.
Revisions
-
SwagDevOps revised this gist
Jun 15, 2020 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ source: [PredictableNetworkInterfaceNames](https://www.freedesktop.org/wiki/Soft ## ``/lib/systemd/network/99-default.link`` ```sh # less /lib/systemd/network/99-default.link ``` ### Original @@ -34,6 +34,8 @@ source: [PredictableNetworkInterfaceNames](https://www.freedesktop.org/wiki/Soft NamePolicy=kernel database onboard slot path MACAddressPolicy=persistent ``` You SHOULD NOT modify this file, it COULD be regularly reverted by packages updates. ### Edited ```ini -
SwagDevOps revised this gist
Jun 15, 2020 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,10 @@ MACAddressPolicy=persistent ```ini # /etc/systemd/network/99-default.link [Match] OriginalName=* [Link] NamePolicy=mac path MACAddressPolicy=none @@ -85,4 +89,8 @@ Sample output: ID_NET_NAME_MAC=enx9c5c8e538309 ID_NET_NAME_ONBOARD=eno1 ID_NET_NAME_PATH=enp0s25 ``` ## See also * [General Network Configuration = Linux From Scratch](http://www.linuxfromscratch.org/lfs/view/9.1-systemd/chapter07/network.html) -
SwagDevOps revised this gist
Jan 4, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,6 +37,7 @@ MACAddressPolicy=persistent ### Edited ```ini # /etc/systemd/network/99-default.link [Link] NamePolicy=mac path MACAddressPolicy=none -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,7 +74,7 @@ GRUB_CMDLINE_LINUX="net.ifnames=1" ```sh (cd /sys/class/net && find * -maxdepth 1) | grep -Ev '^lo$' | \ head -1 | \ perl -pe "s/\n//" | \ xargs -r0I {} sudo udevadm test /sys/class/net/{} 2> /dev/null | grep NAME ``` -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Names incorporating the interfaces's MAC address > With ``systemd 197`` we have added native support for a number of different naming policies into ``systemd``/``udevd`` > proper and made a scheme similar to ``biosdevname``'s (but generally more powerful, > and closer to kernel-internal device identification schemes) the default. > The following different naming schemes for network interfaces are now supported by ``udev`` natively: > -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,10 +10,8 @@ > 3. Names incorporating physical/geographical location of the connector of the hardware (example: ``enp2s0``) > 4. Names incorporating the interfaces's MAC address (example: ``enx78e7d1ea46da``) > 5. Classic, unpredictable kernel-native ethX naming (example: ``eth0``) source: [PredictableNetworkInterfaceNames](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/) ## ``/lib/systemd/network/99-default.link`` @@ -53,6 +51,8 @@ MACAddressPolicy=none > * ``path`` The name is set based on the device's physical location, as exported by the ``udev`` property ``ID_NET_NAME_PATH``. > * ``mac`` The name is set based on the device's persistent MAC address, as exported by the ``udev`` property ``ID_NET_NAME_MAC``. source: [systemd.link — Network device configuration](https://www.freedesktop.org/software/systemd/man/systemd.link.html) ## ``/etc/default/grub`` ```sh -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,20 @@ # Names incorporating the interfaces's MAC address > With ``systemd 197`` we have added native support for a number of different naming policies into ``systemd``/``udevd`` > proper and made a scheme similar to biosdevname's (but generally more powerful, > and closer to kernel-internal device identification schemes) the default. > The following different naming schemes for network interfaces are now supported by ``udev`` natively: > > 1. Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: ``eno1``) > 2. Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ``ens1``) > 3. Names incorporating physical/geographical location of the connector of the hardware (example: ``enp2s0``) > 4. Names incorporating the interfaces's MAC address (example: ``enx78e7d1ea46da``) > 5. Classic, unpredictable kernel-native ethX naming (example: ``eth0``) > > source: [PredictableNetworkInterfaceNames](https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/) Names incorporating the interfaces's MAC address (example: ``enx78e7d1ea46da``) ## ``/lib/systemd/network/99-default.link`` ```sh -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,8 +31,8 @@ MACAddressPolicy=none > An ordered, space-separated list of policies by which the interface name should be set. > ``NamePolicy=`` may be disabled by specifying ``net.ifnames=0`` on the kernel command line. > Each of the policies may fail, and the first successful one is used. > The name is not set directly, but is exported to ``udev`` as the property ``ID_NET_NAME``, > which is, by default, used by a ``udev(7)``, rule to set ``NAME``. The policies used above are: > * ``path`` The name is set based on the device's physical location, as exported by the ``udev`` property ``ID_NET_NAME_PATH``. > * ``mac`` The name is set based on the device's persistent MAC address, as exported by the ``udev`` property ``ID_NET_NAME_MAC``. -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,8 +33,8 @@ MACAddressPolicy=none > Each of the policies may fail, and the first successful one is used. > The name is not set directly, but is exported to udev as the property ``ID_NET_NAME``, > which is, by default, used by a udev(7), rule to set ``NAME``. The policies used above are: > * ``path`` The name is set based on the device's physical location, as exported by the ``udev`` property ``ID_NET_NAME_PATH``. > * ``mac`` The name is set based on the device's persistent MAC address, as exported by the ``udev`` property ``ID_NET_NAME_MAC``. ## ``/etc/default/grub`` -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,9 +55,10 @@ GRUB_CMDLINE_LINUX="net.ifnames=1" ``` ```sh (cd /sys/class/net && find * -maxdepth 1) | grep -Ev '^lo$' | \ head -1 | \ perl -pe 's/:$//'| \ xargs -r0I {} sudo udevadm test /sys/class/net/{} 2> /dev/null | grep NAME ``` Sample output: -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 21 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,4 +45,25 @@ GRUB_CMDLINE_LINUX="net.ifnames=1" ```sh # sudo update-grub # sudo update-initramfs -u # sudo reboot ``` ## Check/ensure ```sh # ls /sys/class/net/ ``` ```sh ls /sys/class/net/* | grep -Ev '^lo$' | head -1 | \ perl -pe 's/:$//'| perl -pe "s/\n//" | \ xargs -r0I {} sudo udevadm test {} 2> /dev/null | grep NAME ``` Sample output: ``` ID_NET_NAME_MAC=enx9c5c8e538309 ID_NET_NAME_ONBOARD=eno1 ID_NET_NAME_PATH=enp0s25 ``` -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 15 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ## ``/lib/systemd/network/99-default.link`` ```sh # sudo vim /lib/systemd/network/99-default.link ``` ### Original @@ -32,4 +32,17 @@ MACAddressPolicy=none > ``NamePolicy=`` may be disabled by specifying ``net.ifnames=0`` on the kernel command line. > Each of the policies may fail, and the first successful one is used. > The name is not set directly, but is exported to udev as the property ``ID_NET_NAME``, > which is, by default, used by a udev(7), rule to set ``NAME``. The policies used above are: > * ``path`` The name is set based on the device's physical location, as exported by the udev property ``ID_NET_NAME_PATH``. > * ``mac`` The name is set based on the device's persistent MAC address, as exported by the udev property ``ID_NET_NAME_MAC``. ## ``/etc/default/grub`` ```sh GRUB_CMDLINE_LINUX="net.ifnames=1" ``` ```sh # sudo update-grub # sudo update-initramfs -u ``` -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,4 +25,11 @@ MACAddressPolicy=persistent [Link] NamePolicy=mac path MACAddressPolicy=none ``` > ``NamePolicy=`` > An ordered, space-separated list of policies by which the interface name should be set. > ``NamePolicy=`` may be disabled by specifying ``net.ifnames=0`` on the kernel command line. > Each of the policies may fail, and the first successful one is used. > The name is not set directly, but is exported to udev as the property ``ID_NET_NAME``, > which is, by default, used by a udev(7), rule to set ``NAME``. The available policies are: -
SwagDevOps revised this gist
Jul 10, 2019 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,9 @@ ## ``/lib/systemd/network/99-default.link`` ```sh sudo vim /lib/systemd/network/99-default.link ``` ### Original ```ini # SPDX-License-Identifier: LGPL-2.1+ @@ -16,6 +19,8 @@ sudo vim /lib/systemd/network/99-default.link NamePolicy=kernel database onboard slot path MACAddressPolicy=persistent ``` ### Edited ```ini [Link] NamePolicy=mac path -
SwagDevOps created this gist
Jul 10, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ ```sh sudo vim /lib/systemd/network/99-default.link ``` ```ini # SPDX-License-Identifier: LGPL-2.1+ # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Link] NamePolicy=kernel database onboard slot path MACAddressPolicy=persistent ``` ```ini [Link] NamePolicy=mac path MACAddressPolicy=none ```