From b7dd9f396326ab914897900fbaa1e16a46928adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 18 Jan 2023 22:54:54 +0100 Subject: nioxos: 5GHz Wi-Fi --- nixos/machine/adm-omnia.nix | 45 ++++++++++++++++++------ nixos/machine/adm-omnia2.nix | 77 ++++++++++++++++++++-------------------- nixos/machine/spt-omnia.nix | 83 ++++++++++++++++++++++++++++++-------------- 3 files changed, 128 insertions(+), 77 deletions(-) (limited to 'nixos/machine') diff --git a/nixos/machine/adm-omnia.nix b/nixos/machine/adm-omnia.nix index c704b58..96e936f 100644 --- a/nixos/machine/adm-omnia.nix +++ b/nixos/machine/adm-omnia.nix @@ -9,12 +9,31 @@ with lib; { cynerd = { router = { enable = true; - wan = "end2"; + wan = "end2"; # TODO pppoe-wan lanIP = config.cynerd.hosts.adm.omnia; }; openvpn.oldpersonal = false; }; + # TODO pppd service requires end2 interface + services.pppd = { + enable = false; + peers."wan".config = '' + plugin pppoe.so end2 + ifname pppoe-wan + lcp-echo-interval 1 + lcp-echo-failure 5 + lcp-echo-adaptive + +ipv6 + defaultroute + defaultroute6 + usepeerdns + maxfail 1 + user O2 + password 02 + ''; + }; + networking.bridges = { brlan.interfaces = ["lan0" "lan1" "lan2" "lan3" "lan4"]; }; @@ -23,23 +42,27 @@ with lib; { enable = true; environmentFile = "/run/secrets/hostapd.env"; interfaces = { - "wlp1s0" = { + "wlp2s0" = { countryCode = "CZ"; hwMode = "a"; channel = 36; ieee80211ac = true; ht_capab = ["HT40+" "LDPC" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "MAX-AMSDU-7935" "DSSS_CCK-40"]; vht_capab = ["RXLDPC" "SHORT-GI-80" "TX-STBC-2BY1" "RX-ANTENNA-PATTERN" "TX-ANTENNA-PATTERN" "RX-STBC-1" "MAX-MPDU-11454" "MAX-A-MPDU-LEN-EXP7"]; - ssid = "TurrisRules5"; + ssid = "TurrisAdamkovi5"; + wpa = 2; + wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; + bridge = "brlan"; + }; + "wlp3s0" = { + countryCode = "CZ"; + hwMode = "g"; + channel = 7; + ht_capab = ["HT40+" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "DSSS_CCK-40"]; + ssid = "TurrisAdamkovi"; wpa = 2; - wpaPassphrase = "@PASS_TURRIS_RULES@"; - bss = { - "wlp1s0host" = { - ssid = "KocoviGuest"; - wpa = 2; - wpaPassphrase = "@PASS_KOCOVI@"; - }; - }; + wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; + bridge = "brlan"; }; }; }; diff --git a/nixos/machine/adm-omnia2.nix b/nixos/machine/adm-omnia2.nix index cf6de9f..3a47a84 100644 --- a/nixos/machine/adm-omnia2.nix +++ b/nixos/machine/adm-omnia2.nix @@ -7,48 +7,47 @@ with lib; { config = { networking = { - bridges = { - brlan = { - interfaces = [ - "end2" - "lan0" - "lan1" - "lan2" - "lan3" - "lan4" - ]; - }; - }; - localCommands = '' - ip link set brlan type bridge vlan_filtering 1 - bridge vlan add dev eth2 vid 1 pvid untagged - bridge vlan add dev eth2 vid 2 - bridge vlan add dev lan0 vid 2 pvid untagged - bridge vlan add dev lan1 vid 2 pvid untagged - bridge vlan add dev lan2 vid 2 pvid untagged - bridge vlan add dev lan3 vid 2 pvid untagged - bridge vlan add dev lan4 vid 1 pvid untagged - bridge vlan add dev lan4 vid 2 - ''; - vlans = { - "lan" = { - id = 1; - interface = "brlan"; + bridges.brlan.interfaces = [ + "end2" "lan0" "lan1" "lan2" "lan3" "lan4" + ]; + interfaces.brlan.ipv4.addresses = [ + { + address = config.cynerd.hosts.adm.omnia2; + prefixLength = 24; + } + ]; + defaultGateway = config.cynerd.hosts.adm.omnia; + nameservers = ["1.1.1.1" "8.8.8.8"]; + dhcpcd.allowInterfaces = ["lan"]; + }; + + networking.wirelessAP = { + enable = true; + environmentFile = "/run/secrets/hostapd.env"; + interfaces = { + "wlp2s0" = { + countryCode = "CZ"; + hwMode = "a"; + channel = 36; + ieee80211ac = true; + ht_capab = ["HT40+" "LDPC" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "MAX-AMSDU-7935" "DSSS_CCK-40"]; + vht_capab = ["RXLDPC" "SHORT-GI-80" "TX-STBC-2BY1" "RX-ANTENNA-PATTERN" "TX-ANTENNA-PATTERN" "RX-STBC-1" "MAX-MPDU-11454" "MAX-A-MPDU-LEN-EXP7"]; + ssid = "TurrisAdamkovi5"; + wpa = 2; + wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; + bridge = "brlan"; }; - }; - interfaces.lan = { - ipv4 = { - addresses = [ - { - address = config.cynerd.hosts.adm.omnia2; - prefixLength = 24; - } - ]; + "wlp3s0" = { + countryCode = "CZ"; + hwMode = "g"; + channel = 7; + ht_capab = ["HT40+" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "DSSS_CCK-40"]; + ssid = "TurrisAdamkovi"; + wpa = 2; + wpaPassphrase = "@PASS_TURRIS_ADAMKOVI@"; + bridge = "brlan"; }; }; - defaultGateway = config.cynerd.hosts.adm.omnia; - nameservers = [config.cynerd.hosts.adm.omnia "1.1.1.1" "8.8.8.8"]; - dhcpcd.allowInterfaces = ["lan"]; }; }; } diff --git a/nixos/machine/spt-omnia.nix b/nixos/machine/spt-omnia.nix index 6db1f7b..0c14e8c 100644 --- a/nixos/machine/spt-omnia.nix +++ b/nixos/machine/spt-omnia.nix @@ -7,39 +7,68 @@ with lib; { config = { cynerd = { + router = { + enable = true; + wan = "pppoe-wan"; + lanIP = config.cynerd.hosts.spt.omnia; + }; openvpn.oldpersonal = true; }; - networking = { - # TODO we need vlan filtering to filter out guest network - bridges = { - brlan = { - interfaces = [ - "lan0" - "lan1" - "lan2" - "lan3" - "lan4" - ]; + networking.vlan."end2.848" = { + id = "848"; + interface = "end2"; + }; + # TODO pppd service requires end2.848 interface + services.pppd = { + enable = true; + peers."wan".config = '' + plugin pppoe.so end2.848 + ifname pppoe-wan + lcp-echo-interval 1 + lcp-echo-failure 5 + lcp-echo-adaptive + +ipv6 + defaultroute + defaultroute6 + usepeerdns + maxfail 1 + user metronet + password metronet + ''; + }; + + networking.bridges = { + brlan.interfaces = ["lan0" "lan1" "lan2" "lan3" "lan4"]; + }; + + networking.wirelessAP = { + enable = true; + environmentFile = "/run/secrets/hostapd.env"; + interfaces = { + "wlp2s0" = { + countryCode = "CZ"; + hwMode = "a"; + channel = 36; + ieee80211ac = true; + ht_capab = ["HT40+" "LDPC" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "MAX-AMSDU-7935" "DSSS_CCK-40"]; + vht_capab = ["RXLDPC" "SHORT-GI-80" "TX-STBC-2BY1" "RX-ANTENNA-PATTERN" "TX-ANTENNA-PATTERN" "RX-STBC-1" "MAX-MPDU-11454" "MAX-A-MPDU-LEN-EXP7"]; + ssid = "TurrisRules5"; + wpa = 2; + wpaPassphrase = "@PASS_TURRIS_RULES@"; + bridge = "brlan"; }; - #brguest = { - # interfaces = [ - # "brlan.2" #"mlan0host" "wlp1s0host" - # ]; - #}; - }; - interfaces.brlan = { - ipv4 = { - addresses = [ - { - address = config.cynerd.hosts.spt.omnia; - prefixLength = 24; - } - ]; + "wlp3s0" = { + countryCode = "CZ"; + hwMode = "g"; + channel = 7; + ht_capab = ["HT40+" "SHORT-GI-20" "SHORT-GI-40" "TX-STBC" "RX-STBC1" "DSSS_CCK-40"]; + ssid = "TurrisRules"; + wpa = 2; + wpaPassphrase = "@PASS_TURRIS_RULES@"; + bridge = "brlan"; }; }; - nameservers = ["127.0.0.1" "1.1.1.1" "8.8.8.8"]; - dhcpcd.allowInterfaces = ["end2"]; }; services.syncthing = { -- cgit v1.2.3