This commit is contained in:
Fabian Hauser 2019-11-18 23:52:17 +00:00
parent 571684592d
commit c0c48a83b3
2 changed files with 14 additions and 9 deletions

View file

@ -10,7 +10,7 @@ let routerConfig = {
country = "CH"; country = "CH";
wleInterface = "wlp5s0"; wleInterface = "wlp5s0";
wleSSID = "hauser"; wleSSID = "hauser";
wlePassphrase = "a5e42b914b5ad2b7e0474c3b9b35d0843a52668d30cd6aa8650ec43263a60b6e"; wlePassphrase = "mifatielma";
}; };
lanInterfaces = [ "enp2s0" "enp3s0" "enp3s0" ]; lanInterfaces = [ "enp2s0" "enp3s0" "enp3s0" ];
lanNetwork = { lanNetwork = {

View file

@ -19,6 +19,10 @@
dhcpRange = "10.1.1.2,10.1.1.249"; dhcpRange = "10.1.1.2,10.1.1.249";
} }
}: }:
let pkgs = import<nixpkgs>{};
in
{ {
# To get the MAC address of each card, use this command: cat /sys/class/net/*device_name*/address # To get the MAC address of each card, use this command: cat /sys/class/net/*device_name*/address
@ -27,12 +31,6 @@
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${wanCardAddress}", NAME="wan" SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="${wanCardAddress}", NAME="wan"
''; '';
networking.nat = {
enable = true;
externalInterface = "wan";
internalInterfaces = [ "lan" ];
};
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom=${wireless.country} options cfg80211 ieee80211_regdom=${wireless.country}
''; '';
@ -75,7 +73,14 @@
}; };
networking = { networking = {
bridges.lan.interfaces = lanInterfaces ++ [ wireless.wleInterface ]; nat = {
enable = true;
externalInterface = "wan";
internalInterfaces = [ "lan" ];
};
bridges.lan.interfaces = lanInterfaces;
# bridges.lan.interfaces = lanInterfaces ++ [ wireless.wleInterface ];
interfaces.lan = { interfaces.lan = {
ipv4 = { ipv4 = {
addresses = [ { address = lanNetwork.routerAddress; prefixLength = lanNetwork.prefixLength; } ]; addresses = [ { address = lanNetwork.routerAddress; prefixLength = lanNetwork.prefixLength; } ];
@ -87,7 +92,7 @@
services.unbound = { services.unbound = {
enable = true; enable = true;
interfaces = [ "127.0.0.1" lanNetwork.routerAddress ]; interfaces = [ "127.0.0.1" lanNetwork.routerAddress ];
allowedAccess = [ "127.0.0.0/24" lanNetwork.netid ++ "/" ++ lanNetwork.prefixLength ]; allowedAccess = [ "127.0.0.0/24" "${lanNetwork.netid}/${toString lanNetwork.prefixLength}" ];
extraConfig = '' extraConfig = ''
# Custom configuration (leave this note to assure indentation!) # Custom configuration (leave this note to assure indentation!)
do-not-query-localhost: no do-not-query-localhost: no