LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2009, 02:19 AM   #1
christyyim
Member
 
Registered: Oct 2008
Location: earth
Distribution: Ubuntu 'Gutsy Gibbon'
Posts: 32

Rep: Reputation: 15
how to change the name of wlan0 to eth1 in ubuntu 8.04?


is there possible for me to change the name of "wlan0" of Wi-Fi card to "eth1" in ubuntu 8.04? What will be the command?

Thanks!
 
Old 03-19-2009, 02:47 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Either add an appropriate "ifrename" command to a startup script -- should be run before the interface is brought up --, or add a rule to /etc/udev/rules.d/70-persistent-net.rules -- at least this is how I would do it on my distribution.

To know your WI-FI card's MAC address -- which you will be linking eth1 to --, see output of
Code:
ifconfig -a|grep HWaddr

Last edited by Didier Spaier; 03-19-2009 at 02:53 AM.
 
Old 03-19-2009, 04:05 AM   #3
christyyim
Member
 
Registered: Oct 2008
Location: earth
Distribution: Ubuntu 'Gutsy Gibbon'
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks Didier Spaier for your quick reply.

However I not really understand what you mean since I just began with Linux OS

the output of the command "ifconfig -a | grep HWaddr" in my laptop was:
Code:
eth0      Link encap:Ethernet  HWaddr 00:1d:92:51:af:27  
wlan0     Link encap:Ethernet  HWaddr 00:1c:bf:98:b1:60  
wlan0:avahi Link encap:Ethernet  HWaddr 00:1c:bf:98:b1:60  
wmaster0  Link encap:UNSPEC  HWaddr 00-1C-BF-98-B1-60-00-00-00-00-00-00-00-00-00-00

The reason I wish to change the name of "wlan0" to "eth1" is because I have to develop a program that need to differentiate between wired and wireless interfaces. Previously I worked in Ubuntu 7.10. It gave me "eth0" and "eth1" which has different index. In Ubuntu 8.04, it gave me "eth0" and "wlan0" which are the same index. Hence, I wonder is there a way for me to rename "wlan0" to "eth1" in Ubuntu 7.10.

How is the "ifrename" command works?

Any advices are welcomed.

Thanks.
 
Old 03-19-2009, 05:06 AM   #4
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
To know how the "ifrename" command works:
Code:
man ifrename
To know how to write an udev rule:
Code:
man udev
or ask Google.

Nevertheless to differentiate between wired and wireless interfaces there are other methods.

In your case, a simple one is to check if the interface name begin with "wlan". If yes then it is wireless.

An other one -- more general -- is to check the output of "iwconfig" -- by the way somebody already told you that in another thread. For each interface, if you get "no wireless extensions." as an answer, it is not a wireless interface.

Last edited by Didier Spaier; 03-19-2009 at 06:30 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wlan0 traffic dependent on eth1! leeko Linux - Wireless Networking 2 06-19-2008 02:22 AM
change ipw220 interface name from eth1 to wlan0 zen0n Linux - Laptop and Netbook 3 08-23-2005 01:55 PM
wlan0 appears as eth1 and can't get an ip kovermours Linux - Wireless Networking 7 09-13-2004 04:55 PM
wireless eth1 to wlan0? ferreter Fedora 0 09-11-2004 02:19 PM
how do i rename wlan0 to eth1 laclac01 Linux - Networking 2 06-10-2004 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration