I have t debian pc which is used as router.
I'm using hostapd for creating wireless acess point, and i've bridged ethernet and wifi using brige-utils. My /etc/network/interfaces

auto lo
iface lo inet loopback

setup bridge
auto br0
iface br0 inet static
    bridge_ports wlan0 eth0

My issue is that after system restart wifi connection(that is wlan0) doesn't added to brige automatically, thought it is supposed to. But then i restart networking or add wlan0 manually, everything works fine. Why can it be?

After system start brctl show:

bridge name  bridge id           STP     enabled interfaces
br0          8000.0030488e31ac   no      eth0

Right after /etc/init.d/networking restart

bridge name  bridge id           STP     enabled interfaces
br0          8000.0030488e31ac   no      eth0, wlan0

closed as off topic by Sven, mdpc, Michael Hampton, Ward, Khaled Apr 21 '13 at 9:25

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • just for the record, I do believe you need to set a default gateway if you are using bridging. In your specific case, I do believe you need to set up a DHCP server instead. If you already have a DHCP server elsewhere the configuration superuser.com/questions/694182/… would work (with one small tweak). I got pointed to this and I believe the selected answer is incorrect. – Journeyman Geek Dec 29 '13 at 11:49

A station vif cannot be added to a bridge as is (blame wifi's layer 2 for that). hostapd has to turn your (default) wlan0 station vif into an AP vif before adding that to a bridge (which is done by the bridge= hostapd configuration file option).

Therefore, you need to arrange a way to set up your bridge (without including wlan0) before starting hostapd.

  • I'm not shure i've understood you.. Yes, hostapd converts wlan into ap, but it's interface name remains the same for networking, isn't it? After all, when i just restarting networking daemon few seconds after system boot, everything appears at their places, and brige is fully operational – Quadrat137 Apr 20 '13 at 18:19
  • @Quadrat137: Nobody cares about the interface name. What i say is that you can't add ẁlan0 to a bridge before hostapd runs. Therefore, you need to make sure hostapd runs after br0 is configured and you should stop mentioning wlan0 in bridge_ports because it will fail anyway. – BatchyX Apr 20 '13 at 18:59
  • I thought that bridge creation will just fail, if wifi is not in AP mode, but it is created - that's confusing me – Quadrat137 Apr 20 '13 at 19:24
  • Bridge creation and adding ports are different commands. bridge creation will not fail, but wlan0 will not be part of it if it is not in AP mode (or another appropriate mode, like mesh or 4addr sta). To add to the confusion, hostapd may create br0 if it does not exist, but will not configure any IP, and it will destroy it when killed. – BatchyX Apr 20 '13 at 19:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.