Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to make eth1 named as wlan0?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 45

PostPosted: Tue Oct 31, 2006 11:31 am    Post subject: How to make eth1 named as wlan0? Reply with quote

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
View user's profile Send private message
anime-otaku
Apprentice
Apprentice


Joined: 24 Apr 2006
Posts: 181
Location: Germany

PostPosted: Tue Oct 31, 2006 11:55 am    Post subject: Reply with quote

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
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 45

PostPosted: Tue Oct 31, 2006 12:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
JeliJami
Veteran
Veteran


Joined: 17 Jan 2006
Posts: 1086
Location: Belgium

PostPosted: Tue Oct 31, 2006 12:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Tue Oct 31, 2006 12:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 45

PostPosted: Tue Oct 31, 2006 1:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
orionas
n00b
n00b


Joined: 19 Sep 2006
Posts: 13
Location: Greece

PostPosted: Tue Oct 31, 2006 3:24 pm    Post subject: Reply with quote

Hi,
In my /etc/modules.d/aliases I use the following
Code:

# Ethernet
alias eth0 8139too
alias eth1 ipw2100
alias eth2 eth1394

Run
Code:
# modules-update
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
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Oct 31, 2006 3:42 pm    Post subject: Reply with quote

orionas wrote:
In my /etc/modules.d/aliases I use the following
Code:

# Ethernet
alias eth0 8139too
alias eth1 ipw2100
alias eth2 eth1394



That does not guarantee those names.
For example, without any modules loaded and you did `modprobe eth2` then your firewire would be assigned eth0.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Tue Oct 31, 2006 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 45

PostPosted: Wed Nov 01, 2006 2:19 am    Post subject: Reply with quote

Great URL, thanks!
Back to top
View user's profile Send private message
acoul
n00b
n00b


Joined: 19 Jan 2005
Posts: 29

PostPosted: Fri Nov 03, 2006 4:17 pm    Post subject: Reply with quote

you can also use the "ifrename" utility
Back to top
View user's profile Send private message
jerkface
n00b
n00b


Joined: 19 Apr 2004
Posts: 65
Location: Tacoma, Wa

PostPosted: Fri Jan 05, 2007 5:05 am    Post subject: Reply with quote

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? :twisted: [/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
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Jan 05, 2007 9:19 am    Post subject: Reply with quote

jerkface wrote:
SYSFS{address}=

Should be two equals signs - it's a comparison, not setting a value.
Back to top
View user's profile Send private message
jerkface
n00b
n00b


Joined: 19 Apr 2004
Posts: 65
Location: Tacoma, Wa

PostPosted: Fri Jan 05, 2007 9:20 am    Post subject: Reply with quote

d'oh! :oops:
_________________
Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs!
Back to top
View user's profile Send private message
jerkface
n00b
n00b


Joined: 19 Apr 2004
Posts: 65
Location: Tacoma, Wa

PostPosted: Fri Jan 05, 2007 9:53 am    Post subject: Reply with quote

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. :twisted:
_________________
Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs!
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Jan 05, 2007 10:05 am    Post subject: Reply with quote

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
View user's profile Send private message
jerkface
n00b
n00b


Joined: 19 Apr 2004
Posts: 65
Location: Tacoma, Wa

PostPosted: Fri Jan 05, 2007 5:39 pm    Post subject: Reply with quote

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! :twisted:
_________________
Most Linux users don't know this, but the man pages are named after Chuck Norris. Chuck Norris fscking hates noobs!
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Jan 05, 2007 5:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
jerkface
n00b
n00b


Joined: 19 Apr 2004
Posts: 65
Location: Tacoma, Wa

PostPosted: Fri Jan 05, 2007 6:05 pm    Post subject: Reply with quote

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. :twisted:
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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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