Difference between revisions of "Rename network interfaces"

From ArchWiki
Jump to navigation Jump to search
m (PPP interfaces: Use ip command.)
(Deprecated because of http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames.)
Line 5: Line 5:
* {{Ic|ifrename}} tool which is a part of the {{Ic|wireless_tools}} package.
* {{Ic|ifrename}} tool which is a part of the {{Ic|wireless_tools}} package.
* {{Ic|udev}} package, which is already installed, of course.
==Generic network interfaces==
==Generic network interfaces==
===Option 1: udev===
Create {{ic|/etc/udev/rules.d/10-network.rules}} file with content like following:
  SUBSYSTEM=="net", ATTR{address}=="00:1e:58:48:33:08", NAME="lan"
  SUBSYSTEM=="net", KERNEL=="tap1", NAME="vpn"
  SUBSYSTEM=="net", KERNEL=="tap5", NAME="qemu"
{{Note|Make sure to use the lower-case hex values in your udev rules. It doesn't like uppercase.}}
{{Note|Note that the example above avoids names such as eth0, eth1, etc... and instead uses names that are not initially assigned. Trying to rename using names like eth0, eth1, etc... may fail.}}
{{Note|If using '''systemd''', you may find it necessary to inform your network service to hold until the network device has been renamed. This may be achieved by adding the following to the '''[Unit]''' section of your '''network.service''' file:
===Option 2: ifrename===
===Option 2: ifrename===

Revision as of 08:22, 22 March 2013

Merge-arrows-2.pngThis article or section is a candidate for merging with Configuring Network.Merge-arrows-2.png

Notes: please use the second argument of the template to provide more detailed indications. (Discuss in Talk:Rename network interfaces#)


  • ifrename tool which is a part of the wireless_tools package.

Generic network interfaces

Option 2: ifrename

Run ifrename directly

 # ifrename -i eth0 -n lan

or create config file (/etc/iftab), for example:

lan		mac 00:0C:6E:C6:94:81
internet	mac 00:0C:6E:C6:94:82

and run

 # ifrename -c /etc/iftab

PPP interfaces

Add into /etc/ppp/ip-up script the following lines:

 ip link set dev $IF down
 /usr/sbin/ifrename -i $IF -n <NEWNAME>
 ip link set dev <NEWNAME> up

where <NEWNAME> is the new name for the ppp interface