How can I clone a mac address on wlan0?

Bernhard Schmidt bschmidt at freebsd.org
Tue Mar 29 11:07:37 UTC 2011


On Tuesday, March 29, 2011 08:38:43 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).

I doubt the wlanaddr option is what you are looking for. This option
is only used (and valid) in multiple VAP setups. The BSSID is used to
filter frames, everything not to the BSSID (or multicast/broadcast)
gets dropped. With multiple VAPs you want to use different BSSIDs for
each AP. There are two options to achieve that, using the "bssid"
parameter which will generate a semi random MAC (based on the
hardware's MAC address) or the "wlanaddr" parameter which allows a user
to define the complete address. Whether the hardware does support
setting multiple BSSID filters is another story, I doubt we have one
in tree.. mostly the addresses are generated in such a way that for
example either the first 4 or last 4 bits are changed and therefore
a "wildcard" filter can be used. Now to the point, wpi(4) has no
support at all for multiple VAPs.. therefore no one ever had a look at
that.

Anyways.. you might want to look into the "link" option, changing the
wpi0's MAC will also change the one of wlan0.

-- 
Bernhard


More information about the freebsd-current mailing list