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 revision | ||
| doc:appunti:linux:sa:if_rename [2018/09/03 11:07] – [Debian 9 predictable network interface names] niccolo | doc:appunti:linux:sa:if_rename [2024/06/21 17:54] (current) – [Beware of initramfs image] niccolo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Renaming network interfaces ====== | ====== Renaming network interfaces ====== | ||
| + | |||
| + | ===== With Debian 10 Buster ===== | ||
| + | |||
| + | How to rename a network interface from e.g. **enx00e04c885302** to something more human like **lan0**? The preferred method is to create a file **/ | ||
| + | |||
| + | < | ||
| + | #/ | ||
| + | [Match] | ||
| + | MACAddress=00: | ||
| + | [Link] | ||
| + | Name=lan0 | ||
| + | </ | ||
| + | |||
| + | **WARNING**: | ||
| + | |||
| + | **WARNING**: | ||
| + | |||
| + | A workaround can be the following: tell the kernel to use the old '' | ||
| + | |||
| + | < | ||
| + | [Match] | ||
| + | MACAddress=00: | ||
| + | OriginalName=eth* | ||
| + | [Link] | ||
| + | Name=lan0 | ||
| + | </ | ||
| + | |||
| + | ==== Beware of initramfs image ==== | ||
| + | |||
| + | :!: If you have some files in **/ | ||
| + | |||
| + | These files are considered by '' | ||
| + | |||
| + | So it is always advisable to **update the initramfs** whenever you update the content of **/ | ||
| + | |||
| + | < | ||
| + | update-initramfs -k all -u | ||
| + | </ | ||
| + | |||
| + | === How to unpack the iniramfs image to inspect its content === | ||
| + | |||
| + | In **Debian 12** the iniramfs image may be composed by two appended cpio archives. The first containing the Intel microcode in //ASCII cpio archive// format, and the second containing the actual initramfs as a //Zstandard compressed cpio archive//. To extract both, do the following: | ||
| + | |||
| + | Extract **the microcode part** (take note of the number of blocks printed on stderr): | ||
| + | |||
| + | < | ||
| + | cat / | ||
| + | 14080 blocks | ||
| + | </ | ||
| + | |||
| + | Make a copy of **the initramfs part** stripping the microcode and decompress it: | ||
| + | |||
| + | < | ||
| + | dd if=/ | ||
| + | unzstd initramfs.img.zst --stdout | cpio --extract --make-directories | ||
| + | </ | ||
| + | |||
| + | ==== 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 89: | ||
| - | ===== udev ===== | + | ==== udev ==== |
| In a Debian Etch box, check the **''/ | In a Debian Etch box, check the **''/ | ||
| Line 24: | Line 105: | ||
| </ | </ | ||
| - | ===== ifrename | + | ==== ifrename ==== |
| You configure this userspace program writing the configuration file'' | You configure this userspace program writing the configuration file'' | ||
| Line 68: | Line 149: | ||
| SUBSYSTEM==" | SUBSYSTEM==" | ||
| </ | </ | ||
| + | |||
| + | :!: **ATTENZIONE**: | ||
| + | |||
| + | :!: **ATTENZIONE**: | ||
| + | |||
| ===== Debian 9 Network Interface Naming ===== | ===== Debian 9 Network Interface Naming ===== | ||
doc/appunti/linux/sa/if_rename.1535965645.txt.gz · Last modified: by niccolo
