OpenVZ Forum

Home » Mailing lists » Users » Network configuration
Network configuration [message #24977] Wed, 12 December 2007 17:01 Go to previous message
Yoann Moulin is currently offline  Yoann Moulin
Messages: 16
Registered: December 2007
Junior Member
Hi all,

I'm currently working on a xen to openvz migration and some I have problem to setup the network configuration.

I'm using the lastest kernel patch build to support nfsroot for the openvz host under ubuntu dapper 6.06 LTS

I will have at least 12 vlan on the OVZ host, and 2 or 3 vlan in each VE

for example, NETIF for the VEID 101


and I want an EXTERNAL_SCRIPT that check if the bridge exist, and if not create and add the interface

my first idea was adding a new variable that indicate all the vlan we have to configure :

VETH_BRIDGE="brvlan10 brvlan19"

with this script :

---- BEGIN SCRIPT ----
# /usr/sbin/vznetaddroute
# a script to bring up virtual network interfaces (veth's) in a VE
VZHOSTIF=`echo $NETIF |sed 's/^.*host_ifname=\(.*\)\..*,.*$/\1/g'`

for BRIDGE in ${VETH_BRIDGE} ; do

         VLAN=`echo ${BRIDGE} | sed 's/brvlan//'`

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

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

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

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

         /usr/sbin/brctl addif ${BRIDGE} ${VZHOSTIF}.${VLAN}
         /sbin/ip link set ${VZHOSTIF}.${VLAN} up

exit 0
---- END SCRIPT ----

When I start my VE, I have :

# vzctl start 101
Starting VE ...
VE is mounted
Setting CPU limit: 241132
Setting CPU units: 55555
Configure meminfo: 502650
Set hostname: adviseo03
Configure veth devices: veth101.10 veth101.19
Adding interface veth101.10 to bridge brvlan10 on VE0
Adding interface veth101.19 to bridge brvlan19 on VE0
interface veth101.19 does not exist!
SIOCGIFFLAGS: No such device
Adding interface veth101.10 to bridge brvlan10 on VE0
device veth101.10 is already a member of a bridge; can't enslave it to bridge brvlan10.
Adding interface veth101.19 to bridge brvlan19 on VE0
VE start in progress...

so at start vzctl already know we will have 2 net device : "Configure veth devices: veth101.10 veth101.19"

so the EXTERNAL_SCRIPT is execute 2 times, one time for each veth, so I shouldn't need to setup VETH_BRIDGE if in the
EXTERNAL_SCRIPT, I'm able to know with veth is currently configured

It's not easy to explain until it is still quite complicated for me

so the question is :

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

thanks for your help

ps : already sent this message at 5:30pm GMT+1 but not arrived yet a 6:00 GMT+1
Read Message
Read Message
Previous Topic: Dns resolution failure..
Next Topic: strange problem with nagios nrpe server
Goto Forum:

Current Time: Thu Oct 22 01:15:47 GMT 2020