dhcpd.conf.j2 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 {{ dhcp_cidr }} netmask {{ dhcp_netmask }} {
  15. option routers {{ dhcp_routers }};
  16. option domain-name-servers {{ gateway_server_ip }}, {{ 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 {{ dhcp_range_start }} {{ dhcp_range_end }};
  22. class "secured" {
  23. option routers {{ gateway_server_ip }};
  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 rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  27. option ms-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  28. match hardware;
  29. }
  30. class "cloudflare" {
  31. option domain-name-servers 1.1.1.3, 1.0.0.3; # cloudflare block malware + porn
  32. match hardware;
  33. }
  34. class "devnull" {
  35. option domain-name-servers 127.0.0.1;
  36. match hardware;
  37. }
  38. # nothing in here (yet)
  39. class "default" {
  40. match hardware;
  41. }
  42. {% for node in reservations %}
  43. subclass "{{ node.type }}" 1:{{ node.mac }}; # {{ node.name }}
  44. {% endfor %}
  45. {% for node in reservations %}
  46. host {{ node.name }}
  47. {
  48. hardware ethernet {{ node.mac }};
  49. fixed-address {{ node.ip }};
  50. }
  51. {% endfor %}
  52. }