default.nix 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. { config, pkgs, ... }:
  2. {
  3. imports = [
  4. ./dnsmasq.nix
  5. ./smartdns.nix
  6. ./upnp.nix
  7. ];
  8. networking = {
  9. useDHCP = false;
  10. firewall.enable = false;
  11. nftables = {
  12. enable = true;
  13. rulesetFile = ./firewall.nft;
  14. # https://discourse.nixos.org/t/nftables-could-not-process-rule-no-such-file-or-directory/33031
  15. checkRuleset = false;
  16. };
  17. interfaces = {
  18. ppp0.useDHCP = true;
  19. wan.useDHCP = true;
  20. lan = {
  21. ipv4.addresses = [{
  22. address = "192.168.5.1";
  23. prefixLength = 24;
  24. }];
  25. };
  26. };
  27. dhcpcd = {
  28. enable = true;
  29. # Do not remove interface configuration on shutdown.
  30. persistent = true;
  31. allowInterfaces = [ "ppp0" ];
  32. extraConfig = ''
  33. # don't touch our DNS settings
  34. nohook resolv.conf
  35. # generate a RFC 4361 complient DHCP ID
  36. duid
  37. # We don't want to expose our hw addr from the router to the internet,
  38. # so we generate a RFC7217 address.
  39. slaac private
  40. persistent
  41. option rapid_commit
  42. option domain_name_servers, domain_name, domain_search, host_name
  43. option classless_static_routes
  44. option interface_mtu
  45. require dhcp_server_identifier
  46. # we only want to handle IPv6 with dhcpcd, the IPv4 is still done
  47. # through pppd daemon
  48. noipv6rs
  49. ipv6only
  50. # settings for the interface
  51. interface ppp0
  52. ipv6rs # router advertisement solicitaion
  53. iaid 1 # interface association ID
  54. ia_pd 2 lan/0 # request a PD and assign to interface
  55. '';
  56. };
  57. };
  58. services.vnstat.enable = true;
  59. }