# Bridging help



## Hawk (Sep 12, 2018)

I'm trying to extend the wireless signal by setting up a bridge in accordance with the handbook section on bridging.
Inet<-->if_wlan0-bridged-if_wlan1<-->clients

`cat /etc/rc.conf`

```
<snip>
wlans_iwn0="wlan0"
wlans_urtwn0="wlan1"
create_args_wlan1="wlanmode hostap"

cloned_interfaces="bridge0"
ifconfig_bridge0="addm wlan0 addm wlan1 up"
ifconfig_wlan0="up"
ifconfig_wlan0="WPA DHCP"
ifconfig_wlan1="up"
ifconfig_wlan1="ssid extension mode 11g channel 8"
```

`tcpdump` does show traffic at least  flowing downstream, however I can't get DHCP responses to traverse the bridge.
Fresh FreeBSD install so no firewall.

Any idea on what I'm doing wrong?


----------



## SirDice (Sep 12, 2018)

This:

```
ifconfig_wlan0="up"
ifconfig_wlan0="WPA DHCP"
ifconfig_wlan1="up"
ifconfig_wlan1="ssid extension mode 11g channel 8"
```
Doesn't work like you think it does. The second definition overrules the first, so the 'up' is never executed. Keep in mind that rc.conf is in essence a shell script that only contains variables.


```
#!/bin/sh
VAR="1"
VAR="2"
echo $VAR
```

That bit of code would print "2" because the second VAR assignment overwrote the first. The same is true for variables in rc.conf.


----------



## Hawk (Sep 12, 2018)

SirDice said:


> Doesn't work like you think it does. The second definition overrules the first, so the 'up' is never executed. Keep in mind that rc.conf is in essence a shell script that only contains variables.


Corrected the file by amending "up" to the corresponding interface's string.
`tcpdump` now shows no traffic on wlan1 other than the downstream DHCP request (which does not get forwarded to the upstream side).


----------



## SirDice (Sep 12, 2018)

For wlan0 it probably didn't matter as the scripts that deal with WPA and DHCP already put the interface up, so there's no need to call it explicitly. I just thought you should be aware of it.


----------



## Hawk (Sep 12, 2018)

SirDice said:


> For wlan0 it probably didn't matter as the scripts that deal with WPA and DHCP already put the interface up, so there's no need to call it explicitly. I just thought you should be aware of it.



Please, be nitpicky. That's part of the learning process.

I've been working on this for about 3 days now. I started off using a Raspberry Pi using Raspbian, but it was a headache going back and forth between headless with the network to no-net but with a monitor was a pain (ssh was slow with net/headless). Tried Fedora laptop but they changed their bridging to "shared" and I'm not even sure if it is layer 2 forwarding.

I remembered FreeBSD being super easy for setting up bridges, so I put it on the Pi, but the wireless interfaces won't come up (thinking it was a power issue).

I'm at the point now that I'll dedicate a laptop to being the bridge, but now I can't get the packets to forward!

I tried routing but even then I can't get from a client to the upstream router directly. Checked the routing table, and it looked sane.

Maybe try routing again? I'm just trying to get improved inet *somehow* to my Joes. Back when the US Government/Military used Solaris, I'd simply go to our commo officer and get a solution without hassle. Now it seems (worryingly) that I'm the POSIX expert in my unit.


----------



## SirDice (Sep 12, 2018)

If I remember correctly some wireless drivers don't like to be bridged. In essence the interface has to spoof the original MAC address and not all wireless interface drivers allow this. This might be why traffic isn't being forwarded to the 'other side' of the bridge. I remember this being an issue at some point in time, but that particular issue may have been resolved already.


----------

