LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 04-20-2013, 05:32 PM   #1
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 314
Blog Entries: 1

Rep: Reputation: 31
Ethernet mac address changing randomly


I'm using Debian wheezy with kernel 3.2.0-4-686-pae but sometimes my mac address is changing randomly. Really I didn't find anything that could be chinging mac addr within my /etc/init.d/ scripts.
Now I tried to settle mac address within /etc/network/interfaces, but I'm not sure if it will fix it.
I need mac addr to remain always the same as long as I use wake on lan feature.

Code:
auto eth0                                                                       
                                              
iface eth0 inet static                                                          
                                              
  address 192.168.1.2                                                    
  netmask 255.255.255.0
  gateway 192.168.1.1
  # BOF: Habilitar Wake-On-Lan
  pre-up ifconfig $IFACE hw ether ba:87:7e:e6:02:05
  post-up /sbin/ethtool -s $IFACE wol g 
  post-down /sbin/ethtool -s $IFACE wol g || ifconfig $IFACE hw 
ether ba:87:7e:e6:02:05
  # EOF: Fin habilitar Wake-On-Lan
Any ideas on why mac address could be changed randomly?

Thanks!
 
Old 04-20-2013, 08:55 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,539

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
the MAC address on a NIC can not change. do you have more then one NIC in your system? it could be that eth0 is swapping between the different NICs.
 
Old 04-20-2013, 10:44 PM   #3
bcwagne
Member
 
Registered: Feb 2008
Distribution: Debian, OSX, PCBSD
Posts: 162

Rep: Reputation: 31
Yes, this is what is happening. Debian, by default, uses dynamic assignments for network interfaces.
 
Old 04-21-2013, 12:20 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,539

Rep: Reputation: 462Reputation: 462Reputation: 462Reputation: 462Reputation: 462
Quote:
Originally Posted by bcwagne View Post
Yes, this is what is happening. Debian, by default, uses dynamic assignments for network interfaces.
are you talking about my response with multiple NICs in his system?
 
Old 04-21-2013, 08:09 PM   #5
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 314
Blog Entries: 1

Original Poster
Rep: Reputation: 31
Yes, I found this behaviour weird, as long ethernet mac address should not change, but it's changing. I only have one NIC in this box.
Is there any way to disable this "dynamic" assignment of mac address? I couldn't find anything within /etc/init.d/ sysv scripts.

Thanks for your answers, regards-
 
Old 04-21-2013, 08:59 PM   #6
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
Quote:
Yes, I found this behaviour weird, as long ethernet mac address should not change, but it's changing.
How do you know it is changing?. Can you show/explain really how you confirmed MAC address is changing?.
 
Old 04-21-2013, 11:51 PM   #7
gdizzle
Member
 
Registered: Jul 2012
Posts: 203

Rep: Reputation: Disabled
Are you using a Virtual machine?? KVM, vmware, virtual box?

Yes how do we know the MAC ADDRESS is actually changing?

Do an ifconfig and get your MAC ADDRESS, reboot the system and get the MAC ADDRESS again. Did it change on reboot?

Or have you got something strange going on with UDEV? Look in here for any extra rules especially under network.

You can set your MAC ADDRESS statically with ifconfig:

Code:
ifconfig <interface> hw ether 00:11:22:33:44:55
Get someone here using Debian to confirm your /etc/network/interfaces file it looks a bit whack.
 
Old 04-22-2013, 03:15 AM   #8
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,367

Rep: Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782Reputation: 782
I think you are getting confused here, why are you doing the folowing?
Code:
pre-up ifconfig $IFACE hw ether ba:87:7e:e6:02:05
The MAC address is a hardware address built into every network card which ordinarily will never change. It does not need to be changed by you unless you have a specific reason to do this. If you want to use Wake on LAN you do not need to give your card a MAC address you need to make note of hthe MAC address given in ifconfig without trying to set the MAC address as you do above and use that MAC address to wake the machine.
 
Old 04-22-2013, 07:33 AM   #9
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 314
Blog Entries: 1

Original Poster
Rep: Reputation: 31
Thanks for your feedback folks.
I noticed my mac addr was changing cos' I'm using wakeonlan feature, using wakeonlan program that pacakage the "magic packet" (ethernet frames for wol) within an udp datagram. Everything works fine for a while, but then I found a change with mac address and it stops working.

As long as hardware mac address could not change (it can only be "faked" by software). For the udp to reach my machine I had to do a "mac-binding" in my router (tp-link). This is adding a fixed entry within router's ARP table as far as I'm concerned. That way udp datagram can reach the final destination.

I added those entries within my /etc/network/interfaces just to try if that way mac addr remains settled.
 
Old 04-22-2013, 05:19 PM   #10
gdizzle
Member
 
Registered: Jul 2012
Posts: 203

Rep: Reputation: Disabled
do an :

Code:
ifconfig -a
make sure you have no more interfaces then you think.

cat
Code:
/etc/udev/rules.d/70-persistent-net.rules
Or the Debian equivalent and check for inconsistencies.

Is the MAC address usually one of 2 addresses or is it RANDOM everytime? Do some restarts collect some stats.
 
Old 04-23-2013, 09:27 AM   #11
matiasar
Member
 
Registered: Nov 2006
Location: Argentina
Distribution: Debian
Posts: 314
Blog Entries: 1

Original Poster
Rep: Reputation: 31
Hi gdizzle,

There's only one nic in this box. And nothing appears strange with udev rules.
I'll do some tests and try to check if there's something tricky with the router and the WOL stuff.

Thanks!
 
  


Reply

Tags
address, changing, mac


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
Ethernet/MAC address using Python tank junior Linux - Newbie 2 11-23-2010 10:23 PM
CentOS command-line Program to Randomly change my MAC address? kexpert Linux - Newbie 3 11-08-2009 12:18 AM
Ethernet MAC Addresses database; MAC address-based processing cctualatin Linux - Newbie 1 04-14-2009 08:59 AM
changing ethernet mac address and retaining the same after reboot guy24x Linux - Hardware 3 02-06-2009 06:51 AM
Randomly changing MAC address? sancho Linux - Hardware 4 11-24-2007 11:00 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration