So I found a PCI Wi-Fi 5 (802.11ac) device (based on Intel Dual Band Wireless-AC 3168), and I decided to put it in my diskless system that boots Arch Linux from NFS, and turn it into a Wi-Fi access point, hoping to improve reception in my living room. Should be easy, right?
We're gonna use hostapd
for this. The problem is, hostapd
will want to bridge the Ethernet connection to the Wi-Fi device, which means temporarily shutting down Ethernet while creating a bridged connection, a thing the NFS client won't like at all and will throw the whole system into a nasty I/O deadlock.
Solution: creating that bridge in the initramfs, ideally before the root is mounted and at the same time the system brings up the networking.
#!/bin/sh ip link add name $2 type bridge ip link set dev $2 up ip link set $1 up ip link set $1 master $2
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<wired MAC address>", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eno1", RUN+="/usr/bin/bridge-add eno1 br0"
eno1
with your actual wired device name and add its MAC address! Also, make bridge-add
executable with chmod +x /usr/bin/bridge-add
.
Add the correct modules and files to your initramfs generator config:
MODULES=(nfsv4 bridge) BINARIES=(/usr/bin/mount.nfs4 /usr/bin/bridge-add) FILES=(/usr/lib/udev/rules.d/70-persistent-net.rules)
Then you can replace eth0
with br0
in your kernel command line on your bootloader:
ip=:::::br0:dhcp nfsroot=192.168.1.10:/arch
Run mkinitcpio, reboot, and hopefully you have a usable system again, but now with a br0
device.
Now you can continue with the instructions on Software access point.
Ideally you want to configure hostapd.conf
with hw_mode=a
to use Wi-Fi 5 (aka 802.11ac) capabilities and use the 5 GHz band, for Wi-Fi 4 (802.11n) and the 2.4 GHz band you can use hw_mode=g
. Use iw list
to find out which channels you can use, those marked no IR
are unusable.
Solution: Apparently hostapd
resets the regdomain before starting and it doesn't scan beforehand so the Intel LAR sets it correctly again, use this patch so the regdomain can be properly set and you can access the 5 GHz band, no kernel recompile needed. Well, unless there's no wi-fi signal around…
Relevant Arch packages: iwlwifi-lar-disable-dkms, hostapd-git-intel-lar
Also, the wireless interface may or may not show up right at boot unless you modprobe iwlmvm
, make sure you either add it to /etc/modules-load.d
or also /etc/mkinitcpio.conf
.
For good measure I added a PCI card with a couple Ethernet ports, you'll want to add them to the bridge on boot, but of course using any sort of network manager may deadlock the system because it attempted to reconfigure every available interface at boot even though they're already configured. But this time, you don't need to configure them in initramfs, so a systemd unit will be more than enough.
#!/bin/sh ip link set $1 up ip link set $1 master $2
[Unit] Description=Bridge interface %I with br0 Requires=sys-subsystem-net-devices-br0.device Requires=sys-subsystem-net-devices-enp3s0f0.device Requires=sys-subsystem-net-devices-enp3s0f1.device After=network.target After=sys-subsystem-net-devices-br0.device After=sys-subsystem-net-devices-enp3s0f0.device After=sys-subsystem-net-devices-enp3s0f1.device [Service] Type=oneshot ExecStart=/usr/local/bin/bridge-join %I br0 [Install] WantedBy=multi-user.target
# systemctl enable bridge-interface@enp3s0f0 bridge-interface@enp3s0f1