NICs are different after cloning



  • Hi!

    After cloning a PC - in my case with 3 NICs - the NICs are renamed on the clones, only the master keeps the original name (eth0, eth1, eth2) the clones do have unpredictable names like eth11, eth13, etc…

    This is because of a udev configuration.

    I worked around that problem with a script I wrote (see below).
    Thus I have a file in (/etc/rwh_nicreconfigured.txt) which must not be there before uploading the image - so if i forget to delete it, I have to make a new upload ;) .

    This reconfiguration works for at about 20 PCs out of 22.
    2-3 of them will be wrong afterwards.

    Can someone come up with a better idea?
    The cloned OS is OpenSuSE 12.1 but it happens to Ubuntu too

    Thanks a lot!

    Regards,
    Xibeaga


    [CODE]
    #!/bin/bash

    RWH

    OS: OpenSuSE 12.1

    Script stellt hardware der Netzwerkkarten neu ein

    echo "New NIC Recognition…"
    logger “New NIC recognition initialized”

    if [ -e /etc/rwh_nicreconfigured.txt ] ; then
    echo "NIC config is up to date - nothing changed"
    logger "NIC config UNCHANGED!!"
    exit;
    fi

    rm /etc/udev/rules.d/70-persistent-net.rules

    card=0
    for i in ip add|grep ether|sed -e 's/ \+/ /g'|sed -e 's/^ //g'|cut -d ' ' -f 2 ; do
    echo $i
    echo “SUBSYSTEM==“net”, ACTION==“add”, DRIVERS==”?", ATTR{address}=="$i", ATTR{dev_id}==“0x0”, ATTR{type}==“1”, KERNEL=="eth", NAME=“eth$card”" >> /etc/udev/rules.d/70-persistent-net.rules
    (( card=$card+1 ))
    echo “Network Reconfigured” > /etc/rwh_nicreconfigured.txt
    chmod a+r /etc/rwh_nicreconfigured.txt
    done
    echo "NICs reconfigured - reboot required"
    logger “NICs reconfigured - reboot required”

    sync
    reboot -f
    [/CODE]



  • Ok, Thanks! I will give it a try!



  • I usually just put a ‘#’ infront of the lines listing the NICs in '/etc/udev/rules.d/70-persistent-net.rules’
    So on the next boot he detects the NIC as new.


Log in to reply
 

417
Online

39.3k
Users

11.0k
Topics

104.6k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.