#!/bin/bash # This script source VPS configuration files in the same order as vzctl does # if one of these files does not exist then something is really broken [ -f /etc/vz/vz.conf ] || exit 1 [ -f $VE_CONFFILE ] || exit 1 # source both files. Note the order, it is important . /etc/vz/vz.conf . $VE_CONFFILE # Configure veth with IP after VPS has started { IP=10.213.223.103 DEV=veth103.0 while sleep 1; do /sbin/ifconfig $DEV 0 >/dev/null 2>&1 echo 1 > /proc/sys/net/ipv4/conf/$DEV/forwarding echo 1 > /proc/sys/net/ipv4/conf/$DEV/proxy_arp if [ $? -eq 0 ]; then /sbin/ip route add $IP dev $DEV break fi done } &