Problem renaming wireless interfaces

I want to rename a wireless interface. Right now I have 4 network interfaces, 2 Wireless, 2 Cable. the order is like this:

eth0 - Cable (Realtek RTL-8169)
eth1 - Cable (Intel 82579V)
eth2 - Wireless (Broadcom BCM4321 Proprietary Drivers)
wlan0 - Wireless (RaLink RT2800)

I want to rename eth2 to wlan1. This way the wireless cards are wlan and the cable ones are eth (The way I like it). How can I do this?

Using the suggestion made by virpara I found the following:

eth1 - e1000e wlan0 - rt2800 wlan1 - b43 eth2 - wl

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="38:60:77:ab:5e:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1814:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:02.0 (rt2800pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:9c:05:fd:28", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/ssb0:0 (b43-pci-bridge)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0 (wl)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

Now my questions are:

  1. Why wlan1 and eth2 have the same MAC?
  2. If there are 2 duplicated MACS (eth2 & wlan1) where is the other NIC?
  3. Why is Realtek (eth0) not appearing on the list?
  4. Where did wlan1 come from since I can not see it using ifconfig -a, iwconfig or lshw. There is no wlan1 except in the /etc/udev/rules.d/70-persistent-net.rules file.

Solution 1:

How to reorder or rename logical interface names in Linux

http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames

https://answers.launchpad.net/ubuntu/+question/62716

http://wishmesh.com/2009/09/ubuntu-server-rename-eth1-to-eth0/

Solution 2:

See the comment at the beginning of /etc/udev/rules.d/70-persistent-net.rules:

 # Entries are automatically added by the 75-persistent-net-generator.rules
 # file; however you are also free to add your own entries. 

That is an auto-generated (and possibly customized file).

/lib/udev/rules.d/75-persistent-net-generator.rules is where all the action takes place. It's hard to tell right now which entries are auto and which were added by you or some other application.

Try renaming 70-..... to an extension that is not .rules (or move to another directory). Then reboot, and paste the content of the "clean generated" 70-persistent-net.rules.

Solution 3:

gksudo gedit /etc/udev/rules.d/70-persistent-net.rules

you will have content as,

# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x11ab:0x4357 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:b3:7b:28:3d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3c:e0:f2:45", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

make changes accordingly in NAME=