=== Making a veth-device persistent ===
According to http://bugzilla.openvz.org/show_bug.cgi?id=301 , a bug that stopped the veth device persistent was "Obsoleted now when --veth_add/--veth_del are introduced"
At the moment, it is not possible to have the commands needed for a persistent veth being made automatically be vzctl. A bugreport ( See http://bugzillawiki.openvz.org/show_bugw/index.cgiphp?idtitle=301 ) has already been made. Until then, here's a way to make the above steps persistent. 1. First, edit the VE's configuration to specify what the veth's IP address(es) should be, and to indicate that a custom script should be run when starting up a VE.* Open up /etc/vz/conf/VEID.conf* Comment out any IP_ADDRESS entries to prevent a VENET-device from being created in the VE* Add or change the entry CONFIG_CUSTOMIZEDVirtual_Ethernet_device&diff="yes"* Add an entry VETH_IP_ADDRESS5990&oldid="<VE IP>" The VE IP can have multiple IPs, separated by spaces 2. Now to create that "custom script". The following helper script will check the configuration file for IP addresses and 5989 for the veth interface, and configure the IP routing accordingly. Create the script /usr/sbin/vznetaddroute to have the following, and then <code>chmod 0500 /usr/sbin/vznetaddroute</code> to make it executable. <pre>#!/bin/bash# /usr/sbin/vznetaddroute# a script workaround that used to bring up virtual network interfaces (veth's) be described in a VE CONFIGFILE=/etc/vz/conf/$VEID.conf. $CONFIGFILEVZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\),.*$/\1/g'` if [ ! -n "$VETH_IP_ADDRESS" ]; then echo "According to $CONFIGFILE VE$VEID has no veth IPs configured." exit 1fi if [ ! -n "$VZHOSTIF" ]; then echo "According to $CONFIGFILE VE$VEID has no veth interface configured." exit 1fi for IP in $VETH_IP_ADDRESS; do echo "Adding interface $VZHOSTIF and route $IP for VE$VEID to CT0" /sbin/ifconfig $VZHOSTIF 0 echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/proxy_arp echo 1 > /proc/sys/net/ipv4/conf/$VZHOSTIF/forwarding /sbin/ip route add $IP dev $VZHOSTIFdone exit 0</pre> 3. Now create /etc/vz/vznet.conf containing the following. This is what defines the "custom script" as being the vznetaddroute which you just created. <pre>#!/bin/bashEXTERNAL_SCRIPT="/usr/sbin/vznetaddroute"</pre> 4. Of course, the VE's operating system will need to be configured with those IP address(es) as well. Consult the manual for your VE's OS for detailsthis section.
That's it! At this point, when you restart the VE you should see a new line in the output, indicating that the interface is being configured and a new route being added. And you should be able to ping the host, and to enter the VE and use the network.