You are not logged in.

#1 2012-03-14 15:43:29

emk
Member
Registered: 2010-05-11
Posts: 39

How to set mac/hardware address for network interface?

I have a network bridge with interfaces br0 and eth0. I use mac address filtering on my router to hand out IP addresses via dhcp. My problem is that every time the network comes up on my machine the br0 address is given a different mac address, which means that the machine gets a different IP address. Is there a way I can force the br0 interface to use eth0's mac address? Or at least use the same mac address every time?

Offline

#2 2012-03-14 15:47:26

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: How to set mac/hardware address for network interface?

Take a look here.


Burninate!

Offline

#3 2012-03-14 17:42:32

emk
Member
Registered: 2010-05-11
Posts: 39

Re: How to set mac/hardware address for network interface?

Gcool, thanks but the spoof on boot did not work. So I created the /etc/rc.d/functions.d/macspoof file as shown there but on rebooting or restarting the network a random mac address is given to br0. Maybe the problem is that I need to change the mac address of br0 as opposed to eth0.

Offline

#4 2012-03-14 18:23:55

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: How to set mac/hardware address for network interface?

That would be the main idea, yes. Leave eth0 as it is, and assign a random mac address to br0 (which is different from eth0's mac address); which you then apply during boot time as indicated on the wiki page.


Burninate!

Offline

#5 2012-06-04 23:25:56

emk
Member
Registered: 2010-05-11
Posts: 39

Re: How to set mac/hardware address for network interface?

still trying to figure this out! The macspoof file is not working on boot. So am at a loss. any ideas anybody?

Offline

#6 2012-06-05 00:10:10

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: How to set mac/hardware address for network interface?

i do it using netcfg's PRE_UP functionality.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#7 2012-06-05 00:15:01

emk
Member
Registered: 2010-05-11
Posts: 39

Re: How to set mac/hardware address for network interface?

I'm doing this for a desktop machine thats always 'wired'. So I assumed netcfg was not necessary. But I'll take anything. How do you do it with netcfg. THe problem seems to be the macspoof file is not run on boot. If I run it manually at the command line I get:

   /etc/rc.d/functions.d/macspoof: line 5: add_hook: command not found

So I've resorted to putting the ip command in my rc.local followed by a 'dhclient br0'

Offline

#8 2012-06-05 00:20:20

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: How to set mac/hardware address for network interface?

You don't necessarily need netcfg to get networking. But I used it before for my wireless on my laptop, so I just used the same on my desktop too. Also if you want to do things like this its easier rather than have to go digging around with macspoof and what not. your netcfg eth0 file could be something like

PRE_UP='ip link set eth0 address XX:XX:XX:XX:XX:XX'
CONNECTION='ethernet'
DESCRIPTION='A basic dhcp ethernet connection using iproute'
INTERFACE='eth0'
IP='dhcp'

If you use a different interface then obviously, you need to change it accordingly


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB