Difference between revisions of "Rename network interfaces"

From ArchWiki
Jump to: navigation, search
(rm unnecessary gap)
(search and replace deprecated <tt> element to Codeline template)
Line 1: Line 1:
 
[[Category:Networking (English)]]
 
[[Category:Networking (English)]]
 
==Prerequisites==
 
==Prerequisites==
* <tt>ifrename</tt> tool which is a part of the <tt>wireless_tools</tt> package.
+
* {{Codeline|ifrename}} tool which is a part of the {{Codeline|wireless_tools}} package.
* <tt>udev</tt> package, which is already installed, of course.
+
* {{Codeline|udev}} package, which is already installed, of course.
  
 
==Generic network interfaces==
 
==Generic network interfaces==

Revision as of 01:06, 30 August 2011

Prerequisites

Generic network interfaces

Option 1: udev

Create Template:Filename file with content like following:

 SUBSYSTEM=="net", ATTRS{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.

Option 2: ifrename

Run ifrename directly

 ifrename -i eth0 -n lan

or create config file (Template:Filename), 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 Template:Filename script the following lines:

 IF=$1
 /sbin/ifconfig $IF down
 /usr/sbin/ifrename -i $IF -n <NEWNAME>
 /sbin/ifconfig <NEWNAME> up

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