temp_dhcp.template 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # ******************************************************************
  2. # Cobbler managed dhcpd.conf file
  3. #
  4. # generated from cobbler dhcp.conf template ($date)
  5. # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
  6. # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
  7. # overwritten.
  8. #
  9. # ******************************************************************
  10. #import netaddr
  11. ddns-update-style interim;
  12. allow booting;
  13. allow bootp;
  14. ignore client-updates;
  15. set vendorclass = option vendor-class-identifier;
  16. option system-arch code 93 = unsigned integer 16;
  17. subnet subnet_mask netmask net_mask {
  18. option subnet-mask net_mask;
  19. range dynamic-bootp start end;
  20. default-lease-time default;
  21. max-lease-time max;
  22. next-server $next_server;
  23. #insert the static DHCP leases for configuration here
  24. class "pxeclients" {
  25. match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
  26. # Legacy
  27. if option system-arch = 00:00 {
  28. filename "grub/grub.0";
  29. }
  30. # UEFI-32-1
  31. if option system-arch = 00:06 {
  32. # Not supported, no 32 bit UEFI grub executable
  33. filename "unsupported";
  34. }
  35. # UEFI-32-2
  36. if option system-arch = 00:02 {
  37. # Not supported, no 32 bit UEFI grub executable
  38. filename "unsupported";
  39. }
  40. # UEFI-64-1
  41. else if option system-arch = 00:07 {
  42. filename "grub/grubx64.efi";
  43. }
  44. # UEFI-64-2
  45. else if option system-arch = 00:08 {
  46. filename "grub/grubx64.efi";
  47. }
  48. # UEFI-64-3
  49. else if option system-arch = 00:09 {
  50. filename "grub/grubx64.efi";
  51. }
  52. # armv7 (aka arm 32 bit)
  53. else if option system-arch = 00:0a {
  54. filename "grub/armv7.efi";
  55. }
  56. # aarch64 (aka arm 64 bit)
  57. else if option system-arch = 00:0b {
  58. filename "grub/grubaa64.efi";
  59. }
  60. # RiskV 32 bit
  61. else if option system-arch = 00:25 {
  62. #ToDo petitboot loader
  63. filename "unsupported";
  64. }
  65. #RiskV 32 bit
  66. else if option system-arch = 00:27 {
  67. #ToDo petitboot loader
  68. filename "unsupported";
  69. }
  70. else if option system-arch = 00:0e {
  71. filename "grub/grub.ppc64le";
  72. }
  73. else
  74. {
  75. filename "grub/grub.0";
  76. }
  77. }
  78. }
  79. #for dhcp_tag in $dhcp_tags.keys():
  80. ## group could be subnet if your dhcp tags line up with your subnets
  81. ## or really any valid dhcpd.conf construct ... if you only use the
  82. ## default dhcp tag in cobbler, the group block can be deleted for a
  83. ## flat configuration
  84. # group for Cobbler DHCP tag: $dhcp_tag
  85. group {
  86. #for mac in $dhcp_tags[$dhcp_tag].keys():
  87. #set iface = $dhcp_tags[$dhcp_tag][$mac]
  88. #set mac_dhcp_format = netaddr.EUI($mac,dialect=netaddr.mac_unix)
  89. host $iface.name {
  90. #if $iface.interface_type == "infiniband":
  91. option dhcp-client-identifier = $mac;
  92. #else
  93. hardware ethernet $mac_dhcp_format;
  94. #end if
  95. #if $iface.ip_address:
  96. fixed-address $iface.ip_address;
  97. #end if
  98. #if $iface.dns_name:
  99. option host-name "$iface.dns_name";
  100. #else if $iface.hostname:
  101. option host-name "$iface.hostname";
  102. #end if
  103. #if $iface.netmask:
  104. option subnet-mask $iface.netmask;
  105. #end if
  106. #if $iface.if_gateway:
  107. option routers $iface.if_gateway;
  108. #else if $iface.gateway:
  109. option routers $iface.gateway;
  110. #end if
  111. #if "filename" in $iface.keys() and $iface.filename:
  112. #if $iface.enable_gpxe:
  113. if exists user-class and option user-class = "gPXE" {
  114. filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
  115. } else if exists user-class and option user-class = "iPXE" {
  116. filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
  117. } else {
  118. filename "undionly.kpxe";
  119. }
  120. #else
  121. filename "$iface.filename";
  122. #end if
  123. #end if
  124. #if $iface.next_server:
  125. next-server $iface.next_server;
  126. #end if
  127. #if $iface.filename:
  128. filename $filename
  129. #end if
  130. #if $iface.name_servers:
  131. #set $mynameservers = ','.join($iface.name_servers)
  132. option domain-name-servers $mynameservers;
  133. #end if
  134. }
  135. #end for
  136. }
  137. #end for