4 wifiIPv4 = "192.168.2";
6 #gwIface = config.networking.defaultGateway.interface;
9 systemd.network.networks = {
13 Address = "${wifiIPv4}.1/24";
15 IPv6PrivacyExtensions = true;
16 IPv4Forwarding = true;
17 #IPv6Forwarding = true;
20 DNS = "${wifiIPv4}.1";
26 RequiredForOnline = "no";
30 environment.systemPackages = [
33 networking.nftables.ruleset = ''
36 meta l4proto { udp, tcp } th dport domain counter accept comment "DNS"
37 tcp dport bootps counter accept comment "DHCP"
40 iifname ${wifiIface} goto input-lan
46 oifname ${wifiIface} goto output-lan
49 iifname ${wifiIface} oifname ${gwIface} counter accept
50 iifname ${gwIface} oifname ${wifiIface} counter accept
55 services.unbound.settings = {
57 interface = [ "${wifiIPv4}.1" ];
58 access-control = [ "${wifiIPv4}.0/24 allow" ];
60 "sourcephile.fr typetransparent"
61 "tracking.intl.miui.com always_refuse"
64 "\"bureau1.sourcephile.fr A ${wifiIPv4}.1\""
69 networking.networkmanager.unmanaged = [
73 # iw dev wlp4s0 station dump
74 # DOC: https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf
81 networks.${wifiIface} = {
86 # FIXME: use wpaPasswordFile or saePasswordsFile
87 wpaPassword = "bidonpoissonmaisonronron";
92 disassoc_low_ack = true;
110 dtim_period=2 # DTIM (delivery trafic information message)
112 # limit the frequencies used to those allowed in the country
114 # 0 means the AP will search for the channel with the least interferences (ACS)
121 auth_algs=1 # 0=noauth, 1=wpa, 2=wep, 3=both
123 # QoS support, also required for full speed on 802.11n/ac/ax
125 eap_reauth_period=360000
132 # See Capabilities in iw list
133 ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40][MAX-AMSDU-7935]
144 # Sometimes slow connection speeds are attributed to absence of haveged.
145 services.haveged.enable = true;
149 systemd.services.wifi-relay = let inherit (pkgs) iptables gnugrep;
151 description = "iptables rules for wifi-relay";
152 after = [ "dhcpd4.service" ];
153 wantedBy = [ "multi-user.target" ];
155 ${iptables}/bin/iptables -w -t nat -I POSTROUTING -s ${wifiIPv4}.0/24 ! -o wlan-ap0 -j MASQUERADE
156 ${iptables}/bin/iptables -w -I FORWARD -i wlan-ap0 -s ${wifiIPv4}.0/24 -j ACCEPT
157 ${iptables}/bin/iptables -w -I FORWARD -i wlan-station0 -d ${wifiIPv4}.0/24 -j ACCEPT