4 wifiIPv4 = "192.168.2";
6 #gwIface = config.networking.defaultGateway.interface;
9 systemd.network.networks = {
13 Address = "${wifiIPv4}.1/24";
15 IPv6PrivacyExtensions = true;
19 DNS = "${wifiIPv4}.1";
25 RequiredForOnline = "no";
29 environment.systemPackages = [
32 networking.nftables.ruleset = ''
35 meta l4proto { udp, tcp } th dport domain counter accept comment "DNS"
36 tcp dport bootps counter accept comment "DHCP"
39 iifname ${wifiIface} goto input-lan
45 oifname ${wifiIface} goto output-lan
48 iifname ${wifiIface} oifname ${gwIface} counter accept
49 iifname ${gwIface} oifname ${wifiIface} counter accept
54 services.unbound.settings = {
56 interface = [ "${wifiIPv4}.1" ];
57 access-control = [ "${wifiIPv4}.0/24 allow" ];
59 "sourcephile.fr typetransparent"
60 "tracking.intl.miui.com always_refuse"
63 "\"bureau1.sourcephile.fr A ${wifiIPv4}.1\""
68 networking.networkmanager.unmanaged = [
72 # iw dev wlp4s0 station dump
73 # DOC: https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf
80 networks.${wifiIface} = {
85 # FIXME: use wpaPasswordFile or saePasswordsFile
86 wpaPassword = "bidonpoissonmaisonronron";
91 disassoc_low_ack = true;
109 dtim_period=2 # DTIM (delivery trafic information message)
111 # limit the frequencies used to those allowed in the country
113 # 0 means the AP will search for the channel with the least interferences (ACS)
120 auth_algs=1 # 0=noauth, 1=wpa, 2=wep, 3=both
122 # QoS support, also required for full speed on 802.11n/ac/ax
124 eap_reauth_period=360000
131 # See Capabilities in iw list
132 ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40][MAX-AMSDU-7935]
143 # Sometimes slow connection speeds are attributed to absence of haveged.
144 services.haveged.enable = true;
148 systemd.services.wifi-relay = let inherit (pkgs) iptables gnugrep;
150 description = "iptables rules for wifi-relay";
151 after = [ "dhcpd4.service" ];
152 wantedBy = [ "multi-user.target" ];
154 ${iptables}/bin/iptables -w -t nat -I POSTROUTING -s ${wifiIPv4}.0/24 ! -o wlan-ap0 -j MASQUERADE
155 ${iptables}/bin/iptables -w -I FORWARD -i wlan-ap0 -s ${wifiIPv4}.0/24 -j ACCEPT
156 ${iptables}/bin/iptables -w -I FORWARD -i wlan-station0 -d ${wifiIPv4}.0/24 -j ACCEPT