Submitted by cjj on
When you have a wire-connected computer with a unused wireless interface, an option is to use the device as an access point to improve the coverage of your WIFI network. This can be done by setting up hostapd, which takes care of wireless interface configuration, authentication and security. However, in order for the wireless traffic to actually go through the wired connection and onto the internet and vice versa, the two interfaces needed to be bridged somehow. There are several scenario for configuring the bridge connection. For the NetworkManager, this can be down with the following.
nmcli con del <existing connection for eth0> nmcli con add ifname br0 type bridge con-name lan nmcli con add ifname eth0 type bridge-slave master lan con-name eth0-lan
Afterwards, hostapd can be started with the following configuration:
interface=wlan0 bridge=br0 ctrl_interface=/run/hostapd ctrl_interface_group=0 ssid=test channel=11 wpa=2 wpa_passphrase=Hello123 wpa_key_mgmt=WPA-PSK
However, the order of two is important. The connections of NetworkManager need to be configured before the hostapd is started. Otherwise, the bridge interface will be taken over by hostapd before NetworkManager can configure it properly. It is less than straightforward to enforce such an order with systemd
. For current Debian unstable, the dependency in /lib/systemd/system/hostapd.service
need to be corrected from After=network.target
to After=network-online.target
.
Alternatively, you can create a file /etc/systemd/system/hostapd.service.d/netwait.conf
with:
[Unit] After=network-online.target
to change the dependency.