LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-29-2005, 04:25 AM   #1
htlin
LQ Newbie
 
Registered: Jun 2005
Posts: 5

Rep: Reputation: 0
Unhappy How to change MAC without letting eth0 down?


Hi All,

I would like to try to change MAC address while the network interface "eth0" is not going to be down.

Does anyone know how to achieve that?

psĄG I just can use "ifconfig" to down the "eth0" first and then change MAC and then up it.
 
Old 06-29-2005, 05:41 AM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
I thought MAC addresses were given to nic cards and could not be changed.
 
Old 06-29-2005, 06:19 AM   #3
sind
Member
 
Registered: Jun 2005
Posts: 75

Rep: Reputation: 15
Quote:
I thought MAC addresses were given to nic cards and could not be changed.
You can change the MAC address of a card temporarily under Linux with:

# ifconfig eth<n> down
# ifconfig eth<n> hw ether <MAC>
# ifconfig eth<n> up

Quote:
I would like to try to change MAC address while the network interface "eth0" is not going to be down.

Does anyone know how to achieve that?
AFAIK you have to take the interface down before changing the address. The Linux kernel prevents you from changing the MAC address on a running interface; I would guess that is to prevent bad things from happening...

~sind

Last edited by sind; 06-29-2005 at 06:21 AM.
 
Old 07-05-2005, 12:42 PM   #4
ubrals
LQ Newbie
 
Registered: Jul 2005
Distribution: Suse, Fedora
Posts: 1

Rep: Reputation: 0
Hi.

And how about to reset to the default MAC address?
I know I can do it by a script, but is there a parameter to reset to the default MAC address?
Does anybody know that?

thanks,

Miguel.
.
 
  


Reply



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
eth0 / 1 confused over MAC address?? Nickj Linux - Networking 3 08-22-2005 11:36 AM
MAC address change? w9q Linux - Networking 3 09-10-2004 02:42 AM
Letting normal user change apache directory nivek7 Linux - General 9 05-04-2004 06:58 PM
Change my MAC addr borbjo Linux - Networking 4 09-02-2003 06:33 PM
change MAC Cubiq Linux - Networking 5 08-22-2002 02:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:09 PM.

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