# FreeBSD Wireless Repeater on the same device



## dkovacevic (Dec 23, 2010)

I want to use my wireless "ath0" device to both 1. host an AP, and 2. connect to another AP. Here are the steps I've taken:


```
ifconfig wlan0 create wlandev ath0 wlanmode hostap
ifconfig wlan1 create wlandev ath0
ifconfig bridge create
```

At this point, the interfaces are all there, including an empty "bridge0".


```
ifconfig bridge0 addm wlan0 addm wlan1
ifconfig bridge0 up
ifconfig wlan0 promisc ssid Kovacevic3 mode 11g channel 3
ifconfig wlan1 promisc ssid Kovacevic wepmode on weptxkey 1 wepkey 1:0x9C23B9A641
ifconfig wlan0 up
ifconfig wlan1 up
```

Don't ask about the WEP. Anyway, here is part of the output of "ifconfig" after running the above:


```
wlan0: flags=28943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,PPROMISC> metric 0 mtu 1500
        ether 00:25:d3:12:fd:9b
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        ssid Kovacevic3 channel 3 (2422 Mhz 11g) bssid 00:25:d3:12:fd:9b
        regdomain 96 indoor ecm authmode OPEN privacy OFF txpower 20
        scanvalid 60 protmode CTS wme burst dtimperiod 1 -dfs
wlan1: flags=28943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,PPROMISC> metric 0 mtu 1500
        ether 00:25:d3:12:fd:9b
        media: IEEE 802.11 Wireless Ethernet DS/1Mbps mode 11g
        status: associated
        ssid Kovacevic channel 6 (2437 Mhz 11g) bssid 00:22:22:02:22:22
        regdomain 96 indoor ecm authmode OPEN privacy ON deftxkey 1
        wepkey 1:40-bit txpower 20 bmiss 7 scanvalid 60 bgscan bgscanintvl 300
        bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS wme burst
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 3a:d3:e9:e5:49:cd
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: wlan1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 7 priority 128 path cost 33333
        member: wlan0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 6 priority 128 path cost 33333
```

I also tried setting the bridge to "promisc" mode after:


```
ifconfig bridge0 promisc
```

However, the results are the same. wlan1 stays associated with the access point I am trying to connect to, wlan0 is visible to other wireless devices, and I cannot pass any traffic through the bridge.

Is this just not possible to do on a single device? I got the idea to do it this way from dd-wrt, which allows "repeater bridge" mode.


----------



## SirDice (Dec 24, 2010)

Not all wireless drivers allow you to bridge them. This has to do with being able to 'spoof' a MAC address and not all drivers allow this.


----------



## dkovacevic (Dec 24, 2010)

Hey SirDice, thanks for the reply- it lead me in the right direction. I found that the issue doesn't actually seem to be the wireless driver- but it does have something to do with the if_bridge driver. Wireless clients only register their specific MAC addresses with the AP- so how could you bridge a wireless client? It would break the protocol.

So (just out of curiosity), does anybody know how "repeater bridge" mode works in dd-wrt? I had the idea that it might work by registering every MAC address separately (as opposed to doing everything through one connection). Wow, if that was how it works, there would be a lot of overhead...


----------



## dkovacevic (Dec 24, 2010)

Figured it out. dd-wrt uses arpnat to do the bridging of wireless devices.


----------

