wiki:Linux/Ubuntu/FixUdevWifiInterfaceNamingRule

Fix udev Wifi Interface Naming Rule

Having just updated the kernel I'm using with my Gutsty install to 2.6.25-rc9, rebuilt the nvidia drivers, and confirmed the default snd-hda-intel and iwl3945 modules work I was stumped that the wireless 802.11g interface didn't connect and NetworkManager and nm-applet couldn't see any wireless network devices. Then I found:

$ iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

kvm0      no wireless extensions.

pan0      no wireless extensions.

tun0      no wireless extensions.

eth1      no wireless extensions.

wlan0_rename  IEEE 802.11g  ESSID:""  
          Mode:Managed  Channel:0  Access Point: Not-Associated   
          Tx-Power=0 dBm   
          Retry min limit:7   RTS thr:off   Fragment thr=2352 B   
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Usually the wireless connection appears on eth1. After some searching I discovered Ubuntu bug #183968,  mac80211 "master" interface matches existing persistent network rules. The issue turns out to be with the udev script that names the interfaces and the reason is the newer wireless drivers present two interfaces, wmaster and wlan. The existing Gutsy udev rule /etc/udev/rules.d/70-persistent-net.rules doesn't discriminate on the type attribute and therefore assigns eth1 to the first interface presented, which is usually wmaster and therefore when the wlan interface is presented it can't be renamed to eth1 as well and gets called wlan0_rename.

# PCI device 0x8086:0x4222 (ipw3945)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:19:d2:1a:18:49", NAME="eth1"

The solution is to add an attribute match on type:

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:19:d2:1a:18:49", ATTRS{type}=="1", NAME="eth1"

After unloading and reloading the module:

$ iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

kvm0      no wireless extensions.

pan0      no wireless extensions.

tun0      no wireless extensions.

wmaster0  no wireless extensions.

eth1      IEEE 802.11g  ESSID:""  
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   
          Tx-Power=27 dBm   
          Retry min limit:7   RTS thr:off   Fragment thr=2352 B   
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

And NetworkManager once again configures the interface.