aboutsummaryrefslogblamecommitdiffstats
path: root/roles/space_server/templates/dhcpd.conf.j2
blob: fea206c615bba07e8a79cf6aac8b28af5d4c8723 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                                          





















                                              
                       
           


                                                        

                                          
                         


                        

                                 








                                                                      

                                        
                                    
                                     


                                                
                         
 



                         

 

                                        
                                    





                                                   
 
                                                                       





                                                 



                         

 

                                        

                                                   




                                                
 
                                                                       





                                                 



                         



                                        

                                                   


                                                
 
                                                                       





                                                 



                         

 







                                                   
                                                                       





                                                 







                               
                         
                             
                                         
 
                              
                                
           

                                                 
                                                         
                           
                                               
           
         
           

            
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
{% if ddns_secret is defined %}
ddns-update-style interim;
ddns-local-address4 127.0.0.1;
ddns-local-address6 ::1;

key dhcpupdate {
	algorithm {{ ddns_secret.algorithm }};
	secret {{ ddns_secret.key }};
}

zone dhcp. {
	primary 127.0.0.1;
	primary6 ::1;
	key dhcpupdate;
}

zone 42.10.in-addr.arpa. {
	primary 127.0.0.1;
	primary6 ::1;
	key dhcpupdate;
}
{% else %}
ddns-update-style none;
{% endif %}

# option definitions common to all supported networks...
#option domain-name "labitat.dk";
option pcode "CET-1CEST,M3.5.0,M10.5.0/3";
option tcode "Europe/Copenhagen";
abandon-lease-time 86400;
default-lease-time 3600;
max-lease-time 7200;
min-lease-time 600;
dynamic-bootp-lease-length 86400;
db-time-format local;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility daemon;

# Admin net
subnet 10.42.0.0 netmask 255.255.255.0 {
	server-identifier 10.42.0.1;
	range 10.42.0.50 10.42.0.250;
	option routers 10.42.0.1;
	option domain-name-servers 185.38.175.0;
	#option ntp-servers 90.185.0.18;
	ddns-updates off;

	deny bootp;
	allow duplicates;
	allow declines;
	allow leasequery;
}

# Wired net
subnet 10.42.1.0 netmask 255.255.255.0 {
	server-identifier 10.42.1.1;
	range dynamic-bootp 10.42.1.50 10.42.1.250;
	option routers 10.42.1.1;
	option domain-name-servers 185.38.175.0;
	#option ntp-servers 90.185.0.18;
	next-server 10.42.1.1;
	filename "pxelinux.0";

	if exists host-name and option host-name ~= "^[0-9A-Za-z-]*$" {
		ddns-hostname = option host-name;
		ddns-domainname "dhcp";
	} else {
		ddns-updates off;
	}

	allow bootp;
	allow duplicates;
	allow declines;
	allow leasequery;
}

# Private wifi
subnet 10.42.2.0 netmask 255.255.255.0 {
	server-identifier 10.42.2.1;
	range dynamic-bootp 10.42.2.50 10.42.2.250;
	option routers 10.42.2.1;
	option domain-name-servers 185.38.175.0;
	#option ntp-servers 90.185.0.18;
	next-server 10.42.2.1;
	filename "pxelinux.0";

	if exists host-name and option host-name ~= "^[0-9A-Za-z-]*$" {
		ddns-hostname = option host-name;
		ddns-domainname "dhcp";
	} else {
		ddns-updates off;
	}

	allow bootp;
	allow duplicates;
	allow declines;
	allow leasequery;
}

# Free wifi
subnet 10.42.3.0 netmask 255.255.255.0 {
	server-identifier 10.42.3.1;
	range dynamic-bootp 10.42.3.50 10.42.3.250;
	option routers 10.42.3.1;
	option domain-name-servers 185.38.175.0;
	#option ntp-servers 90.185.0.18;

	if exists host-name and option host-name ~= "^[0-9A-Za-z-]*$" {
		ddns-hostname = option host-name;
		ddns-domainname "dhcp";
	} else {
		ddns-updates off;
	}

	allow bootp;
	allow duplicates;
	deny declines;
	deny leasequery;
}

## Password protected wifi
#subnet 10.42.4.0 netmask 255.255.255.0 {
#	server-identifier 10.42.4.1;
#	range dynamic-bootp 10.42.4.50 10.42.4.250;
#	option routers 10.42.4.1;
#	option domain-name-servers 185.38.175.0;
#	#option ntp-servers 90.185.0.18;
#
#	if exists host-name and option host-name ~= "^[0-9A-Za-z-]*$" {
#		ddns-hostname = option host-name;
#		ddns-domainname "dhcp";
#	} else {
#		ddns-updates off;
#	}
#
#	allow bootp;
#	allow duplicates;
#	allow declines;
#	allow leasequery;
#}

group {
	use-host-decl-names on;
	ddns-updates off;
{% for host in local_hosts %}
{% if 'mac' in host and 'ipv4' in host %}

{% if 'description' in host %}
	# {{ host.description }}
{% endif %}
	host {{ host.name }} {
		hardware ethernet {{ host.mac }};
		fixed-address {{ host.ipv4|join(', ') }};
{% if 'filename' in host %}
		filename "{{ host.filename }}";
{% endif %}
	}
{% endif %}
{% endfor %}
}