-1

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
    address 192.168.0.1
    netmask 255.255.255.0
    network 192.168.0.0

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?

Upd.
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
  • 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 http://superuser.com/questions/694182/how-and-why-is-this-ubuntu-system-getting-an-ipv6-address 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

1 Answers1

0

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.

BatchyX
  • 902
  • 4
  • 7
  • 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 – alex_java_kotlin 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 – alex_java_kotlin 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