Line 1... |
Line 1... |
1 |
#/bin/sh
|
1 |
#/bin/sh
|
2 |
# $Id: alcasar-conf.sh 629 2011-06-09 20:54:27Z richard $
|
2 |
# $Id: alcasar-conf.sh 631 2011-06-12 10:34:00Z richard $
|
3 |
# $Author: richard $
|
3 |
# $Author: richard $
|
4 |
# by rexy
|
4 |
# by rexy
|
5 |
# Ce script permet de créer ou de charger l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
5 |
# Ce script permet de créer ou de charger l'archive des fichiers de configuration (/tmp/alcasar-conf.tar.gz)
|
6 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
6 |
DIR_UPDATE="/tmp/conf" # répertoire de stockage des fichier de conf pour une mise à jour
|
7 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
7 |
DIR_WEB="/var/www/html" # répertoire du centre de gestion
|
Line 227... |
Line 227... |
227 |
if [[ "$?" -ne 0 ]]
|
227 |
if [[ "$?" -ne 0 ]]
|
228 |
then
|
228 |
then
|
229 |
echo "Syntax error for the IP address of the second DNS server ($DNS2)"
|
229 |
echo "Syntax error for the IP address of the second DNS server ($DNS2)"
|
230 |
exit 0
|
230 |
exit 0
|
231 |
fi
|
231 |
fi
|
232 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1` # @ réseau de consultation (ex.: 192.168.182.0)
|
232 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
|
233 |
PRIVATE_NETMASK=`echo $PRIVATE_IP_MASK | cut -d"/" -f2` # @ + masque du réseau de consult (192.168.182.0/24)
|
233 |
PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2` # @ masque du réseau de consult (255.255.255.0)
|
234 |
private_network_calc
|
234 |
private_network_calc
|
235 |
|
235 |
|
236 |
# /etc/hosts
|
236 |
# /etc/hosts
|
237 |
cat <<EOF > /etc/hosts
|
237 |
cat <<EOF > /etc/hosts
|
238 |
127.0.0.1 localhost
|
238 |
127.0.0.1 localhost
|
Line 244... |
Line 244... |
244 |
$SED "s?^NETMASK=.*?NETMASK=$PUBLIC_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
244 |
$SED "s?^NETMASK=.*?NETMASK=$PUBLIC_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
245 |
$SED "s?^GATEWAY=.*?GATEWAY=$PUBLIC_GATEWAY?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
245 |
$SED "s?^GATEWAY=.*?GATEWAY=$PUBLIC_GATEWAY?" /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
246 |
$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
246 |
$SED "s?^IPADDR=.*?IPADDR=$PRIVATE_IP?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
247 |
$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
247 |
$SED "s?^NETMASK=.*?NETMASK=$PRIVATE_NETMASK?" /etc/sysconfig/network-scripts/ifcfg-$INTIF
|
248 |
|
248 |
|
- |
|
249 |
echo "NIC ok"
|
249 |
# NTP server
|
250 |
# NTP server
|
250 |
$SED "s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap\nrestrict 127.0.0.1?" /etc/ntp.conf
|
251 |
$SED "s?^restrict.*?restrict $PRIVATE_NETWORK mask $PRIVATE_NETMASK nomodify notrap\nrestrict 127.0.0.1?" /etc/ntp.conf
|
251 |
|
252 |
|
252 |
# host.allow
|
253 |
# host.allow
|
253 |
cat <<EOF > /etc/hosts.allow
|
254 |
cat <<EOF > /etc/hosts.allow
|