From a055c1555e0a8c0cfb8c6308990a23eb8db59d13 Mon Sep 17 00:00:00 2001 From: Gwenael Lambrouin Date: Mon, 6 Dec 2021 09:23:21 +0100 Subject: nfvbenchvm: set mgmt interface MTU=1500 by default By default, configure the MTU of the management interface to the conservative value of 1500: this will reduce the risk to get an unmanageable VM. Else the MTU we will get will depend on the IaaS setup and it could be high. And this will lead to troubles when we try to manage the VM from a machine configured with a high MTU and when the network path contains a link with a low MTU. This can typically happen when we try to manage the VM from another VM in the same IaaS and when the management traffic has to go outside the IaaS. To set the MTU to a different value, configure the INTF_MGMT_MTU variable in /etc/nfvbenchvm.conf. If INTF_MGMT_MTU is set to the special value "auto", the MTU will not be configured and it will keep the value set by the hypervisor ("legacy" nfvbenchvm behavior). If INTF_MGMT_MTU is unset, the MTU will be set to 1500. In other cases, the MTU will be set to the value of INTF_MGMT_MTU. Change-Id: I5816113bbacec5fcdcc9672e20d8a4e2ac0c599a Signed-off-by: Gwenael Lambrouin --- nfvbenchvm/README.rst | 12 ++++++++++++ .../nfvbenchvm/static/etc/rc.d/rc.local.generator | 20 +++++++++++++++++++- .../nfvbenchvm/static/etc/rc.d/rc.local.loopvm | 20 +++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/nfvbenchvm/README.rst b/nfvbenchvm/README.rst index 0b6fd37..29215c1 100644 --- a/nfvbenchvm/README.rst +++ b/nfvbenchvm/README.rst @@ -227,9 +227,21 @@ nfvbenchvm config file with management interface: INTF_MAC_MGMT=FA:16:3E:06:11:8A INTF_MGMT_CIDR=172.20.56.228/2 INTF_MGMT_IP_GW=172.20.56.225 + INTF_MGMT_MTU=1500 .. note:: `INTF_MGMT_IP_GW` and `INTF_MGMT_CIDR` parameters are used by the VM to automatically configure virtual interface and route to allow an external access through SSH. +.. note:: ``INTF_MGMT_MTU`` allows to specify the MTU of the management + interface in bytes. + + If ``INTF_MGMT_MTU`` is not specified, the MTU will be configured to + the conservative value of 1500: this will reduce the risk to get an + unmanageable VM. + + ``INTF_MGMT_MTU`` can also be set to the special value ``auto``: in + that case, the MTU will not be configured and it will keep the value + set by the hypervisor (default nfvbench behavior up to version + 5.0.3). Using pre-created direct-physical ports on openstack, mac addresses value are only known when VM is deployed. In this case, you can pass the port name in config: diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator index 633403c..9ac23a3 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.generator @@ -86,6 +86,24 @@ if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then logger "NFVBENCHVM ERROR: Cannot find eth port for management port" return 1 fi + + # By default, configure the MTU of the management interface to the + # conservative value of 1500: this will reduce the risk to get an + # unmanageable VM in some setups. + # + # To set the MTU to a different value, configure the INTF_MGMT_MTU variable + # in /etc/nfvbenchvm.conf. If INTF_MGMT_MTU is set to the special value + # "auto", the MTU will not be configured and it will keep the value set by + # the hypervisor ("legacy" nfvbenchvm behavior). If INTF_MGMT_MTU is unset, + # the MTU will be set to 1500. In other cases, the MTU will be set to the + # value of INTF_MGMT_MTU. + # + if [[ -z "$INTF_MGMT_MTU" ]]; then + ip link set $ETH_PORT mtu 1500 + elif [[ "$INTF_MGMT_MTU" != "auto" ]]; then + ip link set $ETH_PORT mtu $INTF_MGMT_MTU + fi + ip addr add $INTF_MGMT_CIDR dev $ETH_PORT ip link set $ETH_PORT up ip route add default via $INTF_MGMT_IP_GW dev $ETH_PORT @@ -101,4 +119,4 @@ else /nfvbench/start-nfvbench.sh fi -exit 0 \ No newline at end of file +exit 0 diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm index ecc8b05..608c2c7 100644 --- a/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm +++ b/nfvbenchvm/dib/elements/nfvbenchvm/static/etc/rc.d/rc.local.loopvm @@ -137,6 +137,24 @@ if [ $INTF_MGMT_CIDR ] && [ $INTF_MGMT_IP_GW ]; then else ETH_PORT="eth0" fi + + # By default, configure the MTU of the management interface to the + # conservative value of 1500: this will reduce the risk to get an + # unmanageable VM in some setups. + # + # To set the MTU to a different value, configure the INTF_MGMT_MTU variable + # in /etc/nfvbenchvm.conf. If INTF_MGMT_MTU is set to the special value + # "auto", the MTU will not be configured and it will keep the value set by + # the hypervisor ("legacy" nfvbenchvm behavior). If INTF_MGMT_MTU is unset, + # the MTU will be set to 1500. In other cases, the MTU will be set to the + # value of INTF_MGMT_MTU. + # + if [[ -z "$INTF_MGMT_MTU" ]]; then + ip link set $ETH_PORT mtu 1500 + elif [[ "$INTF_MGMT_MTU" != "auto" ]]; then + ip link set $ETH_PORT mtu $INTF_MGMT_MTU + fi + ip addr add $INTF_MGMT_CIDR dev $ETH_PORT ip link set $ETH_PORT up ip route add default via $INTF_MGMT_IP_GW dev $ETH_PORT @@ -244,4 +262,4 @@ else logger "NFVBENCHVM ERROR: Cannot find PCI Address from MAC" fi -exit 0 \ No newline at end of file +exit 0 -- cgit 1.2.3-korg