How can I clone a mac address on wlan0?

Daniel Eischen deischen at
Tue Mar 29 14:37:25 UTC 2011

On Mon, 28 Mar 2011, Doug Barton wrote:

> For a variety of boring reasons I need to clone a mac address on wlan0. The 
> documented way to do this:
> ifconfig wlan0 create wlandev wpi0 wlanaddr 00:11:22:33:44:55:66
> works in the sense that it sets up the interface with that mac, but then the 
> wlan0 interface never associates. Doing everything the same but omitting the 
> wlanaddr argument (which causes wlan0 to use the mac of the wpi0 device) 
> works.
> This also doesn't work in 8.2-RELEASE, so either we've got a long-standing 
> bug, or I'm doing something very wrong. The wpi0 card is an intel 3945abg, I 
> also have a couple of ath cards I can try (although so far they haven't 
> worked either).

Since wireless went to the cloned wlan device, this hasn't
worked.  Clone devices don't push the MAC addresses down
(at least the wlan clone doesn't).  I reported this problem
with lagg failover between wired and wireless.  Obviously
I wanted the wired connection as the primary and the wlan
device as secondary, so lagg would always end up using
the wired connection's (xl0 in my case) MAC address and
then trying to change wlan0's MAC address to the same when
it was selected during failover.

So I had to put this:

   ifconfig_ath0="ether 00:08:74:4b:88:b2"
   ifconfig_wlan0="ssid FOO_SSID wepkey1:..."
   ifconfig_lagg0="laggproto failover laggport xl0 laggport wlan0"
   ifconfig_lagg0_alias0="inet a.b.c.d netmask 0xffffff00"

into rc.conf.  ath0's MAC is my primary's (xl0) actual MAC

So I'm guessing if you put ifconfig_wpi0="ether 00:11:22:33:44:55:66"
in rc.conf, that would work.


More information about the freebsd-current mailing list