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 bridges.sh |grep .

#!/bin/sh
brctl=`which brctl`
ifconfig=`which ifconfig`
ip=`which ip`
$brctl addbr vzbr0
$ifconfig vzbr0 up
$brctl addif vzbr0 bond0
$ifconfig vzbr0 0.0.0.0
$ifconfig bond0 0.0.0.0
$ifconfig eth0 0.0.0.0
$ifconfig eth1 0.0.0.0
$ifconfig vzbr0 YOUR_IP netmask 255.255.255.248 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/fail.sh

#!/bin/sh
/root/scripts/bridges.sh ; sleep 60; brctl delif vzbr0 bond0; ifconfig bond0 YOUR_IP netmask 255.255.255.248; ip r a default via YOUR_GATEWAY
^C

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

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

root@streamer:~/scripts# /tmp/fail.sh &

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

5. Add bridges.sh 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/bridges.sh 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:)

Advertisements

From → Networking, OpenVZ

Leave a Comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: