69,10 → 69,10 |
# ******* Network parameters - paramètres réseau ******* |
HOSTNAME="alcasar" # |
DOMAIN="localdomain" # default local domain |
EXTIF=`/sbin/ip route|grep default|cut -d" " -f5` # EXTIF is connected to the ISP broadband modem/router (In France : Box-FAI) |
INTIF=`/sbin/ip link|grep '^[[:digit:]]:'|grep -v "lo\|$EXTIF"|cut -d" " -f2|tr -d ":"` # INTIF is connected to the consultation network |
EXTIF="eth0" # ETH0 is connected to the ISP broadband modem/router (In France : Box-FAI ) |
MTU="1500" |
ETHTOOL_OPTS='"autoneg off speed 100 duplex full"' |
INTIF="eth1" # ETH1 is connected to the consultation network |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # Default ALCASAR IP address |
# ****** Paths - chemin des commandes ******* |
SED="/bin/sed -i" |
98,6 → 98,8 |
echo "-----------------------------------------------------------------------------" |
} # End of header_install () |
|
#Launch network service (useful only when Mageia is running in SafeFail mode) |
service network start |
|
################################################################## |
## Function "testing" ## |
109,8 → 111,7 |
then echo -n "Tests des paramètres réseau : " |
else echo -n "Network parameters tests : " |
fi |
# We test EXTIF config files |
|
# We test eth0 config files |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2` |
if [ `echo $PUBLIC_IP|wc -c` -lt 7 ] || [ `echo $PUBLIC_GATEWAY|wc -c` -lt 7 ] |
175,6 → 176,30 |
exit 0 |
fi |
echo -n "." |
# On traite le cas où l'interface configurée lors de l'installation est "eth1" au lieu de "eth0" (mystère sur certaines versions de BIOS et de VirtualBox) |
if [ `ip route list|grep ^default|grep -c eth1` -eq "1" ] ; then |
if [ $Lang == "fr" ] |
then echo "La configuration des cartes réseau va être corrigée." |
else echo "The Ethernet card configuration will be corrected." |
fi |
/etc/init.d/network stop |
mv -f /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth0 |
$SED "s?eth1?eth0?g" /etc/sysconfig/network-scripts/ifcfg-eth0 |
/etc/init.d/network start |
echo 0 > /proc/sys/net/ipv4/conf/all/log_martians |
sleep 2 |
if [ $Lang == "fr" ] |
then echo "Configuration corrigée" |
else echo "Configuration updated" |
fi |
sleep 2 |
if [ $Lang == "fr" ] |
then echo "Vous pouvez relancer ce script." |
else echo "You can restart this script." |
fi |
exit 0 |
fi |
echo -n "." |
# On teste le lien vers le routeur par defaut |
IP_GW=`ip route list|grep ^default|cut -d" " -f3` |
arp_reply=`/usr/sbin/arping -b -I$EXTIF -c1 -w2 $IP_GW|grep response|cut -d" " -f2` |
292,7 → 317,7 |
## Function "network" ## |
## - Définition du plan d'adressage du réseau de consultation ## |
## - Nommage DNS du système ## |
## - Configuration de l'interface INTIF (réseau de consultation)## |
## - Configuration de l'interface eth1 (réseau de consultation) ## |
## - Modification du fichier /etc/hosts ## |
## - Configuration du serveur de temps (NTP) ## |
## - Renseignement des fichiers hosts.allow et hosts.deny ## |
351,7 → 376,7 |
PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1` # First network address (ex.: 192.168.182.1) |
PRIVATE_SECOND_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2` # second network address (ex.: 192.168.182.2) |
PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1` # last network address (ex.: 192.168.182.254) |
PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6` # MAC address of INTIF |
PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6` # MAC address of INTIF (eth1) |
# Define Internet parameters |
[ -e /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF ] || cp /etc/sysconfig/network-scripts/ifcfg-$EXTIF /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS |
386,7 → 411,7 |
127.0.0.1 localhost |
$PRIVATE_IP $HOSTNAME.$DOMAIN |
EOF |
# Config EXTIF (Internet) |
# Config eth0 (Internet) |
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF |
DEVICE=$EXTIF |
BOOTPROTO=static |
404,7 → 429,7 |
USERCTL=no |
MTU=$MTU |
EOF |
# Config INTIF (consultation LAN) in normal mode |
# Config eth1 (consultation LAN) in normal mode |
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$INTIF |
DEVICE=$INTIF |
BOOTPROTO=static |
417,7 → 442,7 |
USERCTL=no |
ETHTOOL_OPTS=$ETHTOOL_OPTS |
EOF |
# Config of INTIF in bypass mode (see "alcasar-bypass.sh") |
# Config of eth1 in bypass mode (see "alcasar-bypass.sh") |
cat <<EOF > /etc/sysconfig/network-scripts/default-ifcfg-$INTIF |
DEVICE=$INTIF |
BOOTPROTO=static |
880,7 → 905,7 |
cd net; |
mknod tun c 10 200) |
} |
ifconfig $INTIF 0.0.0.0 |
ifconfig eth1 0.0.0.0 |
daemon /usr/sbin/chilli -c \$CONFIG --pidfile=\$pidfile & |
RETVAL=$? |
fi |
924,8 → 949,8 |
cat <<EOF > /etc/chilli.conf |
# coova config for ALCASAR |
cmdsocket /var/run/chilli.sock |
unixipc chilli.$INTIF.ipc |
pidfile /var/run/chilli.$INTIF.pid |
unixipc chilli.eth1.ipc |
pidfile /var/run/chilli.eth1.pid |
net $PRIVATE_NETWORK_MASK |
dhcpif $INTIF |
ethers $DIR_DEST_ETC/alcasar-ethers |
958,7 → 983,7 |
#dhcprelayagent |
#dhcpgatewayport |
EOF |
# create file for DHCP static ip. Reserve the second IP address for INTIF (the first one is for tun0) |
# create file for DHCP static ip. Reserve the second IP address for eth1 (the first one is for tun0) |
echo "$PRIVATE_MAC $PRIVATE_SECOND_IP" > $DIR_DEST_ETC/alcasar-ethers |
# create files for trusted domains and urls |
touch $DIR_DEST_ETC/alcasar-uamallowed $DIR_DEST_ETC/alcasar-uamdomain |
1461,8 → 1486,8 |
echo "MULTIWAN=off" >> $CONF_FILE |
echo "FAILOVER=30" >> $CONF_FILE |
echo "## WANx=active,@IPx/mask,GWx,Weight,MTUx" >> $CONF_FILE |
echo "#WAN1=\"1,$EXTIF:1,192.168.2.20/24,192.168.2.6,1,1500\"" >> $CONF_FILE |
echo "#WAN2=\"1,$EXTIF:2,192.168.3.20/24,192.168.3.1,2,1500\"" >> $CONF_FILE |
echo "#WAN1=\"1,eth0:1,192.168.2.20/24,192.168.2.6,1,1500\"" >> $CONF_FILE |
echo "#WAN2=\"1,eth0:2,192.168.3.20/24,192.168.3.1,2,1500\"" >> $CONF_FILE |
# Coloration des prompts |
[ -e /etc/bashrc.default ] || cp /etc/bashrc /etc/bashrc.default |
cp -f $DIR_CONF/bashrc /etc/. ; chmod 644 /etc/bashrc ; chown root:root /etc/bashrc |
1716,7 → 1741,7 |
license |
header_install |
testing |
# Test if ALCASAR is already installed |
# Test if ALCASAR is already installed (before v2.2, the conf file doesn't exist --> can't update) |
if [ -e $CONF_FILE ] |
then |
current_version=`cat $CONF_FILE | grep VERSION | cut -d"=" -f2` |
1744,7 → 1769,6 |
fi |
fi |
# RPMs install |
echo "STOP" ; read a |
$DIR_SCRIPTS/alcasar-urpmi.sh |
if [ "$?" != "0" ] |
then |