| #!/bin/bash |
| # Copyright (C) 2000-2006 SWsoft. All rights reserved. |
| # |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 2 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| # |
| |
| VZCONF=@PKGCONFDIR@/vz.conf |
| test -f ${VZCONF} || exit 1 |
| test -f @PKGLIBDIR@/scripts/vps-functions || exit 1 |
| test -f /etc/init.d/functions && . /etc/init.d/functions |
| |
| # configure VZNET |
| modvenet="vznetdev vznet" |
| |
| ## SuSE distro |
| if [ -f /etc/sysconfig/network/scripts/functions ]; then |
| vznet=$1 |
| else |
| CONFIG=${1} |
| if ! . "$CONFIG"; then |
| echo "can't source interface config $CONFIG" >&2 |
| exit 1 |
| fi |
| vznet=$DEVICE |
| fi |
| . @PKGLIBDIR@/scripts/vps-functions |
| . ${VZCONF} |
| |
| veinfo="/proc/vz/veinfo" |
| |
| # configure interface |
| |
| for mod in ${modvenet}; do |
| modprobe ${mod} 2>/dev/null |
| done |
| |
| if [ ! -r $veinfo ]; then |
| echo "can't find venet kernel module" >&2 |
| exit 1 |
| fi |
| |
| ip link set $vznet up |
| |
| echo "Bringing up interface $vznet: " |
| ip addr add 0.0.0.0/0 dev $vznet |
| |
| echo "Configuring interface $vznet: " |
| sysctl -w net.ipv4.conf.$vznet.send_redirects=0 |
| |
| if [ "${IPV6}" = "yes" ]; then |
| echo "Configuring ipv6 $vznet: " |
| # Fix me: ip addres should be generated |
| ip -6 addr add fe80::1/128 dev $vznet |
| fi |
| |
| if [ -r $veinfo ]; then |
| vzgetnetdev |
| |
| for veip in `awk '($1 > 0) { for(i=4;i<=NF;i++) { print $i; } }' < $veinfo`; do |
| vzarp add $veip |
| vzaddrouting $veip |
| done |
| fi |
| |