• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

NICs are different after cloning

Scheduled Pinned Locked Moved
Linux Problems
2
3
1.5k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X
    Xibeaga
    last edited by Apr 27, 2012, 8:07 AM

    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]

    1 Reply Last reply Reply Quote 0
    • A
      AsciiReign
      last edited by Apr 27, 2012, 12:18 PM

      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.

      1 Reply Last reply Reply Quote 0
      • X
        Xibeaga
        last edited by Apr 27, 2012, 12:41 PM

        Ok, Thanks! I will give it a try!

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          Last post

        152

        Online

        12.0k

        Users

        17.3k

        Topics

        155.2k

        Posts
        Copyright © 2012-2024 FOG Project