Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Disable venet interface

4,514 bytes added, 13:44, 29 October 2009
New page: If you have configure veth correctly and want to get rid of venet interface modify ''/etc/init.d/vz'' following this step: 1. /etc/init.d/vz stop before going further. 2. Comment...
If you have configure [[veth]] correctly and want to get rid of [[venet]] interface modify ''/etc/init.d/vz'' following this step:

1. /etc/init.d/vz stop before going further.

2. Comment line ''VZDEV=venet0'' (~ line 53).

3. Replace line NET_MODULES="${VNET_MODULES} ${VETH_MODULES}" (~ line 67) with this block:

<code>
####################################
# Patch for disable venet interface
# Block 1
# 2009-10-29 Michael Plourde
###################################
NET_MODULES="${VETH_MODULES}"
if [ -n "${VZDEV}" ]
then
NET_MODULES="${NET_MODULES} ${VNET_MODULES}"
fi
####################################
# Patch for disable venet interface
# End Block 1
# 2009-10-29 Michael Plourde
###################################
</code>

4. In the start_net() function (~ line 306) find those lines:
<code>
__echo "Bringing up interface $VZDEV: "
ip link set $VZDEV up
print_result
ip addr add 0.0.0.0/0 dev $VZDEV
__echo "Configuring interface $VZDEV: "
sysctl -q -w net.ipv4.conf.$VZDEV.send_redirects=0
print_result
if [ "${IPV6}" = "yes" ]; then
__echo "Configuring ipv6 $VZDEV: "
# Fix me: ip addres should be generated
ip -6 addr add fe80::1/128 dev $VZDEV
print_result
fi
</code>

and add these block before:
<code>
####################################
# Patch for disable venet interface
# Block 2
# 2009-10-29 Michael Plourde
###################################
if [ -n "$VZDEV" ]
then
</code>
and this one after:
<code>
fi
####################################
# Patch for disable venet interface
# End Block 2
# 2009-10-29 Michael Plourde
###################################
</code>

The start_net function should look like this:
<code>start_net()
{
local mod

# load all kernel modules needed for VE networking
for mod in ${NET_MODULES}; do
modprobe ${mod} 2>/dev/null
done

if ip addr list | grep -q "venet0:.*UP" 2>/dev/null; then
return 0
fi

get_veinfo
if [ -z "$VEINFO" ]; then
return 0
fi
####################################
# Patch for disable venet interface
# Block 2
# 2009-10-29 Michael Plourde
###################################
if [ -n "$VZDEV" ]
then
__echo "Bringing up interface $VZDEV: "
ip link set $VZDEV up
print_result
ip addr add 0.0.0.0/0 dev $VZDEV
__echo "Configuring interface $VZDEV: "
sysctl -q -w net.ipv4.conf.$VZDEV.send_redirects=0
print_result
if [ "${IPV6}" = "yes" ]; then
__echo "Configuring ipv6 $VZDEV: "
# Fix me: ip addres should be generated
ip -6 addr add fe80::1/128 dev $VZDEV
print_result
fi
fi
####################################
# Patch for disable venet interface
# End Block 2
# 2009-10-29 Michael Plourde
###################################
}</code>

5. Modify the stop_net function (~ line 351) to look like this:
<code>stop_net()
{
local mod
####################################
# Patch for disable venet interface
# Block 3
# 2009-10-29 Michael Plourde
###################################
if [ -n "$VZDEV" ]
then
if ip addr list | grep -q "venet0:.*UP" 2>/dev/null; then
__echo "Bringing down interface $VZDEV: "
ip link set $VZDEV down
print_result
fi
fi
####################################
# Patch for disable venet interface
# End Block 3
# 2009-10-29 Michael Plourde
###################################
for mod in ${NET_MODULES}; do
/sbin/modprobe -r ${mod} > /dev/null 2>&1
done
}</code>

6. That's all. You can now start your VEs:''/etc/init.d/vz start''
Anonymous user