Re: Bridge examples with Debian?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/08/2019 21:34, Paul Hoffman wrote:
> Greetings. I'm new to hostapd, but found it pretty straight-forward to
> configure for the simple case. I'm on Debian, and had no problem making
> my system an access point whose addresses are NATed (using very basic
> iptables). However, what I really want is to make the WAP bridged to the
> Ethernet port on the system.
> 
> Do folks here have reliable recipes for simple bridging with hostapd?
> Searching the internet came up with a couple of badly-documented
> conflicting answers. The description of "bridge=" in the sample config
> indicated that this might only work (and from starting hostapd with -d,
> it looks like I'm using the nl80211 driver), but I don't know the rest
> of the Debian-level commands to set up the bridge.
> 
> Clues appreciated.


I have an AP that runs Debian 9. It has 2 wireless interfaces (wlan0 and
wlan1) which are bridged to one of the Ethernet interfaces (eth1).

Extract from /etc/network/interfaces:

===begin===
auto br0
iface br0 inet static
        address 192.168.1.2
        netmask 255.255.255.0
        broadcast 192.168.1.255
        network 192.168.1.0
        bridge_ports eth1
        post-up /sbin/brctl stp br0 off

auto eth1
iface eth1 inet manual
        post-up ip link set eth1 txqueuelen 2

auto wlan1
iface wlan1 inet manual
        pre-up ifconfig wlan1 down || /bin/true
        pre-up rmmod ath10k_pci ath10k_core || /bin/true
        pre-up modprobe ath10k_pci && sleep 5s
        pre-up iw reg set BE
        post-up iw dev wlan1 set 4addr on || /bin/true
        post-up ip link set wlan1 txqueuelen 12
        hostapd /etc/hostapd/hostapd.wlan1.conf
        post-up /sbin/brctl addif br0 wlan1 || /bin/true
        post-up service shorewall restart
        pre-down /sbin/brctl delif br0 wlan1 || /bin/true
        pre-down /bin/kill -9 `cat /run/hostapd.wlan1.pid`
        post-down ifconfig wlan1 down

auto wlan0
iface wlan0 inet manual
        pre-up ifconfig wlan0 down || /bin/true
        pre-up rmmod ath9k ath9k_common ath9k_hw || /bin/true
        pre-up modprobe ath9k && sleep 5s
        pre-up iw reg set BE
        post-up iw dev wlan0 set 4addr on || /bin/true
        post-up ip link set wlan0 txqueuelen 12
        hostapd /etc/hostapd/hostapd.wlan0.conf
        post-up /sbin/brctl addif br0 wlan0 || /bin/true
        pre-down /sbin/brctl delif br0 wlan0 || /bin/true
        pre-down /bin/kill -9 `cat /run/hostapd.wlan0.pid`
===end===

Some of the above is not needed (and in fact results in error messages)
but I intend it to cover corner cases. An example is adding/removing the
wireless interfaces to/from the bridge. The shenanigans with ifconfig
and rmmod/modprobe enables me to independently bring the wireless
interfaces up/down with ifup/ifdown.

As you can see each wireless interface has its own hostapd instance.
Each of the hostapd configuration files contains bridge=br0.

HTH, Jan

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux