debops / ansible-dhcpd

Install and configure ISC DHCP Server
GNU General Public License v3.0
22 stars 15 forks source link

"subnet None" in dhcp.conf #16

Closed dkusidlo closed 9 years ago

dkusidlo commented 9 years ago

The template seems to have some issues with my config which results in a dhcp.conf with "subnet None".

config:

dhcpd_mode: 'server'
dhcpd_ipversion: '4'
dhcpd_authoritative: True
dhcpd_interfaces: [eth0]
dhcpd_nameservers: [100.126.1.16]
dhcpd_domain_name: [domain.de]

dhcpd_shared_networks:
  - name: 'shared'
    comment: "Remote shared network"
    subnets: '{{ dhcpd_subnets_local }}'
    options: |
      default-lease-time 600;
      max-lease-time 900;

dhcpd_subnets_local:
  - subnet: '100.126.1.0'
    netmask: '255.255.254.0'
    routers: '100.126.0.1'
    options: |
      default-lease-time 300;
      max-lease-time 7200;
      allow booting;
      allow bootp;
      filename "pxelinux.0";
      next-server 100.126.1.21;
    pools:
      - comment: "default ip pool for common services"
        range: '100.126.1.115 100.126.1.200'

resulting /etc/dhcp/dhcp.conf:

# Remote shared network
shared-network "shared" {
        default-lease-time 600;
        max-lease-time 900;

        subnet None netmask 255.255.254.0 {
                option routers 100.126.0.1;
                default-lease-time 300;
                max-lease-time 7200;
                allow booting;
                allow bootp;
                filename "pxelinux.0";
                next-server 100.126.1.21;
                pool {
                        # default ip pool for common services
                        range 100.126.1.115 100.126.1.200;
                }
        }
}

# Generated automatically by Ansible
subnet 100.126.0.0 netmask 255.255.254.0 {
        option routers 100.126.0.1;
}

Thanks in advance

drybjed commented 9 years ago

I'll check it in my environment and report back.

drybjed commented 9 years ago

@dkusidlo I just tried your config on my installation and it looks fine, here's a finished dhcpd.conf:

not authoritative;

default-lease-time 64800;
max-lease-time 86400;

log-facility local7;

option domain-name "example.org";

option domain-search "example.org";
option dhcp6.domain-search "example.org";

option domain-name-servers 172.16.32.1;

# Remote shared network
shared-network "shared" {
        default-lease-time 600;
        max-lease-time 900;

        subnet 10.126.0.0 netmask 255.255.254.0 {
                option routers 10.126.0.1;
                default-lease-time 300;
                max-lease-time 7200;
                allow booting;
                allow bootp;
                filename "pxelinux.0";
                next-server 10.126.1.21;
                pool {
                        # default ip pool for common services
                        range 10.126.1.115 10.126.1.200;
                }
        }
}

# Generated automatically by Ansible
subnet 172.16.32.0 netmask 255.255.224.0 {
        option routers 172.16.32.1;
}

Make sure to update debops.dhcpd role to latest version from GitHub (latest changes aren't yet available on Ansible Galaxy).

dkusidlo commented 9 years ago

Thanks drybjed, didn't know that. And thank you for the work and your support!