198 lines
5.2 KiB
Python
198 lines
5.2 KiB
Python
# -*- mode: python; encoding: utf-8 -*-
|
|
|
|
info["owner"] = "root"
|
|
info["group"] = "root"
|
|
info["perms"] = 0600
|
|
|
|
comment_start = "#"
|
|
|
|
header("Configuration dhcp de %s" % admhostname)
|
|
|
|
include("ip")
|
|
import config.dns
|
|
|
|
instpar = has('ytrap-llatsni')
|
|
|
|
print """
|
|
#
|
|
# Sample configuration file for ISC dhcpd for Debian
|
|
#
|
|
# $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
|
|
#
|
|
|
|
# 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.)
|
|
ddns-update-style none;
|
|
|
|
if not instpar:
|
|
include "/etc/dhcp3/omapi.conf";
|
|
|
|
# option definitions common to all supported networks...
|
|
option option-252 code 252 = text ;
|
|
option domain-search code 119 = text ;
|
|
option option-119 code 119 = text ;
|
|
# La pluspart de nos réseaux sont taggués, on utilise donc une mtu de 1500-4 octets
|
|
option interface-mtu 1496;
|
|
|
|
# If this DHCP server is the official DHCP server for the local
|
|
# network, the authoritative directive should be uncommented.
|
|
#authoritative;
|
|
|
|
if instpar:
|
|
print """
|
|
# 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 local7;
|
|
|
|
if not instpar:
|
|
include "/etc/dhcp3/dhcp-failover.conf";"""
|
|
|
|
if has("vlan-radin"):
|
|
print """
|
|
# VLan gratuit
|
|
subnet 10.42.0.0 netmask 255.255.0.0 {
|
|
interface eth3;
|
|
option domain-name-servers %s;
|
|
option routers 10.42.0.10;
|
|
authoritative;
|
|
default-lease-time 86400;
|
|
deny unknown-clients;
|
|
option root-path "/";
|
|
next-server 138.231.136.98;
|
|
filename "pxelinux.0";
|
|
pool {
|
|
range 10.42.1.1 10.42.255.200;
|
|
failover peer "dhcp-failover";
|
|
}
|
|
}""" % ', '.join(config.dns.recursiv['gratuit'])
|
|
|
|
if has("vlan-accueil"):
|
|
print """
|
|
# VLan accueil
|
|
subnet 10.51.0.0 netmask 255.255.0.0 {
|
|
interface eth4;
|
|
default-lease-time 600;
|
|
max-lease-time 7200;
|
|
# On met sable en router pour pouvoir accéder à l'intranet et au wiki
|
|
option routers 10.51.0.10;
|
|
# On n'a besoin que du dns ici (pour le portail captif)
|
|
option domain-name-servers %s;
|
|
authoritative;
|
|
option root-path "/";
|
|
next-server 138.231.136.98;
|
|
filename "pxelinux.0";
|
|
option time-servers 10.51.0.10;
|
|
option ntp-servers 10.51.0.10;
|
|
pool {
|
|
failover peer "dhcp-failover";
|
|
range 10.51.1.1 10.51.255.200;
|
|
}
|
|
}""" % ', '.join(config.dns.recursiv['accueil'])
|
|
|
|
if has("vlan-isolement"):
|
|
print """
|
|
# VLan isolement
|
|
subnet 10.52.0.0 netmask 255.255.0.0 {
|
|
interface eth5;
|
|
default-lease-time 600;
|
|
max-lease-time 7200;
|
|
option domain-name-servers %s;
|
|
option routers 10.52.0.10;
|
|
authoritative;
|
|
option root-path "/";
|
|
next-server 138.231.136.98;
|
|
filename "pxelinux.0";
|
|
pool {
|
|
failover peer "dhcp-failover";
|
|
range 10.52.1.1 10.52.255.200;
|
|
}
|
|
}
|
|
""" % ', '.join(config.dns.recursiv['isolement'])
|
|
|
|
if not has("non-vlan-adherent"):
|
|
print """
|
|
# Vlan des adhérents
|
|
subnet 138.231.136.0 netmask 255.255.248.0 {
|
|
interface eth0;
|
|
default-lease-time 86400;
|
|
option subnet-mask 255.255.248.0;
|
|
option broadcast-address 138.231.143.255;
|
|
authoritative;
|
|
option routers 138.231.136.4;
|
|
option domain-name-servers %s;
|
|
option domain-name "crans.org";
|
|
option domain-search "crans.org";
|
|
option root-path "/";
|
|
next-server 138.231.136.98;
|
|
filename "pxelinux.0";
|
|
option time-servers 138.231.136.9;
|
|
option ntp-servers 138.231.136.9;
|
|
option smtp-server 138.231.136.39;
|
|
option ip-forwarding off;
|
|
deny unknown-clients;
|
|
|
|
include "/etc/dhcp3/generated/adherents.liste";
|
|
}
|
|
""" % ', '.join(config.dns.recursiv['fil'])
|
|
|
|
if has("vlan-wifi"):
|
|
print """
|
|
# Vlan des wifi
|
|
subnet 138.231.144.0 netmask 255.255.248.0 {
|
|
interface eth2;
|
|
default-lease-time 86400;
|
|
option subnet-mask 255.255.248.0;
|
|
option broadcast-address 138.231.148.255;
|
|
authoritative;
|
|
option routers 138.231.148.4;
|
|
option domain-name-servers %s;
|
|
option domain-name "crans.org";
|
|
option option-119 "crans.org";
|
|
option domain-search "crans.org";
|
|
option time-servers 138.231.136.9;
|
|
option ntp-servers 138.231.136.9;
|
|
option smtp-server 138.231.136.3;
|
|
option ip-forwarding off;
|
|
deny unknown-clients;
|
|
|
|
include "/etc/dhcp3/generated/wifi.liste";
|
|
}""" % ', '.join(config.dns.recursiv['wifi'])
|
|
|
|
if has("vlan-ens"):
|
|
print """
|
|
#Vlan appartement
|
|
subnet 10.2.9.0 netmask 255.255.255.0 {
|
|
interface eth6;
|
|
default-lease-time 86400;
|
|
option subnet-mask 255.255.255.0;
|
|
option broadcast-address 10.2.9.255;
|
|
authoritative;
|
|
option routers 10.2.9.4;
|
|
option domain-name-servers %s;
|
|
option ip-forwarding off;
|
|
option root-path "/";
|
|
next-server 138.231.136.98;
|
|
filename "pxelinux.0";
|
|
deny unknown-clients;
|
|
|
|
include "/etc/dhcp3/generated/appartements.liste";
|
|
}
|
|
""" % ', '.join(config.dns.recursiv['personnel-ens'])
|
|
|
|
if has("vlan-evenementiel"):
|
|
print """
|
|
subnet 10.231.137.0 netmask 255.255.255.0 {
|
|
range 10.231.137.20 10.231.137.254;
|
|
next-server 10.231.137.1;
|
|
# Options pour le PXE
|
|
option root-path "/";
|
|
# Fichier a charger pour le boot par le reseau
|
|
filename "pxelinux.0";
|
|
}
|
|
"""
|