12 |
12 |
auto lo
|
13 |
13 |
iface lo inet loopback
|
14 |
14 |
%def calc_bridge(%%name_eth, %%method_eth)
|
15 |
|
%if %%eth0_method == "pppoe"
|
|
15 |
%if %%name_eth == 'eth0' and %%eth0_method == "pppoe"
|
16 |
16 |
%set %%name_eth="ppp0"
|
17 |
17 |
%end if
|
18 |
18 |
%if %%method_eth == 'bridge'
|
... | ... | |
23 |
23 |
%%name_eth%slurp
|
24 |
24 |
%end def
|
25 |
25 |
##
|
26 |
|
%def gen_interfaces(%%name_eth_orig, %%eth_method, %%adresse_ip_eth, %%adresse_netmask_eth, %%adresse_broadcast_eth, %%adresse_network_eth, %%debit_carte_eth, %%method_eth, %%br_bridge_eth, %%adresse_gw="", %%valeur_mtu_eth="", %%restart_bastion='no')
|
|
26 |
%def gen_interfaces(%%num_interface, %%name_eth_orig, %%eth_method, %%adresse_ip_eth, %%adresse_netmask_eth, %%adresse_broadcast_eth, %%adresse_network_eth, %%debit_carte_eth, %%method_eth, %%br_bridge_eth, %%adresse_gw="", %%valeur_mtu_eth="")
|
27 |
27 |
%set %%name_eth = %%calc_bridge(%%name_eth_orig, %%method_eth)
|
|
28 |
%if %%eth_method == "pppoe"
|
|
29 |
auto dsl-provider
|
|
30 |
iface dsl-provider inet ppp
|
|
31 |
pre-up /sbin/ifconfig %%pppoe_interface up
|
|
32 |
provider dsl-provider
|
|
33 |
iface %%pppoe_interface inet manual
|
|
34 |
|
|
35 |
%end if
|
28 |
36 |
%if %%eth_method == "statique"
|
29 |
37 |
auto %%name_eth
|
30 |
38 |
iface %%name_eth inet static
|
... | ... | |
41 |
49 |
%if %%valeur_mtu_eth != ""
|
42 |
50 |
mtu %%valeur_mtu_eth
|
43 |
51 |
%end if
|
44 |
|
%else if %%eth_method == "dhcp"
|
|
52 |
%end if
|
|
53 |
%if %%eth_method == "dhcp"
|
45 |
54 |
auto %%name_eth
|
46 |
55 |
iface %%name_eth inet dhcp
|
47 |
56 |
%if %%valeur_mtu_eth != ""
|
48 |
57 |
pre-up /sbin/ifconfig %%name_eth mtu %%valeur_mtu_eth
|
49 |
58 |
%end if
|
50 |
|
%else if %%eth_method == "pppoe"
|
51 |
|
auto dsl-provider
|
52 |
|
iface dsl-provider inet ppp
|
53 |
|
pre-up /sbin/ifconfig %%pppoe_interface up
|
54 |
|
provider dsl-provider
|
55 |
|
iface %%pppoe_interface inet manual
|
56 |
59 |
%end if
|
57 |
|
%if %%restart_bastion == 'yes'
|
|
60 |
%if %%num_interface == %%nombre_interfaces
|
58 |
61 |
post-up /etc/init.d/bastion restart
|
59 |
62 |
%end if
|
60 |
63 |
%if %%method_eth == 'bridge'
|
... | ... | |
95 |
98 |
%end if
|
96 |
99 |
%end def
|
97 |
100 |
##
|
98 |
|
%%gen_interfaces('eth0', %%eth0_method, %%adresse_ip_eth0, %%adresse_netmask_eth0, %%adresse_broadcast_eth0, %%adresse_network_eth0, %%debit_carte_eth0, %%method_eth0, %%br_bridge_eth0, %%adresse_ip_gw, %%valeur_mtu_eth0, 'yes')
|
|
101 |
%%gen_interfaces('1', 'eth0', %%eth0_method, %%adresse_ip_eth0, %%adresse_netmask_eth0, %%adresse_broadcast_eth0, %%adresse_network_eth0, %%debit_carte_eth0, %%method_eth0, %%br_bridge_eth0, %%adresse_ip_gw, %%valeur_mtu_eth0)
|
99 |
102 |
%if %%alias_eth0 == "oui"
|
100 |
103 |
%for %%alias_addr_eth in %%alias_ip_eth0
|
101 |
104 |
%set %%alias_index = %%alias_addr_eth.index
|
... | ... | |
118 |
121 |
%end if
|
119 |
122 |
##
|
120 |
123 |
%if %%nombre_interfaces >= "2"
|
121 |
|
%%gen_interfaces('eth1', %%eth1_method, %%adresse_ip_eth1, %%adresse_netmask_eth1, %%adresse_broadcast_eth1, %%adresse_network_eth1, %%debit_carte_eth1, %%method_eth1, %%br_bridge_eth1)
|
|
124 |
%%gen_interfaces('2', 'eth1', %%eth1_method, %%adresse_ip_eth1, %%adresse_netmask_eth1, %%adresse_broadcast_eth1, %%adresse_network_eth1, %%debit_carte_eth1, %%method_eth1, %%br_bridge_eth1)
|
122 |
125 |
%if %%alias_eth1 == "oui"
|
123 |
126 |
%for %%alias_addr_eth in %%alias_ip_eth1
|
124 |
127 |
%set %%alias_index = %%alias_addr_eth.index
|
... | ... | |
140 |
143 |
%end if
|
141 |
144 |
##
|
142 |
145 |
%if %%nombre_interfaces >= "3"
|
143 |
|
%%gen_interfaces('eth2', %%eth2_method, %%adresse_ip_eth2, %%adresse_netmask_eth2, %%adresse_broadcast_eth2, %%adresse_network_eth2, %%debit_carte_eth2, %%method_eth2, %%br_bridge_eth2)
|
|
146 |
%%gen_interfaces('3', 'eth2', %%eth2_method, %%adresse_ip_eth2, %%adresse_netmask_eth2, %%adresse_broadcast_eth2, %%adresse_network_eth2, %%debit_carte_eth2, %%method_eth2, %%br_bridge_eth2)
|
144 |
147 |
%if %%alias_eth2 == "oui"
|
145 |
148 |
%for %%alias_addr_eth in %%alias_ip_eth2
|
146 |
149 |
%set %%alias_index = %%alias_addr_eth.index
|
... | ... | |
162 |
165 |
%end if
|
163 |
166 |
##
|
164 |
167 |
%if %%nombre_interfaces >= "4"
|
165 |
|
%%gen_interfaces('eth3', %%eth3_method, %%adresse_ip_eth3, %%adresse_netmask_eth3, %%adresse_broadcast_eth3, %%adresse_network_eth3, %%debit_carte_eth3, %%method_eth3, %%br_bridge_eth3)
|
|
168 |
%%gen_interfaces('4', 'eth3', %%eth3_method, %%adresse_ip_eth3, %%adresse_netmask_eth3, %%adresse_broadcast_eth3, %%adresse_network_eth3, %%debit_carte_eth3, %%method_eth3, %%br_bridge_eth3)
|
166 |
169 |
%if %%alias_eth3 == "oui"
|
167 |
170 |
%for %%alias_addr_eth in %%alias_ip_eth3
|
168 |
171 |
%set %%alias_index = %%alias_addr_eth.index
|
... | ... | |
184 |
187 |
%end if
|
185 |
188 |
##
|
186 |
189 |
%if %%nombre_interfaces >= "5"
|
187 |
|
%%gen_interfaces('eth4', %%eth4_method, %%adresse_ip_eth4, %%adresse_netmask_eth4, %%adresse_broadcast_eth4, %%adresse_network_eth4, %%debit_carte_eth4, %%method_eth4, %%br_bridge_eth4)
|
|
190 |
%%gen_interfaces('5', 'eth4', %%eth4_method, %%adresse_ip_eth4, %%adresse_netmask_eth4, %%adresse_broadcast_eth4, %%adresse_network_eth4, %%debit_carte_eth4, %%method_eth4, %%br_bridge_eth4)
|
188 |
191 |
%if %%alias_eth4 == "oui"
|
189 |
192 |
%for %%alias_addr_eth in %%alias_ip_eth4
|
190 |
193 |
%set %%alias_index = %%alias_addr_eth.index
|