VectorLinux
October 24, 2014, 03:28:07 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Visit our home page for VL info. To search the old message board go to http://vectorlinux.com/forum1. The first VL forum is temporarily offline until we can find a host for it. Thanks for your patience.
 
Now powered by KnowledgeDex.
   Home   Help Search Login Register  
Please support VectorLinux!
Pages: [1]
  Print  
Author Topic: Stop network interfaces from switching names, the udev way.  (Read 18767 times)
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« on: November 20, 2006, 03:03:57 pm »

On VL 5.8, udev makes this very easy for you by providing an /etc/udev/rules.d/network-devices.rules file customized to your hardware (NOTE: this is actually not provided by default). In it you will find a line for each of your network interfaces, defined by MAC address. All you need to do is remove the comment markers (#) and edit the names as you want them. Here's an example of how this looks:

Code:
KERNEL=="eth?", SYSFS{address}=="00:c0:9f:f2:fd:c1", NAME="eth0"
KERNEL=="eth?", SYSFS{address}=="00:14:a5:28:68:3a", NAME="eth1"

As stated above, you only need to know which MAC address corresponds to which network adapter, then set the "NAME=" part as you want it. Keep in mind that ifplugd is set to handle only ethX type interfaces, so if you use a name like "wlan0", you will have to handle it another way (NOTE: seems it does handle wlan0).

If you change your network interfaces and want a new file set up automatically, simply delete the current file and udev should set a new one up for you on the next boot.
« Last Edit: February 14, 2007, 10:45:13 pm by Joe1962 » Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
The Headacher
Louder than you
Global Moderator
Vectorian
*****
Posts: 1551


I like the bass to go BOOM!


WWW
« Reply #1 on: November 21, 2006, 04:55:16 am »

Thanks Joe1962, I could really use this HOWTO. Those switching names are one of the most annoying 'features' in Linux IMO.
Logged

Most music on my soundcloud page was arranged in programs running on VL.
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #2 on: November 21, 2006, 10:30:12 am »

hmmm,what about if I dont have that file there?

Code:
root:# cd /etc/udev/rules.d/
vector://etc/udev/rules.d
root:# dir
10-vl-hot.rules  40-fuse.rules  41-kqemu.rules  libsane.rules  udev.rules
Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
The Headacher
Louder than you
Global Moderator
Vectorian
*****
Posts: 1551


I like the bass to go BOOM!


WWW
« Reply #3 on: November 21, 2006, 11:14:45 am »

Create one from Joe's example. I did and it works just fine. just change the hardware addresses.
Logged

Most music on my soundcloud page was arranged in programs running on VL.
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #4 on: November 21, 2006, 01:33:20 pm »

so i just create the file
/etc/udev/rules.d/network-devices.rules

and add this line in it (if i use only one of the two eths)

Code:
KERNEL=="eth?", SYSFS{80.80.128.50}=="00:c0:9f:f2:fd:c1", NAME="eth1"

thats not my real ip/mac btw (just cant remember them,hehe) Roll Eyes
Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #5 on: November 21, 2006, 02:51:27 pm »

Hmm, that's weird, the contents of my file include this:
Code:
# Local network rules to name your network cards.
# These rules were generated by nethelper.sh, but you can
# customize them.  By default, all rules are commented out.
# You will need to uncomment and edit them as needed.
# (If, for example, your machine has more than one network
# card and you need to be sure they will always be given
# the same name, like eth0, based on the MAC address)
#
# If you delete this file, /lib/udev/nethelper.sh will try to
# generate it again the next time udev is started.

So I figured it would be generated again if deleted...  Huh

@blurymind: it's okay to just create the file and add a line for your card, but your example is not quite right. The word "address" has to stay as it is, since it means the SYSFS parameter known as address will be used to compare with the MAC address you put after that. It's not a placeholder for your ip address.

Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #6 on: November 22, 2006, 12:18:16 am »

oh,thanks. Now im glad i asked.  Smiley so its only the mac adress thats needed there.
Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
Joe1962
Administrator
Vectorian
*****
Posts: 2499



WWW
« Reply #7 on: December 26, 2006, 07:39:20 am »

Well, this is just to confirm that the file isn't created automatically in RC 4.2, so it probably isn't in Gold, either. I don't know why it was there on my earlier RC, but at least it served to get this HOWTO done... Grin

Anyway, just create an empty file and paste the above lines, then fix the MAC addresses to the ones on your machine. Maybe running /lib/udev/nethelper.sh will also do it, as stated, but I haven't tried.
Logged

O'Neill (RE the Asgard): "Usually they ask nicely before they ignore us and do what they damn well please."
http://joe1962.bigbox.info
Running: VL 7 Std 64 + self-cooked XFCE-4.10
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #8 on: February 18, 2007, 01:52:35 pm »

might sound like a dumb question, but how do i see the mac adress of eth0 and eth1 on my own box?  Huh

edit: Oh i got it:

Code:
/sbin/ifconfig -a
« Last Edit: February 18, 2007, 01:54:29 pm by blurymind » Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
boris
Member
*
Posts: 24



WWW
« Reply #9 on: March 19, 2007, 04:27:15 pm »

I had the same problem - my box was assigning the eth0/1 numbers at random, so I never could be sure, what will happen upon the next boot.
The file etc/udev/rules.d/network-devices.rules was present, with all lines commented out.
I edited it like this:
Code:
KERNEL=="eth?", SYSFS{address}=="00:c0:9f:f2:fd:c1", NAME="eth0"
KERNEL=="wlan?", SYSFS{address}=="00:14:a5:28:68:3a", NAME="wlan0"
which corresponds exactly to their intended functionality.

Now I am going to reboot the computer and see what happens.

Best wishes
BNK
Logged

One skeptical donkey used to say: "You may scream 'Honey! Honey!" as loud as you can - it won't make sweet in your mouth..."
Tigerwolf
Vectorite
***
Posts: 152



« Reply #10 on: March 27, 2007, 02:12:55 pm »

Well, this is just to confirm that the file isn't created automatically in RC 4.2, so it probably isn't in Gold, either. I don't know why it was there on my earlier RC, but at least it served to get this HOWTO done... Grin

From the file's comments, it looks like *something* needs to run /lib/udev/nethelper.sh to create the rules file that has the commented-out rules.    But it looks like this script is also a service-like script that also attempts to manage the network connection as well (seems to talk about dhcp, etc).  I'm not sure what all it does, and I've not tried running it as I don't want to hose anything.   Maybe it needs to be in or called by the VL bootup routines at some point?



Logged

=^_^=  Tigerwolf

Running: Vector Linux 5.8 Standard   12-16-2006
blurymind
Packager
Vectorian
****
Posts: 1082



« Reply #11 on: April 26, 2007, 05:47:49 am »

ok guys, this is unbearably annoying..
I just installed a fresh vec58std aaand now after playing around with vasm and the file i created(/etc/udev/rules.d/network-devices.rules ) , i get an error at boot and there is no internet in vector.

The error message goes like something like this:
"cannot rename eth0_rename to eth1"

Any ideas ? I tried deleting the /etc/udev/rules.d/network-devices.rules file ,restarting and creating it again,but i get the same error.
 Sad

EDIT: ok,i think it works now..
« Last Edit: April 26, 2007, 06:30:10 am by blurymind » Logged

status: playing around with new tablet and learning to 3d :p
google page :  http://blurymind.googlepages.com
DA PAGE :  http://www.blurymind.deviantart.com/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!