From 3b92540742b699a92e291946753f316b4b687a70 Mon Sep 17 00:00:00 2001 From: pauget Date: Thu, 9 Jun 2005 23:55:10 +0200 Subject: [PATCH] dhcpd3 sur rouge darcs-hash:20050609215510-41617-d0bbf79030584541a7b1817594a91bb984810a56.gz --- gestion/gen_confs/dhcpd.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gestion/gen_confs/dhcpd.py b/gestion/gen_confs/dhcpd.py index 78db254d..6b8db639 100755 --- a/gestion/gen_confs/dhcpd.py +++ b/gestion/gen_confs/dhcpd.py @@ -23,7 +23,18 @@ class dhcp(gen_config) : ######################################PARTIE DE CONFIGURATION # Fichier à écire - DHCPD_CONF='/etc/dhcpd.conf' + if hostname == 'rouge' : + DHCPD_CONF = '/etc/dhcp3/dhcpd.conf' + else : + DHCPD_CONF='/etc/dhcpd.conf' + + # Options g-Aénérales-b + if hostname == 'rouge' : + base_conf = """option option-252 code 252 = text ; +option option-119 code 119 = text ; +""" + else : + base_conf = '' # Réseaux servis avec leurs options spécifiques if hostname == 'zamok': @@ -40,6 +51,13 @@ class dhcp(gen_config) : option domain-name "wifi.crans.org"; option option-119 "wifi.crans.org crans.org";""" } + elif hostname == 'rouge': + reseaux = { '138.231.136.0/21' : +"""authoritative; + option routers 138.231.136.4; + option domain-name-servers 138.231.136.6, 138.231.136.10, 138.231.136.9; + option domain-name "crans.org"; + option option-119 "crans.org wifi.crans.org";""" } # Options communes à toutes les réseaux servis base_dhcp=""" @@ -78,6 +96,8 @@ subnet %(network)s netmask %(netmask)s { restart_cmd = '/etc/init.d/dhcp restart' elif hostname == 'nectaris': restart_cmd = 'kill $(ps auxwwc | awk \'($11 == "dhcpd") {print $2}\') ; sleep 1 ; dhcpd em0' + elif hostname == 'rouge' : + restart_cmd = '/etc/init.d/dhcp3-server restart' else: restart_cmd = 'true' @@ -105,6 +125,7 @@ subnet %(network)s netmask %(netmask)s { ### Ecriture du fichier fd = self._open_conf(self.DHCPD_CONF,'#') + fd.write(self.base_conf) for net, options in self.reseaux.items() : if not hosts.has_key(net) : warnings += u'Réseau %s ignoré : aucune machine à servir\n' % net