-   Debian (
-   -   How to change MAC address automatically on boot (

rollo 03-05-2006 12:49 PM

How to change MAC address automatically on boot
I would like to get the MAC address of my ethernet port changed automatically at boot. (Because spoofing the card of another machine.)

At the moment I put the lines


ifdown eth0
/sbin/ifconfig eth0 hw ether 00:00:00:00:00:00
ifup eth0

into my /etc/init.d/rc.local file. Which means that the network has to start and fail before the MAC address is set correctly.

Is there a better way of doing this?

Centinul 03-05-2006 01:19 PM

there is a package out there called machchanger. As far as running this software there is various ways you could do it. You could have it start up before your network (or have you network "depend" on it) or there might be a way to put it in your network configuration file. I run Gentoo and I'm able to change my MAC in the network configuration file. It makes for a nice simple change and works great. I hope this helps.

Wells 03-06-2006 08:15 AM

Or you could simply put the option into /etc/network/interfaces:

iface eth0 inet dhcp
hwaddress ether 00:00:00:00:00:00

I am sort of guessing at the exact form of this, but if you read the manpage interfaces(5) you should be able to figure it out.

rollo 03-07-2006 05:47 PM

Thanks both of you for those helpful suggestions.

I did already try fiddling with the interfaces file without luck. But now I will try again with the suggested syntax and variations of it.

Thanks again for the pointers.

ok4life 10-16-2006 05:22 PM

edit ifcfg-eth_ default RH/FC /etc/sysconfig/network-scripts/ifcfg-eth_ (not sure on debian _ = device Ex ifcfg-eth0)

Remove HWADDR=00:00:00:00:00:00

use all caps/num correct amt of char I have left HWADEDR in before and no prob but doc's say that if both exist it could have unexpected outcome be sure thats the only mac on your net

All times are GMT -5. The time now is 07:38 PM.