diff --git a/Python/etc/network/interfaces b/Python/etc/network/interfaces index 7e14733..1d66bb0 100644 --- a/Python/etc/network/interfaces +++ b/Python/etc/network/interfaces @@ -24,7 +24,7 @@ iface %(interface)s inet static gateway 138.231.136.4 dns-nameservers 138.231.136.10 138.231.136.9 138.231.136.3 dns-search crans.org""" % { 'interface': interface, 'ip': pubip() } - else: + elif mode == "adm": print """auto %(interface)s iface %(interface)s inet static address %(ip)s @@ -34,6 +34,24 @@ iface %(interface)s inet static mtu 1496 dns-nameservers 10.231.136.10 138.231.136.9 10.231.136.3 dns-search adm.crans.org""" % { 'interface': interface, 'ip': admip() } + elif mode == "radin": + print """auto %(interface)s +iface %(interface)s inet static + address %(ip)s + network 10.42.0.0 + netmask 255.255.0.0 + broadcast 10.42.255.255 + mtu 1496""" % { 'interface': interface, 'ip': radinip() } + elif mode == "accueil": + print """auto %(interface)s +iface %(interface)s inet static + address %(ip)s + network 10.51.0.0 + netmask 255.255.0.0 + broadcast 10.51.255.255 + mtu 1496""" % { 'interface': interface, 'ip': accueilip() } + else: + raise NotImplementedError, "Mode de réseau inconnu : %s" % mode for line in additionnals: print " ", line diff --git a/etc/python/ip.py b/etc/python/ip.py index 0732bcb..b7e364c 100644 --- a/etc/python/ip.py +++ b/etc/python/ip.py @@ -19,3 +19,15 @@ def pubip(): def admip(): return admipof(hostname) + +def radinip(): + if hostname == 'sable': + return '10.42.0.1' + else: + raise NotImplementedError, "Ce serveur n'a rien à faire sur le VLAN radin" + +def accueilip(): + if hostname == 'sable': + return '10.51.0.1' + else: + raise NotImplementedError, "Ce serveur n'a rien à faire sur le VLAN d'accueil"