Skip to content

HOWTO: Configure VE and VEnode in one subnet with linux bridge interface on OpenVZ .. from remote

March 11, 2012

..continued from HOWTO: Install and configure bonding interface (active-backup) on Debian linux

Assuming: installed Debian system, and OpenVZ with vztools, and installed bridge-utils (apt-get install bridge-utils)

1. Create bridge setuping shell script to be used:

root@streamer:~/scripts# cat |grep .

brctl=`which brctl`
ifconfig=`which ifconfig`
ip=`which ip`
$brctl addbr vzbr0
$ifconfig vzbr0 up
$brctl addif vzbr0 bond0
$ifconfig vzbr0
$ifconfig bond0
$ifconfig eth0
$ifconfig eth1
$ifconfig vzbr0 YOUR_IP netmask up
$ip r add default via YOUR_GATEWAY

2. Create temp script to be run in background, with failover 🙂 functionality

root@streamer:~/scripts# cat >/tmp/

/root/scripts/ ; sleep 60; brctl delif vzbr0 bond0; ifconfig bond0 YOUR_IP netmask; ip r a default via YOUR_GATEWAY

root@streamer:~/scripts# chmod +x /tmp/

3. Execute the failover script in background !!! and hope for icmp reply 🙂

root@streamer:~/scripts# /tmp/ &

4. Logon and kill the script (fast, you have 60 seconds to do it)

5. Add script to /etc/rc.local to load after the initial network configuration (/etc/network/interfaces)

6. Add shitty lines in /etc/rc.local, because im too lazy:

root@streamer:~/scripts# grep -v ^# /etc/rc.local |grep .

/root/scripts/ 1>/dev/null 2>/dev/null
/etc/init.d/vz restart 1>/dev/null 2>/dev/null
brctl addif vzbr0 veth100.0
exit 0

7. reboot and hope for the BEST :D:)


From → Networking, OpenVZ

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: