Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to rename wireless interface on bootup using ifrename
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
krosswindz
n00b
n00b


Joined: 15 Oct 2004
Posts: 39

PostPosted: Tue Feb 15, 2005 3:12 pm    Post subject: How to rename wireless interface on bootup using ifrename Reply with quote

I have the intel pro wireless 2200 BG card in my laptop. Before version 1.0.0 I had the option of setting the interface name as wlan%d using the ifname module parameter. From 1.0.0 ipw2200 uses regular kernel way to change interface name using ifrename. I have the iftab setup but I want to be able to choose the correct interface name when the module is loaded. The problem being that I use lvm and my /usr is not mounted until after all my modules are loaded because of which hotplug isnt able to rename my device correctly. Any idea as to what I could do to solve this problem. Any help on this is appreciated
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Tue Feb 15, 2005 11:30 pm    Post subject: Reply with quote

I used to use /etc/modules.d/aliases:
Code:
echo "alias eth1 ipw2200" >> /etc/modules.d/aliases && /sbin/modules-update


to ensure that my interface was always eth1. I don't know if this will work for wlan0, but you could try it.
Back to top
View user's profile Send private message
krosswindz
n00b
n00b


Joined: 15 Oct 2004
Posts: 39

PostPosted: Wed Feb 16, 2005 5:57 am    Post subject: Reply with quote

I tried the alias with wlan0, it never worked. If I rmmod ipw2200 and then modprobe it again it comes as wlan0 because of hotplug. It doesnt do that on the first autoload. I just want the first autoload to work. Thanks for the help
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Wed Feb 16, 2005 7:03 am    Post subject: Reply with quote

This has changed in version net-wireless/ipw2200-1.0.1 not 1.0.0. I had 1.0.0 installed until this morning. I have now installed 1.0.1 and the behaviour has changed. My interface is now called eth0 and as you rightly say, the alias does not change it to eth1. I'm going to downgrade...
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Wed Feb 16, 2005 7:39 am    Post subject: Reply with quote

Have a look at this thread on the ipw2100 mailing list, in particular the first and second replies:
http://sourceforge.net/mailarchive/message.php?msg_id=10808215

Brix suggests that this is documented in the CHANGES file, however I could not see it:
Code:
less /usr/share/doc/ipw2200-1.0.1/CHANGES.gz


Hopefully Brix will see this thread and let us know where it is mentioned...

The third reply suggests a fix using UDEV. I am testing now and will let you know if it works for me.

P.S. shouldn't this thread be in Networking & Security...
Back to top
View user's profile Send private message
thesnowman
Guru
Guru


Joined: 08 May 2003
Posts: 365
Location: Sydney, Australia

PostPosted: Wed Feb 16, 2005 8:09 am    Post subject: Reply with quote

Got it to work with the following udev rule in /etc/udev/rules.d/10-udev.rules:
Code:
KERNEL="eth*", SYSFS{address}="00:0e:35:6f:33:66", NAME="wlan0"


Obviously change the mac address to match your adapter.

I used
Code:
# udevinfo -a -p /sys/class/net/eth0/
as specified in the writing udev rules document to determine the mac address. ifconfig printed it in CAPS which obviously wouldn't match.
Back to top
View user's profile Send private message
krosswindz
n00b
n00b


Joined: 15 Oct 2004
Posts: 39

PostPosted: Tue Feb 22, 2005 4:02 am    Post subject: Reply with quote

Thanks for the tip, it worked. Another quick question is it possible to free up eth1 so that some other device can use it instead of it being named eth2, probably I am asking for too much ;)
Back to top
View user's profile Send private message
ribx
Apprentice
Apprentice


Joined: 20 Nov 2003
Posts: 219
Location: germany

PostPosted: Sat Feb 26, 2005 3:42 pm    Post subject: Reply with quote

i am not running udev. here how i did it:

echo '<new_name> mac xx:xx:xx:xx:xx:xx' >> /etc/iftab

reload the module. thats all. it seems that the driver reads it out. i dont understand it realy but it works ;)

for more info:
man ifrename
man iftab

first i though i have to run ifrename, but when i did it it told me that the device was busy. so i tried to reload it with modprobe et voila:
Code:
wlan0     IEEE 802.11g  ESSID:"LUTZHOME"  Nickname:"LUTZHOME"
          Mode:Managed  Frequency:2.457 GHz  Access Point: 00:04:E2:B6:C2:BA
          Bit Rate=54 Mb/s   Tx-Power=255 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:AF91-2211-84AB-CDEF-0987-6543-21   Security mode:open
          Power Management:off
          Link Quality=96/100  Signal level=-31 dBm  Noise level=-85 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

it works (without running ifrename :/ )

-ribx
_________________
The adopt an unanswered post initiative
Back to top
View user's profile Send private message
krosswindz
n00b
n00b


Joined: 15 Oct 2004
Posts: 39

PostPosted: Mon Feb 28, 2005 4:25 pm    Post subject: Reply with quote

The reason that works is that you are using hotplug. When you load the module hotplug looks for /etc/iftab and see that you have /etc/iftab so uses ifrename to rename the module when you reinsert it. It doesnt seem to be able to pick it up when it boots which kind of baffles me. I dont want to go through the process of reinserting the module every boot. udev rule works for me.
Back to top
View user's profile Send private message
KhanReaper
n00b
n00b


Joined: 21 Sep 2004
Posts: 37

PostPosted: Wed Jun 22, 2005 5:55 pm    Post subject: Reply with quote

What system package provides ifrename and iftab?
_________________
Even the Politburo concurs with Process of Elimination. Shouldn't you?
Back to top
View user's profile Send private message
ribx
Apprentice
Apprentice


Joined: 20 Nov 2003
Posts: 219
Location: germany

PostPosted: Wed Jun 22, 2005 7:23 pm    Post subject: Reply with quote

Code:
notebook ~ # qpkg -f `which ifrename`
net-wireless/wireless-tools *

_________________
The adopt an unanswered post initiative
Back to top
View user's profile Send private message
ribx
Apprentice
Apprentice


Joined: 20 Nov 2003
Posts: 219
Location: germany

PostPosted: Wed Jun 22, 2005 8:39 pm    Post subject: Reply with quote

i have another problem now:

i switched to the udev thing, because my wlan card has the mac address 00:00:00:00:00:00 if it is switched off by the hardware key. maybe you think that shouldnt be a problem, something like
Code:
wlan0 mac 00:0E:35:75:7C:07
wlan0 mac 00:00:00:00:00:00

would do the job, but there is one problem: i'm using the cisco vpn client. it loads a pseudo driver, which also has the mac address 00:00:...:00.

ok so far i was yesterday. then i desided to make this more comforable for me and use udev. but udev needs about 5 seconds to change the name of the wireless card from eth0 to wlan0. i dont want to add a 5 seconds sleep to my init.d script which loads ipw2200. thats too ugly. here some informations:
Code:
notebook ~ # grep eth /etc/udev/rules.d/10-local.rules
KERNEL="eth*",SYSFS{address}="00:0f:1f:25:89:79", NAME="eth0"
KERNEL="eth*", NAME="wlan0"

*  sys-fs/udev
      Latest version available: 056
      Latest version installed: 056
      Size of downloaded files: 468 kB
      Homepage:    http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
      Description: Linux dynamic and persistent device naming support (aka userspace devfs)
      License:     GPL-2

_________________
The adopt an unanswered post initiative
Back to top
View user's profile Send private message
rabinath
n00b
n00b


Joined: 03 Jan 2006
Posts: 31
Location: Germany

PostPosted: Tue Nov 28, 2006 11:05 am    Post subject: Reply with quote

Just for those using
Code:
KERNEL="eth*", SYSFS{address}="00:0e:35:6f:33:66", NAME="wlan0"

Since my latest udev update to sys-fs/udev-103 the code above did not work any longer. I had to change it a little (note the double ==) to:
Code:
KERNEL=="eth*", SYSFS{address}=="00:0e:35:6f:33:66", NAME="wlan0"
Back to top
View user's profile Send private message
bookstack
Apprentice
Apprentice


Joined: 27 Feb 2004
Posts: 245

PostPosted: Fri Feb 16, 2007 1:30 pm    Post subject: Reply with quote

Let me push it further:

Yes, we can set the udev rule by mac address, it also works.

How could we *automatically* rename the eth%d interface to wlan0%d, if the device is driven by ndiswrapper or ipw2200?
_________________
Refactor the life
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Feb 16, 2007 3:22 pm    Post subject: Reply with quote

bookstack wrote:
How could we *automatically* rename the eth%d interface to wlan0%d

I assume you mean %n - there is no %d in man udev. This is a bad question. The point of customizing udev is to unambiguously assign a meaningful name to devices. A name which contains a random number defeats the point of having meaning.

There are lots of threads of moaning about udev randomly rearranging e.g. eth0 and eth1, and thus messing up the networking :wink:

This is why the MAC address is used - it unambiguously identifies the device to rename. However, if you're sure that only 1 device in the PC is linked to ndiswrapper, then perhaps this will work:

/etc/udev/rules.d/10-local.rules
Code:
SUBSYSTEM=="net", DRIVERS=="ndiswrapper", NAME="wlan"
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum