NixOS deployment for LinuxLab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.7 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. { lib, config, ... }:
  2. with lib;
  3. let
  4. clients = import ../../clients.nix;
  5. in
  6. {
  7. services.kea.dhcp4 = {
  8. enable = true;
  9. settings = {
  10. interfaces-config = {
  11. interfaces = [
  12. "enp4s0f0"
  13. "enp4s0f1"
  14. ];
  15. };
  16. lease-database = {
  17. name = "/var/lib/kea/dhcp4.leases";
  18. persist = true;
  19. type = "memfile";
  20. };
  21. rebind-timer = 2000;
  22. renew-timer = 1000;
  23. subnet4 = [
  24. {
  25. id = 1;
  26. subnet = "10.33.64.0/20";
  27. interface = "enp4s0f0";
  28. pools = [
  29. {
  30. pool = "10.33.65.100 - 10.33.65.200";
  31. }
  32. ];
  33. option-data = [
  34. {
  35. name = "routers";
  36. data = "10.33.64.1";
  37. }
  38. {
  39. name = "domain-name-servers";
  40. data = "10.0.0.53";
  41. }
  42. {
  43. name = "domain-name";
  44. data = config.networking.domain;
  45. }
  46. {
  47. name = "domain-search";
  48. data = config.networking.domain;
  49. }
  50. ];
  51. "reservations" = mapAttrsToList
  52. (_: client: {
  53. "hw-address" = strings.toLower client.mac;
  54. "ip-address" = client.ip;
  55. })
  56. clients;
  57. }
  58. {
  59. # This net is only used during PXE boot
  60. id = 2;
  61. subnet = "10.32.44.0/24";
  62. interface = "enp4s0f1";
  63. pools = [
  64. {
  65. pool = "10.32.44.100 - 10.32.44.200";
  66. }
  67. ];
  68. }
  69. ];
  70. valid-lifetime = 4000;
  71. };
  72. };
  73. networking.firewall.allowedUDPPorts = [
  74. 67
  75. 68 # DHCP
  76. ];
  77. }