Craig Box's journeys, stories and notes...


Using udev to set network card order

Don't you hate it when you update a Linux machine, and the order that the network cards are detected, changes?

Code:

ifconfig | grep HWaddr | awk ' { printf"KERNEL==\"eth*\",SYSFS{address}==\"%s\", NAME=\"%s\"\n", $5, $1; }' > /etc/udev/rules.d/10-network-cards.rules

The cables don't change around, so neither should the order in which they come up.

Tags: ,

4 Responses to “Using udev to set network card order”

  1. Ian McDonald says:

    I presume you've got this working - I had to change it to use something other than eth to get interfaces to come up as udev using eth conflicted with kernel so I named mine lan0, lan1 and eth0/1 can change freely without affecting other things. My order varied per different kernel build etc. Drop me a line if you still have issues...

  2. PerryLorier says:

    Yeah, I recommend you completely change the name of the interfaces. Call them "external" (or "internet" (or "intarwebnet")), "dmz", "internal", "local" or whatever.

    (btw: Elmo has a cute burp)

  3. PerryLorier says:

    By the way, I like bears.

  4. javier says:

    Hi! i saw your coment in my blog asking me about one problem with nagios:

    ./check_snmp -H 10.226.131.184 -o 1.3.6.1.4.1.705.1.1.1.0
    SNMP OK - ” ” | iso.3.6.1.4.1.705.1.1.1.0=” “\uffffp\uffff\uffff\u0323\uff7f`\uffff\uffffp\uffff\uffff\uffff\uffff\uff7f@\uffff\uff7f\uffff\uffff\uff7f\uffff\uffff\uffff;;;;

    the problem is not the command snmp_get, the problem is in the plugin of Nagios. Mi solution was to modify the plugin and compile it. Then there were no more problems. I think this is the only way.

Leave a Reply