[dhcp, dns] On utilise config.dns.recurfiv pour les nameservers

This commit is contained in:
Valentin Samir 2013-05-31 19:13:23 +02:00
parent 5e76ac1ad0
commit 4723d92a76
2 changed files with 39 additions and 17 deletions

View file

@ -4,7 +4,7 @@
<Service name="isc-dhcp-server"/>
<Path type="directory" name="/etc/dhcp3/generated"/>
<Path type="symlink" name="/etc/dhcp"/>
<Path name="/etc/dhcp3/dhcpd.conf"/>
<Python name="/etc/dhcp3/dhcpd.conf"/>
<Python name="/etc/dhcp3/omapi.conf"/>
<Python name="/etc/dhcp3/dhcp-failover.conf"/>
<Path name="/etc/dhcp3/omapi_generate"/>

View file

@ -1,8 +1,17 @@
# -*- mode: conf-unix; coding: utf-8 -*-
#
# Fichier gere par BCfg2
# A ne modifier que sur le serveur de configuration !
# -*- 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
print """
#
# Sample configuration file for ISC dhcpd for Debian
#
@ -35,12 +44,14 @@ option interface-mtu 1496;
log-facility local7;
include "/etc/dhcp3/dhcp-failover.conf";
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 10.42.0.10;
option domain-name-servers %s;
option routers 10.42.0.10;
authoritative;
default-lease-time 86400;
@ -52,8 +63,10 @@ subnet 10.42.0.0 netmask 255.255.0.0 {
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;
@ -62,7 +75,7 @@ subnet 10.51.0.0 netmask 255.255.0.0 {
# 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 10.51.0.10;
option domain-name-servers %s;
authoritative;
option root-path "/";
next-server 138.231.136.98;
@ -73,14 +86,16 @@ subnet 10.51.0.0 netmask 255.255.0.0 {
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 10.52.0.10;
option domain-name-servers %s;
option routers 10.52.0.10;
authoritative;
option root-path "/";
@ -91,8 +106,10 @@ subnet 10.52.0.0 netmask 255.255.0.0 {
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;
@ -101,7 +118,7 @@ subnet 138.231.136.0 netmask 255.255.248.0 {
option broadcast-address 138.231.143.255;
authoritative;
option routers 138.231.136.4;
option domain-name-servers 138.231.136.98, 138.231.136.152, 138.231.136.247;
option domain-name-servers %s;
option domain-name "crans.org";
option domain-search "crans.org";
option root-path "/";
@ -115,8 +132,10 @@ subnet 138.231.136.0 netmask 255.255.248.0 {
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;
@ -125,7 +144,7 @@ subnet 138.231.144.0 netmask 255.255.248.0 {
option broadcast-address 138.231.148.255;
authoritative;
option routers 138.231.148.4;
option domain-name-servers 138.231.136.98, 138.231.136.152, 138.231.136.247;
option domain-name-servers %s;
option domain-name "crans.org";
option option-119 "crans.org";
option domain-search "crans.org";
@ -136,8 +155,10 @@ subnet 138.231.144.0 netmask 255.255.248.0 {
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;
@ -146,7 +167,7 @@ subnet 10.2.9.0 netmask 255.255.255.0 {
option broadcast-address 10.2.9.255;
authoritative;
option routers 10.2.9.4;
option domain-name-servers 10.2.9.10, 138.231.136.98, 138.231.136.152, 138.231.136.247;
option domain-name-servers %s;
option ip-forwarding off;
option root-path "/";
next-server 138.231.136.98;
@ -155,4 +176,5 @@ subnet 10.2.9.0 netmask 255.255.255.0 {
include "/etc/dhcp3/generated/appartements.liste";
}
""" % ', '.join(config.dns.recursiv['personnel-ens'])