Code Monkey home page Code Monkey logo

puppet-dhcpd's Introduction

#davidb-dhcpd

This is the dhcpd module.

License

Apache License, Version 2.0

Support

Please log tickets and issues at our Projects site

Contributions

Many thanks to Jonathan Gazeley for latest commits.

Example usage

First create the global config, this will install package if not installed. Currently, only Redhat and derivates are supported.

  class { 'dhcpd':
    global_config => {
      'options'         => {
        'domain-name-servers'  => [ '10.0.2.15', '10.0.2.16' ],
        'netbios-name-servers' => [ $::ipaddress_eth0 ],
        'domain-name'          => $::domain,
      },
      config            => {
        'server-identifier' => $::ipaddress,
        'log-facility'      => 'local6',
      },
      include           => [
        '/etc/dhcpd.conf.others',
        '/etc/named-dhcpd.key',
      ],
      ddns_domainname   => $::domain,
      ddns_update_style => 'interim',
      ddns_zones        => { "${::domain}."           => { 'primary' => '10.0.2.15', 'key' => 'DHCP_UPDATER' },
                             '23.20.10.in-addr.arpa.' => { 'primary' => '10.0.2.15', 'key' => 'DHCP_UPDATER' },
                           },
      authoritative     => true,
      omapi_port        => 9991,
      omapi_key         => 'DHCP_UPDATER',
    },
  }

DDNS updates are supported, but you still have to manage security key (through the inclusion of an external file)

  • include statement allows you to add external managed files
  • options hash configuration global dhcpd options
  • omapi supported through omapi_items

Supported DHCP items:

  • class
  • subnet
  • pool
  • ranges
  • shared-network
  • failover

Example of dhcp class

  dhcpd::class { 'newpcboot':
    match_if    => 'substring (option vendor-class-identifier, 0, 9) = "PXEClient"',
    filename    => '/pxelinux.0',
    next_server => $::ipaddress_eth0,
  }

Example of subnet with two pools

  dhcpd::subnet { 'First subnet':
    network     => '10.20.22.0',
    netmask     => '255.255.254.0',
    options     => {
      'routers'              => '10.20.22.254',
    },
    pools       => {
      '1st pool' => {
        allow_members_of            => ['newpcboot'],
        allow_unknown_clients       => true,
        ranges                      => ['10.20.22.8 10.20.22.9'],
        default_lease_time          => '3600',
        max_lease_time              => '3600',
      },
      '2nd pool' => {
        allow_members_of            => ['newpcboot'],
        allow_unknown_clients       => true,
        ranges                      => ['10.20.22.12 10.20.22.40'],
        default_lease_time          => '3600',
        max_lease_time              => '3600',
      },
    },
  }

Another subnet with only range

  dhcpd::subnet { 'other subnet':
    ranges  => ['192.168.100.1 192.168.100.5'],
    network => '192.168.100.0',
    netmask => '255.255.255.0',
    options => {
      'domain-name-servers' => ['192.168.100.250'],
      'routers'             => ['192.168.100.254'],
      'domain-name'         => 'example.com',
    },
  }

Another example with shared-network

  dhcpd::shared { 'workstations-and-printers': }
  
  dhcpd::subnet { 'shared subnet 1':
    ranges  => ['192.168.101.1 192.168.101.5'],
    network => '192.168.101.0',
    netmask => '255.255.255.0',
    options => {
      'domain-name-servers' => ['192.168.101.250'],
      'routers'             => ['192.168.101.254'],
      'domain-name'         => 'shared1-example.com',
    },
    shared_network_name  => 'workstations-and-printers',
    failover_peer        => 'dhcp-srv',
  }
  dhcpd::subnet { 'shared subnet 2':
    network => '192.168.102.0',
    netmask => '255.255.255.0',
    options => {
      'domain-name-servers' => ['192.168.102.250'],
      'routers'             => ['192.168.102.254'],
      'domain-name'         => 'shared2-example.com',
    },
    pools       => {
      'shared 1st pool' => {
        allow_members_of            => ['newpcboot'],
        allow_unknown_clients       => true,
        ranges                      => ['192.168.102.5 192.168.102.5'],
        default_lease_time          => '3600',
        max_lease_time              => '3600',
      },
    },
    shared_network_name  => 'workstations-and-printers',
    failover_peer        => 'dhcp-srv',
  }

Declaration of local subnet

  dhcpd::subnet { 'local_interface':
    network     => $::network_eth0,
    netmask     => $::netmask_eth0,
  }

Configuration of DHCP failover

Use this class to configure DHCP failover. For full details of what these parameters do, refer to the ISC DHCP documentation.

Most of these parameters have sensible defaults but you must provide a value for peer, primary, and peer_address.

  class { 'dhcpd::failover':
    peer                     => 'dhcp-srv',
    primary                  => true,
    address                  => $::fqdn,
    port                     => 647,
    peer_address             => 'dhcp-srv2.example.com',
    peer_port                => 647,
    max_response_delay       => 60,
    max_unacked_updates      => 10,
    load_balance_max_seconds => 3,
    mclt                     => 1800,
    split                    => 128,
  }

Changelog

0.4.0

  • New defined type dhcpd::option
  • Add class_cfg_prepend and class_cfg_append parameters to dhcpd::class defined type for complex workstation class configuration

puppet-dhcpd's People

Contributors

david-barbion avatar djjudas21 avatar dominiquearpin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.