From 2ab67e4cff78ecf6c7f38d55838886033fe57520 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 22 Apr 2018 13:35:08 +0200 Subject: nat on bragi --- bragi.nix | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/bragi.nix b/bragi.nix index c490e6b6..2e66e504 100644 --- a/bragi.nix +++ b/bragi.nix @@ -43,15 +43,22 @@ in rec { }; interfaces.eth = { - proxyARP = true; useDHCP = false; + ipv4.addresses = [ + { address = "10.141.4.1"; prefixLength = 24; } + ]; }; - + interfaces.wlp4s0 = { - proxyARP = true; useDHCP = true; }; + nat = { + enable = true; + externalInterface = "wlp4s0"; + internalInterfaces = [ "eth" ]; + }; + firewall.enable = false; defaultMailServer = { @@ -62,14 +69,46 @@ in rec { }; }; - systemd.services."dhcp-helper" = { - serviceConfig = { - ExecStart = '' - ${pkgs.callPackage ./custom/dhcp-helper.nix {}}/bin/dhcp-helper -b wlp4s0 -n - ''; - }; - - wantedBy = [ "network.target" ]; + services.radvd = { + enable = true; + config = '' + interface eth { + AdvSendAdvert on; + MinRtrAdvInterval 3; + MaxRtrAdvInterval 10; + + prefix ffff:ffff:ffff:ffff::/64 { + Base6Interface eth; + + AdvOnLink on; + AdvAutonomous on; + # AdvRouterAddr on; + }; + }; + + interface wlp4s0 { + AdvSendAdvert on; + MinRtrAdvInterval 3; + MaxRtrAdvInterval 10; + + prefix ffff:ffff:ffff:ffff::/64 { + Base6Interface eth; + + AdvOnLink on; + AdvAutonomous on; + # AdvRouterAddr on; + }; + }; + ''; + }; + + services.dhcpcd = { + enable = true; + extraConfig = '' + interface wlp4s0 + ipv6rs + ia_pd 1/::/64 eth/0/64 + ''; }; nixpkgs = { -- cgit v1.2.3