LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Search this Thread
Old 02-02-2012, 04:18 AM   #1
LQ Newbie
Registered: Aug 2011
Posts: 28

Rep: Reputation: Disabled
Question Setting MAC Address using ip utility

Hello everyone, need some help.. I want to set a MAC Address to my device using the ip utility.. Is there any option available for it?? I use ip addr to set the IP, and ip route to set the gateway but not able to find anything for MAC Address setting.. Pls help

Old 02-02-2012, 04:49 AM   #2
Registered: Jul 2009
Posts: 569

Rep: Reputation: 42
Only way I know to change mac is, I use the command:

ifconfig eth0 hw ether new mac address
Old 02-02-2012, 04:50 AM   #3
LQ Newbie
Registered: Jan 2012
Posts: 14

Rep: Reputation: Disabled
For as far as I know, the MAC-address on a network-card cannot normally be changed, only on some routers and modems there are some ways to change it.
Maybe there are some EEPROM-rewrites possible but therefore you need special software for the network-card you have.
Ok, I'm also pretty new here so there might be a way - actually, why would you like to change the MAC-address?
Old 02-02-2012, 05:14 AM   #4
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,223

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
ip link set dev eth0 address YOUR_MAC_HERE
MAC can be freely changed, rather you mean that it can not be usualy stored on EEPROM, but for normal usage this is not needed. The reasons for changing MAC are few, for example: your Interbet provider may give you access to net depending on MAC and you changed motherboard with onboard net card or your card has been broken.

Last edited by eSelix; 02-02-2012 at 05:17 AM.
Old 02-02-2012, 03:44 PM   #5
Registered: Mar 2008
Posts: 11,781

Rep: Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449Reputation: 1449
Not all nic's and drivers for nic's support mac changes.

See this.

I read that the mac address can also be changed using just the ip command from the cml. It would be issued link ip link show eth0 to display the mac address.

Then shutting it down with ip link set dev eth0 down.
Changing the mac ip link set dev eth0 address XX:XX:XX:XX:XX:XX
Restarting it ip link set dev eth0 up

From here.
Old 02-03-2012, 09:55 PM   #6
LQ Newbie
Registered: Aug 2011
Posts: 28

Original Poster
Rep: Reputation: Disabled
Thanks everyone for yr help..
Old 02-03-2012, 11:15 PM   #7
LQ Newbie
Registered: Aug 2011
Posts: 28

Original Poster
Rep: Reputation: Disabled
Just a few more clarifications needed from u all.. I want the substitute rules using ip for setting the default gateway for my interface.. I used ip route to set the gateway value but couldnt set the default gateway still.. pls help
Old 02-03-2012, 11:20 PM   #8
LQ Newbie
Registered: Aug 2011
Posts: 28

Original Poster
Rep: Reputation: Disabled
Got it..
Its like this
ip route add default via <GW IP>


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 do I find what MAC address web pages see as my MAC address rob.rice General 20 05-29-2010 02:08 AM
[SOLVED] Setting MAC address on "Intel Corporation PRO/Wireless 2200BG" evo2 Linux - Hardware 2 12-19-2009 01:08 AM
Setting mac-address restrictions in dhcpd custangro Linux - Server 4 08-19-2008 06:33 PM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM

All times are GMT -5. The time now is 02:26 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 @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration