View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 03-05-2006, 01:49 PM   #1
Registered: Apr 2004
Location: France
Distribution: Debian Sid (Kanotix)
Posts: 237

Rep: Reputation: 30
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?
Old 03-05-2006, 02:19 PM   #2
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
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.
Old 03-06-2006, 09:15 AM   #3
Registered: Nov 2004
Location: Florida, USA
Distribution: Debian, Redhat
Posts: 383

Rep: Reputation: 31
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.
Old 03-07-2006, 06:47 PM   #4
Registered: Apr 2004
Location: France
Distribution: Debian Sid (Kanotix)
Posts: 237

Original Poster
Rep: Reputation: 30
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.
Old 10-16-2006, 06:22 PM   #5
LQ Newbie
Registered: Oct 2006
Posts: 24

Rep: Reputation: 15
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change MAC address cain_eve Linux - Software 11 02-05-2009 02:52 PM
to change outgoing mac and ip address korenje Linux - Networking 3 12-31-2005 01:41 AM
change mac address possible? kahn Linux - Networking 4 04-22-2005 05:43 AM
MAC address change? w9q Linux - Networking 3 09-10-2004 03:42 AM
MAC address change not working mehargags Slackware 4 03-21-2004 12:08 PM

All times are GMT -5. The time now is 03:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration