4
edits
Changes
Added On-Umount script for remove routes to container with veth-bridge from bridge
IP_STRIP=${IP%%/*};
echo "Adding a route from CT0 to CT$VEIDusing $IP_STRIP."
$ip route add $IP_STRIP dev $CTROUTEDEV
done
{{Note|<code>/usr/sbin/vznetcfg.custom</code> should be executable (chmod +x /usr/sbin/vznetcfg.custom)}}
{{Note|When CT is stoped there are HW → CT route(s) still present in route table. We can use On-umount script for solve this.}}
==== Create On-umount script for remove HW → CT route(s) ====
which should be called each time a container with VEID (<code></etc/sysconfig/vz/$VEID.umount/code>), or any container (<code></etc/sysconfig/vz/vps.umount/code>) is stoped:
<pre>
#!/bin/bash
# /etc/sysconfig/vz/$VEID.umount or /etc/sysconfig/vz/vps.umount
# a script to remove routes to container with veth-bridge from bridge
CTCONFIGFILE=/etc/vz/conf/$VEID.conf
ip=/sbin/ip
. $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
exit 0
</pre>
{{Note|The script should be executable (chmod +x /etc/sysconfig/vz/vps.umount)}}
==== Setting the route CT → HN ====