Difference between revisions of "Rename network interfaces"

From ArchWiki
Jump to: navigation, search
m (Option 2: ifrename)
(18 intermediate revisions by 13 users not shown)
Line 1: Line 1:
[[Category:HOWTOs_(English)]]
+
[[Category:Hardware detection and troubleshooting]]
 +
[[Category:Networking]]
 +
{{merge|Configuring Network}}
  
 
==Prerequisites==
 
==Prerequisites==
* ifrename tool which is a part of wireless_tools package
+
* {{Ic|ifrename}} tool which is a part of the {{Ic|wireless_tools}} package.
* udev package, which is already installed of course
+
* {{Ic|udev}} package, which is already installed, of course.
  
 
==Generic network interfaces==
 
==Generic network interfaces==
Line 9: Line 11:
 
===Option 1: udev===
 
===Option 1: udev===
  
Create /etc/udev/rules.d/10-network.rules file with content like following:
+
Create {{ic|/etc/udev/rules.d/10-network.rules}} file with content like following:
  
   SUBSYSTEM=="net", ATTRS{address}=="00:1e:58:48:33:08", NAME="lan"
+
   SUBSYSTEM=="net", ATTR{address}=="00:1e:58:48:33:08", NAME="lan"
 
   SUBSYSTEM=="net", KERNEL=="tap1", NAME="vpn"
 
   SUBSYSTEM=="net", KERNEL=="tap1", NAME="vpn"
 
   SUBSYSTEM=="net", KERNEL=="tap5", NAME="qemu"
 
   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.}}
  
 
===Option 2: ifrename===
 
===Option 2: ifrename===
 
Run ifrename directly
 
Run ifrename directly
  
   ifrename -i eth0 -n lan
+
   # ifrename -i eth0 -n lan
  
or create config file (/etc/iftab), for example:
+
or create config file ({{ic|/etc/iftab}}), for example:
  
 
  lan mac 00:0C:6E:C6:94:81
 
  lan mac 00:0C:6E:C6:94:81
Line 27: Line 32:
 
and run
 
and run
  
   $ ifrename -c /etc/iftab
+
   # ifrename -c /etc/iftab
  
 
==PPP interfaces==
 
==PPP interfaces==
Add into /etc/ppp/ip-up script following lines:
+
Add into {{ic|/etc/ppp/ip-up}} script the following lines:
  
 
   IF=$1
 
   IF=$1
Line 37: Line 42:
 
   /sbin/ifconfig <NEWNAME> up
 
   /sbin/ifconfig <NEWNAME> up
  
where NEWNAME is new name for ppp interface
+
where <NEWNAME> is the new name for the ppp interface

Revision as of 21:13, 8 January 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#)

Prerequisites

  • ifrename tool which is a part of the wireless_tools package.
  • udev package, which is already installed, of course.

Generic network interfaces

Option 1: udev

Create /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.

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:

 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