dhcpd.conf.j2 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # {{ ansible_managed }}
  2. #
  3. # DHCP Server Configuration file.
  4. # see /usr/share/doc/dhcp*/dhcpd.conf.example
  5. # see dhcpd.conf(5) man page
  6. #
  7. authoritative;
  8. default-lease-time 43200; # 12 hours
  9. max-lease-time 86400; # 24 hours
  10. option rfc3442-classless-static-routes code 121 = array of integer 8;
  11. option ms-classless-static-routes code 249 = array of integer 8;
  12. option rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 1;
  13. option ms-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 1;
  14. subnet 10.0.0.0 netmask 255.255.255.0 {
  15. option routers 10.0.0.1;
  16. option domain-name-servers 10.0.0.2, {{ dns_primary }}, {{ dns_secondary }};
  17. # WINS info for Windows capability
  18. option netbios-name-servers 10.0.0.4;
  19. option netbios-node-type 8;
  20. # Dynamic IPs
  21. range 10.0.0.100 10.0.0.200;
  22. class "secured" {
  23. option routers 10.0.0.2;
  24. # 192.168.1.0/24 thru 10.0.0.8, 10.0.0.2 as default route
  25. option rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  26. option ms-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  27. match hardware;
  28. }
  29. class "cloudflare" {
  30. option domain-name-servers 1.1.1.3, 1.0.0.3; # cloudflare block malware + porn
  31. match hardware;
  32. }
  33. class "devnull" {
  34. option domain-name-servers 127.0.0.1;
  35. match hardware;
  36. }
  37. # nothing in here (yet)
  38. class "default" {
  39. match hardware;
  40. }
  41. {% for node in nodes %}
  42. subclass "{{ node.type }}" 1:{{ node.mac }}; # {{ node.name }}
  43. {% endfor %}
  44. {% for node in nodes %}
  45. host {{ node.name }}
  46. {
  47. hardware ethernet {{ node.mac }};
  48. fixed-address {{ node.ip }};
  49. }
  50. {% endfor %}
  51. }