I was seeing loss in network connectivity when an OpenVZ container is stopped and noticed that the bridge mac address was taking the mac address of an existing containers virtual network interface instead of the physical interface.
The solution was to set the bridge mac address to the physical interface:
/sbin/ifconfig br0 hw ether $(ifconfig eth0 | awk '{print $5; exit}')
Here is what my "/etc/sysconfig/vz-scripts/vps
#!/bin/bash
# /etc/sysconfig/vz-scripts/$VEI D.umount or /etc/sysconfig/vz-scripts/vps. umount
# a script to remove routes to container with veth-bridge from bridge
CTCONFIGFILE=/etc/vz/conf/$V EID.conf
ip=/sbin/ip
ifconfig=/sbin/ifconfig
. $CTCONFIGFILE
if [ ! -n "$VETH_IP_ADDRESS" ]; then
exit 0
fi
if [ ! -n "$BRIDGEDEV" ]; then
exit 0
fi
for IP in $VETH_IP_ADDRESS; do
# removing the netmask
IP_STRIP=${IP%%/*};
echo "Remove a route from CT0 to CT$VEID using $IP_STRIP."
$ip route del $IP_STRIP dev $BRIDGEDEV
done
# Set the default mac adresses:
echo "Setting default mac addressed for br0 and br1"
$ifconfig br0 hw ether $($ifconfig eth0 | awk '{print $5; exit}')
$ifconfig br1 hw ether $($ifconfig eth1 | awk '{print $5; exit}')
exit 0
References:
- sandip's blog
- Login or register to post comments