<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Oleksandr</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Oleksandr"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Oleksandr"/>
	<updated>2026-05-03T22:02:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Custom_network_interface_names&amp;diff=18224</id>
		<title>Custom network interface names</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Custom_network_interface_names&amp;diff=18224"/>
		<updated>2020-12-05T10:11:41Z</updated>

		<summary type="html">&lt;p&gt;Oleksandr: /* /etc/mdev.conf configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article shows how to rename/change name of a network interface.&lt;br /&gt;
&lt;br /&gt;
Alpine Linux uses &#039;&#039;busybox&#039;&#039; &#039;&#039;mdev&#039;&#039; to manage devices in &#039;&#039;/dev&#039;&#039;. &#039;&#039;mdev&#039;&#039; reads &#039;&#039;/etc/mdev.conf&#039;&#039; and according to [https://git.busybox.net/busybox/plain/docs/mdev.txt mdev documentation] one can define a command to be executed per device definition. The command which is going to be used to change network interface name is &#039;&#039;nameif&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;/etc/mdev.conf&#039;&#039; configuration ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-SUBSYSTEM=net;DEVPATH=.*/net/.*;.*     root:root 600 @/sbin/nameif -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we tell &#039;&#039;mdev&#039;&#039; to call &#039;&#039;nameif&#039;&#039; for devices found in &#039;&#039;/sys/class/net/&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# ls -d -C -1 /sys/class/net/eth*&lt;br /&gt;
/sys/class/net/eth1&lt;br /&gt;
/sys/class/net/eth2&lt;br /&gt;
/sys/class/net/eth3&lt;br /&gt;
/sys/class/net/eth4&lt;br /&gt;
/sys/class/net/eth5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;nameif&#039;&#039; configuration ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;nameif&#039;&#039; itself reads &#039;&#039;/etc/mactab&#039;&#039; by default. Example line for a network interface with following hwaddr&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cat /sys/class/net/eth0/address&lt;br /&gt;
90:e2:ba:04:28:c0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# grep 90:e2:ba:04:28:c0 /etc/mactab &lt;br /&gt;
dmz0 90:e2:ba:04:28:c0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ramdisk rebuild ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;/etc/mdev.conf&#039;&#039; is part of ramdisk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# grep /etc/mdev.conf /etc/mkinitfs/features.d/*.files&lt;br /&gt;
/etc/mkinitfs/features.d/base.files:/etc/mdev.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
thus we need to rebuild ramdisk&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# mkinitfs $(ls /lib/modules/)&lt;br /&gt;
==&amp;gt; initramfs: creating /boot/initramfs-lts&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== finalization ==&lt;br /&gt;
&lt;br /&gt;
To use renamed network interface without reboot, just call &#039;&#039;nameif&#039;&#039; while the network interface is down.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# nameif -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally reboot...&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Oleksandr</name></author>
	</entry>
</feed>