dhcpd.conf.j2 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. # needed for static routes for Windows clients
  11. #option rfc3442-classless-static-routes code 121 = array of integer 8;
  12. #option ms-classless-static-routes code 249 = array of integer 8;
  13. #option rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 1;
  14. #option ms-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 1;
  15. subnet {{ dhcp_cidr|ipaddr('network') }} netmask {{ dhcp_cidr|ipaddr('netmask') }} {
  16. option routers {{ dhcp_gw_default }};
  17. option domain-name-servers {{ dhcp_gw_secured }}, {{ dns_primary }}, {{ dns_secondary }};
  18. option domain-name "home.arpa";
  19. ## WINS info for Windows capability
  20. #option netbios-name-servers 10.0.0.4;
  21. #option netbios-node-type 8;
  22. # Dynamic IPs
  23. range {{ dhcp_range_start }} {{ dhcp_range_end }};
  24. class "secured" {
  25. option routers {{ dhcp_gw_secured }};
  26. # 192.168.1.0/24 thru 10.0.0.8, 10.0.0.2 as default route
  27. #option rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  28. #option rfc3442-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  29. #option ms-classless-static-routes 24, 192, 168, 1, 10, 0, 0, 8, 0, 10, 0, 0, 2;
  30. match hardware;
  31. }
  32. class "cloudflare" {
  33. option domain-name-servers 1.1.1.3, 1.0.0.3; # cloudflare block malware + porn
  34. match hardware;
  35. }
  36. class "alphasite" {
  37. option domain-name-servers 1.1.1.3, 1.0.0.3; # cloudflare block malware + porn
  38. option routers {{ dhcp_gw_alphasite }};
  39. match hardware;
  40. }
  41. class "devnull" {
  42. option domain-name-servers 127.0.0.1;
  43. match hardware;
  44. }
  45. # nothing in here (yet)
  46. class "default" {
  47. match hardware;
  48. }
  49. {% for node in reservations %}
  50. subclass "{{ node.type }}" 1:{{ node.mac }}; # {{ node.name }}
  51. {% endfor %}
  52. {% for node in reservations %}
  53. host {{ node.name }}
  54. {
  55. hardware ethernet {{ node.mac }};
  56. fixed-address {{ node.ip }};
  57. }
  58. {% endfor %}
  59. }