====== Wi-Fi access point on a diskless system ====== 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? ===== The problem ===== 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. We could also make a NAT, which would avoid the creation of a bridge, but that's boring, and I don't want a NAT inside of my NAT. The devices connected to the access point should be able to join my home network on the same level as all my other devices connected via wired or other access points. #!/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}=="", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eno1", RUN+="/usr/bin/bridge-add eno1 br0" Don't forget to replace ''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 [[arch>Software access point]]. ===== Configure the 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. Seems I can't use the 5 GHz band on my Intel card(( [[arch>Software_access_point#Cannot_start_AP_mode_in_5_GHz_band]])), patch kernel? Solution: Apparently ''hostapd'' resets the regdomain before starting and it doesn't scan beforehand so the Intel LAR sets it correctly again, use [[https://tildearrow.org/?p=post&month=7&year=2022&item=lar|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: [[aur>iwlwifi-lar-disable-dkms]], [[aur>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''. ===== Wired ethernet ===== 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 ===== See also ===== * [[https://serverfault.com/questions/602019/booting-a-diskless-debian-system-using-bonding-bridging-and-iscsi]] * [[https://groupe-tazor.com/notes/a8tbdbcfcjzn035m]]