doc:appunti:linux:sa:if_rename
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:linux:sa:if_rename [2015/11/20 16:19] – niccolo | doc:appunti:linux:sa:if_rename [2023/12/15 10:23] – niccolo | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Renaming network interfaces ====== | ====== Renaming network interfaces ====== | ||
+ | |||
+ | ===== With Debian 10 Buster ===== | ||
+ | |||
+ | According some sources, there is at least two methods to rename a network interface e.g. from **enx00e04c885302** to something more human like **lan0** or the plain old **eth0**. | ||
+ | |||
+ | **WARNING**: | ||
+ | |||
+ | < | ||
+ | rename enx00e04c885302=lan0 | ||
+ | </ | ||
+ | |||
+ | Another methos should be to create a file **/ | ||
+ | |||
+ | < | ||
+ | #/ | ||
+ | [Match] | ||
+ | MACAddress=00: | ||
+ | [Link] | ||
+ | Name=lan0 | ||
+ | </ | ||
+ | |||
+ | The systemd method has a problem if you need to create a **VLAN**. When the system creates e.g. the **lan.602**, | ||
+ | |||
+ | A workaround can be the following: tell the kernel to use the old eth0 schema (passing the **net.ifnames=0** option), then instruct systemd to act only on **%%eth*%%** network interfaces: | ||
+ | |||
+ | < | ||
+ | [Match] | ||
+ | MACAddress=00: | ||
+ | OriginalName=eth* | ||
+ | [Link] | ||
+ | Name=lan0 | ||
+ | </ | ||
+ | |||
+ | ==== NetworkManager interfering with rename ==== | ||
+ | |||
+ | Both methods seen above seem to work, unfortunately on my XFCE environment, | ||
+ | |||
+ | < | ||
+ | NetworkManager[581]: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | If you want to **manage the interface using NetworkManager** from the user session, be sure that the interface is not referred by **/ | ||
+ | |||
+ | ==== Use the old naming schema (eth0, ...) ==== | ||
+ | |||
+ | If you want to use the old naming schema (eth0, eth1, ...) enable the kernel override option in **/ | ||
+ | |||
+ | < | ||
+ | GRUB_CMDLINE_LINUX=" | ||
+ | </ | ||
+ | |||
+ | Followed by **update-grub** and **reboot**. | ||
+ | |||
+ | Beware that by using that schema the card's assigned name depends upon the time when the kernel discover the interfaces, in some cases you may find the names swapped after a reboot, even if the Ethernet cards are fixed built-in. | ||
+ | |||
+ | ===== How it worked in the old days of Debian 4 Etch ===== | ||
In a modern Linux system, network interface drivers are compiled as modules. Generally there is a subsytem that provides loading kernel modules automatically. Debian GNU/Linux Etch uses '' | In a modern Linux system, network interface drivers are compiled as modules. Generally there is a subsytem that provides loading kernel modules automatically. Debian GNU/Linux Etch uses '' | ||
Line 8: | Line 65: | ||
- | ===== udev ===== | + | ==== udev ==== |
In a Debian Etch box, check the **''/ | In a Debian Etch box, check the **''/ | ||
Line 24: | Line 81: | ||
</ | </ | ||
- | ===== ifrename | + | ==== ifrename ==== |
You configure this userspace program writing the configuration file'' | You configure this userspace program writing the configuration file'' | ||
Line 48: | Line 105: | ||
udevadm trigger --action=add | udevadm trigger --action=add | ||
</ | </ | ||
+ | |||
+ | ===== Debian 9 predictable network interface names ===== | ||
+ | |||
+ | Esempio: **enp3s0f1** | ||
+ | |||
+ | * **en** Ethernet network card | ||
+ | * **p3** PCI bus #3 | ||
+ | * **s0** Slot #0 | ||
+ | * **f1** Function #1 (eg. a dual porta LAN has two // | ||
+ | |||
+ | Per disabilitare questa funzione, chiamata **[[https:// | ||
+ | |||
+ | Se è installato la //helper utility// di udev chiamata **biosdevname**, | ||
+ | |||
+ | Avendo attivato l' | ||
+ | |||
+ | < | ||
+ | SUBSYSTEM==" | ||
+ | SUBSYSTEM==" | ||
+ | </ | ||
+ | |||
+ | **ATTENZIONE**: | ||
+ | |||
+ | ===== Debian 9 Network Interface Naming ===== | ||
+ | |||
+ | * **[[http:// | ||
+ | * **[[https:// | ||
+ |
doc/appunti/linux/sa/if_rename.txt · Last modified: 2024/04/12 18:01 by niccolo