[Users] Network configuration

Yoann Moulin ymo at adviseo.fr
Wed Dec 12 12:57:38 EST 2007


  > is it possible to know in the EXTERNAL_SCRIPT, for which interface, the
> script is execute ?

Well, I gave a look to the source code and got my answer ($3)... it's working perfectly.

NETIF still the same :

NETIF="ifname=eth1.10,mac=00:16:3E:00:00:1E,host_ifname=veth10.10,host_mac=00:E0:81:4B:2F:DB;ifname=eth1.19,mac=00:16:3E:00:00:1E,host_ifname=veth10.19,host_mac=00:E0:81:4B:2F:DB"

and the script begin :

---- BEGIN SCRIPT ----
#!/bin/bash
# /usr/sbin/vznetaddroute
# a script to bring up virtual network interfaces (veth's) in a VE
CONFIGFILE=/etc/vz/conf/$VEID.conf
. $CONFIGFILE
VETH=$3
VZHOSTIF=`echo ${VETH} | cut -f1 -d"."`
VLAN=`echo ${VETH} | cut -f2 -d"."`
VETH_BRIDGE=brvlan${VLAN}

if [ ! -n "${VZHOSTIF}.${VLAN}" ]; then
         echo "According to $CONFIGFILE VE$VEID has no veth interface configured."
         exit 1
fi

if [ ! -n "${VETH_BRIDGE}" ]; then
    echo "According to $CONFIGFILE VE$VEID has no veth VETH_BRIDGE configured."
    exit 1
fi

echo "Adding interface ${VZHOSTIF}.${VLAN} to VETH_BRIDGE ${VETH_BRIDGE} on VE0"

if [ -z "`/usr/sbin/brctl show | /bin/grep ${VETH_BRIDGE}`" ]; then
    /usr/sbin/brctl addbr ${VETH_BRIDGE}
    /usr/sbin/brctl addif ${VETH_BRIDGE} eth1.${VLAN}
    /sbin/ip link set ${VETH_BRIDGE} up
fi

/usr/sbin/brctl addif ${VETH_BRIDGE} ${VZHOSTIF}.${VLAN}
/sbin/ip link set ${VZHOSTIF}.${VLAN} up
exit 0
---- END SCRIPT ----

sorry for the noise

Yoann


More information about the Users mailing list