Hi community,
the article about the network mode "bridged" (https:// docs.openvz.org/openvz_users_guide.webhelp/_bridged_mode_for _containers.html) in the documentation says this mode can only be an addition to the host-routed network. But a VE without a host-routed network is exactly what I want to have. My VEs should have only a bridged interface.
So I was able to get rid of venet0 on the physical host and I removed the network "Host-Only". But venet0 still exists in the VE. It seems like no network traffic can go through venet0 on the VE anymore and that's great. But how do I remove the network device of the VE. I really want this net device to disappear. Has someone an idea?
This is what I've done to get rid of venet0 on the physical host:
1)
I modified /usr/libexec/vz so the function setup_net is looking like this (got the idea from here https://openvz.org/Disable_venet_interface):
setup_net()
{
local hwcsum_set=1 tso_set=1 val
local rx=on tx=on sg=on tso=on
local ethtool_args= iface_params
# We do not want to export the whole config file.
eval $(. ${VZCONF} && echo USE_NET_TSO="${USE_NET_TSO}" \
USE_NET_HWCSUM="${USE_NET_HWCSUM}")
if [ -n "${VE_ROUTE_SRC_DEV}" ]; then
setup_venet
fi
if [ "${USE_NET_HWCSUM}" = "yes" ]; then
ethtool_args="${ethtool_args} rx on tx on sg on"
elif [ "${USE_NET_HWCSUM}" = "no" ]; then
ethtool_args="${ethtool_args} rx off tx off sg off"
else
hwcsum_set=0
fi
if [ "${USE_NET_TSO}" = "yes" ]; then
ethtool_args="${ethtool_args} tso on"
elif [ "${USE_NET_TSO}" = "no" ]; then
ethtool_args="${ethtool_args} tso off"
else
tso_set=0
fi
if [[ ${hwcsum_set} -eq 0 || ${tso_set} -eq 0 ]]; then
# Get minimal common subset of capabilities.
for iface in $(get_physical_interfaces); do
iface_params=$(ethtool -k "${iface}" | awk '
/^rx-checksumming:/{print "rx", $2};
/^tx-checksumming:/{print "tx", $2};
/^scatter-gather:/{print "sg", $2};
/^tcp-segmentation-offload:/{print "tso", $2}')
for param in rx tx sg tso; do
val=$(echo "${iface_params}" | awk "/${param}/{print \$2}")
[ "${val}" = "off" ] && eval ${param}=off
done
done
[ ${hwcsum_set} -eq 0 ] && ethtool_args="${ethtool_args} rx ${rx} tx ${tx} sg ${sg}"
[ ${tso_set} -eq 0 ] && ethtool_args="${ethtool_args} tso ${tso}"
fi
if [ -n "$VE_ROUTE_SRC_DEV"]; then
[ -n "${ethtool_args}" ] && ethtool -K venet0 ${ethtool_args} &>/dev/null
fi
return 0
}
2)
To take effect I have this in the /etc/vz/vz.conf:
3)
prlsrvctl net del Host-Only
And after reboot there should be no venet0 on the physical host. But still there is a venet0 in the VE.
This had no effect:
prlctl set OpenVZ_Tests_VE_d2 --netif_del venet0