View previous topic :: View next topic |
Author |
Message |
heilong n00b
Joined: 23 May 2005 Posts: 45
|
Posted: Tue Oct 31, 2006 11:31 am Post subject: How to make eth1 named as wlan0? |
|
|
Hello guys. I was wondering... lots of folks keep to referring to their wireless device as wlan0, mine is eth1.
Is there any useful udev rule to name it wlan0 or maybe it's just some drivers do this themselves? |
|
Back to top |
|
|
anime-otaku Apprentice
Joined: 24 Apr 2006 Posts: 181 Location: Germany
|
Posted: Tue Oct 31, 2006 11:55 am Post subject: |
|
|
That comes partly (or maybe completely) through the driver you use for this. I'm using for example the ndiswrapper with windows driver and have wlan0 as name or with my other pcmcia card I have rt0 as name, because this uses rt2500. _________________ Gentoo compiles you to heaven
There are 10 kinds of people. Those who understands BINARY and those who don't.
Answer the unanswered posts |
|
Back to top |
|
|
heilong n00b
Joined: 23 May 2005 Posts: 45
|
Posted: Tue Oct 31, 2006 12:07 pm Post subject: |
|
|
I see - kinda like FreeBSD. I'm 95% sure the name can be renamed with a udev rule, but I'm not sure how the rule should look |
|
Back to top |
|
|
JeliJami Veteran
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Tue Oct 31, 2006 12:38 pm Post subject: |
|
|
if you want to rename your interface, you can do it in /etc/conf.d/net:
Code: | $ cat /etc/conf.d/net.example
...
# If you are unable to write udev rules, then we do provide a way of renaming
# the interface based on it's MAC address, but it is not optimal.
# Here is how to rename an interface whose MAC address is 00:11:22:33:44:55
# to foo1
#rename_001122334455="foo1"
# You can also do this based on current device name - although this is not
# recommended. Here we rename eth1 to foo2.
#rename_eth1="foo2"
...
|
_________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54234 Location: 56N 3W
|
Posted: Tue Oct 31, 2006 12:50 pm Post subject: |
|
|
heilong,
Unless you define some udev rules o rename the interface, udev uses the name offered by the kernel, which comes from the driver.
You can rename your interfaces to anything you like, like this:-
Create a file /etc/udev/rules.d/03-local-net.rules
Code: | KERNEL=="eth*", SYSFS{address}=="00:26:54:0b:c6:c6", NAME="eth_lan"
KERNEL=="eth*", SYSFS{address}=="00:0c:6e:14:c8:e7", NAME="eth_spare" |
This names my interfaces based on their kernel names and MAC addresses.
MAC address need to use lower case letters here. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
heilong n00b
Joined: 23 May 2005 Posts: 45
|
Posted: Tue Oct 31, 2006 1:39 pm Post subject: |
|
|
Thanks for the easy way, davjel.
NeddySeagoon, thanks for telling how to write udev rules - I prefer to know stuff like that before allowing
the distribution to config it for me. Where can I find some info on what's available beside SYFS{address}?
Do you think the MAC address matching is the best way to go? |
|
Back to top |
|
|
orionas n00b
Joined: 19 Sep 2006 Posts: 13 Location: Greece
|
Posted: Tue Oct 31, 2006 3:24 pm Post subject: |
|
|
Hi,
In my /etc/modules.d/aliases I use the following
Code: |
# Ethernet
alias eth0 8139too
alias eth1 ipw2100
alias eth2 eth1394
|
Run once to update /etc/modprobe.conf
and I make sure the modules are loaded in the order above
Then you can guess what happens
Of course you want the opposite and your modules have different names, but it's
easily adaptable.
Maybe this will work for you! _________________ It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54234 Location: 56N 3W
|
Posted: Tue Oct 31, 2006 4:10 pm Post subject: |
|
|
heilong,
The MAC address is supposed to be unique, so yes, it should always work.
I had some problems with my interfaces starting in an indetermanate order, this fixed it.
Read about udev rules thats written by a Gentoo Developer. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
heilong n00b
Joined: 23 May 2005 Posts: 45
|
Posted: Wed Nov 01, 2006 2:19 am Post subject: |
|
|
Great URL, thanks! |
|
Back to top |
|
|
acoul n00b
Joined: 19 Jan 2005 Posts: 29
|
Posted: Fri Nov 03, 2006 4:17 pm Post subject: |
|
|
you can also use the "ifrename" utility |
|
Back to top |
|
|
jerkface n00b
Joined: 19 Apr 2004 Posts: 65 Location: Tacoma, Wa
|
Posted: Fri Jan 05, 2007 5:05 am Post subject: |
|
|
NeddySeagoon wrote: | heilong,
Unless you define some udev rules o rename the interface, udev uses the name offered by the kernel, which comes from the driver.
You can rename your interfaces to anything you like, like this:-
Create a file /etc/udev/rules.d/03-local-net.rules
Code: | KERNEL=="eth*", SYSFS{address}=="00:26:54:0b:c6:c6", NAME="eth_lan"
KERNEL=="eth*", SYSFS{address}=="00:0c:6e:14:c8:e7", NAME="eth_spare" |
This names my interfaces based on their kernel names and MAC addresses.
MAC address need to use lower case letters here. |
Code: | KERNEL=="eth*", SYSFS{address}="00:10:a4:85:a9:44", NAME="eth0"
KERNEL=="eth*", SYSFS{address}="00:e0:98:ae:9c:94", NAME="wlan0" | This is what I have in 10-local.rules, but it doesn't work. If I load my wireless module first, wireless is set to eth0 and ethernet is set to eth1, and if I load the ethernet first, ethernet is set to eth0 and wireless is set to eth1_rename . Both MACS were copied and pasted. wtf? [/quote] _________________ Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs! |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Fri Jan 05, 2007 9:19 am Post subject: |
|
|
jerkface wrote: | SYSFS{address}= |
Should be two equals signs - it's a comparison, not setting a value. |
|
Back to top |
|
|
jerkface n00b
Joined: 19 Apr 2004 Posts: 65 Location: Tacoma, Wa
|
Posted: Fri Jan 05, 2007 9:20 am Post subject: |
|
|
d'oh! _________________ Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs! |
|
Back to top |
|
|
jerkface n00b
Joined: 19 Apr 2004 Posts: 65 Location: Tacoma, Wa
|
Posted: Fri Jan 05, 2007 9:53 am Post subject: |
|
|
Now my ethernet always comes up as eth0, but my wireless always comes up as eth1 instead of wlan0. I don't even have a symlink for net.eth1. _________________ Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs! |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Fri Jan 05, 2007 10:05 am Post subject: |
|
|
I use:
Code: | SUBSYSTEM=="net", ATTR{address}=="00:14:af:07:a0:80", NAME="wlan" |
eth1 is probably what the normal udev rules assign it, if your rule does not match because of the bad KERNEL comparison.
Edit: Changed KERNEL=="wlan*" to SUBSYSTEM=="net"
Last edited by PaulBredbury on Tue Jan 30, 2007 4:07 pm; edited 1 time in total |
|
Back to top |
|
|
jerkface n00b
Joined: 19 Apr 2004 Posts: 65 Location: Tacoma, Wa
|
Posted: Fri Jan 05, 2007 5:39 pm Post subject: |
|
|
I just solved my problem. Every time I loaded the prism54 module, udev read the following line from 70-persistent-net.rules Code: | # PCI device 0x1260:0x3890 (yenta_cardbus)
#SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:30:b4:00:00:00", NAME="eth1" | I commented it out, but udev just wrote another entry, so I just edited to NAME="wlan0" and it works.
Thanks for the help! _________________ Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs! |
|
Back to top |
|
|
PaulBredbury Watchman
Joined: 14 Jul 2005 Posts: 7310
|
Posted: Fri Jan 05, 2007 5:53 pm Post subject: |
|
|
You're still better off putting that line in 10-local.rules - because this file will not be played with by udev. |
|
Back to top |
|
|
jerkface n00b
Joined: 19 Apr 2004 Posts: 65 Location: Tacoma, Wa
|
Posted: Fri Jan 05, 2007 6:05 pm Post subject: |
|
|
I'm not sure if udev will modify it, because the comments say I can edit it. Just to be on the safe side, I am still going to add this to 10-local.rules.
Thanks. Code: | # This file was automatically generated by the /lib/udev/write_net_rules
# program, probably run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line. |
_________________ Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs! |
|
Back to top |
|
|
|