Cloning a MAC address

In response to how to set a NIC's MAC address asked on another forum [Astaro wants gear-head answers confined to this forum]:

ifconfig ethwhatever hw ether mac address

This is really a basic Linux question; a search returned the answer right away for me. I didn't mind at all answering it, but maybe you will find it quicker if you just try that first next time.

To know to do the search, you did have to know that the ifconfig command governs network interfaces. If you didn't know that, I would like to recommend "Advanced Linux Networking" [publisher Addison-Wesley] to come up to speed. In spite of its name, it is actually easy to follow, and has much useful information on the proxies that Astaro runs.

You will have to put that in one of the boot startup scripts in /sbin/init.d; check with more searches, or look at what's in that directory to start coming to an understanding of this distro's boot process.

Or if you're still hitting your head against the wall, ask another question of one of us on this forum...
  • Here's how I do it (Posted previously on ASL Forum 7/9/03):

    I presume yours is a cable modem.  I'm not sure whether this works with dsl or other forms of internet access.

    1. Copy /etc/itfhw.conf to a new file in /etc (let's name it macaddr). In macaddr, use Joe* to change the mac of the NIC connecting to the cable modem (usually eth1) to the spoof value you need (i.e the MAC of whatever NIC was connected to your cable modem before).

    2. Use Joe to edit /sbin/init.d/init_nics (row numbers indicated below are approximate): 

    a). after row 39 (which reads "ifconfig $nic down...."), and before the first "fi", insert: 

    ifconfig eth1 hw ether XX:XX:XX:XX:XX:XX (XX:XX:... is the spoof value you need; same as in macaddr). 

    b). after what is now Row 45 (which reads "/usr/local/bin/setitfhw.pl...."), and just above the ";;" which terminates (start), insert: 

    cp /etc/macaddr /etc/itfhw.conf. 

    NOTE: I'm not sure steps 1. and 2b). are really needed, but I use them. I strongly suspect you will need to reconstitute macaddr if any of the hardware settings for any of your ethernet cards change. 

    3. Reboot. (You probably can reinitialize without rebooting, but never having looked up when /etc/itfhw.conf and /sbin/init.d/init_nics do their jobs, I always reboot.) 

    *Joe is the simple text editor included with Astaro. It uses Wordstar-type commands. Type Ctrl-KH for the command list.