dhcpd3 sur rouge
darcs-hash:20050609215510-41617-d0bbf79030584541a7b1817594a91bb984810a56.gz
This commit is contained in:
parent
af565b39ae
commit
3b92540742
1 changed files with 22 additions and 1 deletions
|
@ -23,7 +23,18 @@ class dhcp(gen_config) :
|
||||||
######################################PARTIE DE CONFIGURATION
|
######################################PARTIE DE CONFIGURATION
|
||||||
|
|
||||||
# Fichier à écire
|
# 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
|
# Réseaux servis avec leurs options spécifiques
|
||||||
if hostname == 'zamok':
|
if hostname == 'zamok':
|
||||||
|
@ -40,6 +51,13 @@ class dhcp(gen_config) :
|
||||||
option domain-name "wifi.crans.org";
|
option domain-name "wifi.crans.org";
|
||||||
option option-119 "wifi.crans.org 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
|
# Options communes à toutes les réseaux servis
|
||||||
base_dhcp="""
|
base_dhcp="""
|
||||||
|
@ -78,6 +96,8 @@ subnet %(network)s netmask %(netmask)s {
|
||||||
restart_cmd = '/etc/init.d/dhcp restart'
|
restart_cmd = '/etc/init.d/dhcp restart'
|
||||||
elif hostname == 'nectaris':
|
elif hostname == 'nectaris':
|
||||||
restart_cmd = 'kill $(ps auxwwc | awk \'($11 == "dhcpd") {print $2}\') ; sleep 1 ; dhcpd em0'
|
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:
|
else:
|
||||||
restart_cmd = 'true'
|
restart_cmd = 'true'
|
||||||
|
|
||||||
|
@ -105,6 +125,7 @@ subnet %(network)s netmask %(netmask)s {
|
||||||
|
|
||||||
### Ecriture du fichier
|
### Ecriture du fichier
|
||||||
fd = self._open_conf(self.DHCPD_CONF,'#')
|
fd = self._open_conf(self.DHCPD_CONF,'#')
|
||||||
|
fd.write(self.base_conf)
|
||||||
for net, options in self.reseaux.items() :
|
for net, options in self.reseaux.items() :
|
||||||
if not hosts.has_key(net) :
|
if not hosts.has_key(net) :
|
||||||
warnings += u'Réseau %s ignoré : aucune machine à servir\n' % net
|
warnings += u'Réseau %s ignoré : aucune machine à servir\n' % net
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue