diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index 0f140f02..9b722311 100755 --- a/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/diskimage_builder/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -8,14 +8,29 @@ set -o pipefail SCRIPTDIR=$(dirname $0) -# TODO(hjensas): Once ndisc6 package is available in EPEL8 drop this, and add the package back in pkg-map. -# See: https://bugzilla.redhat.com/show_bug.cgi?id=1779134 if [ -e "/etc/redhat-release" ]; then + # TODO(hjensas): Once ndisc6 package is available in EPEL8 drop this, + # and add the package back in pkg-map. + # See: https://bugzilla.redhat.com/show_bug.cgi?id=1779134 if type dnf &>/dev/null; then dnf -v -y install ndisc6 || true else yum -v -y install ndisc6 || true fi + # NOTE(TheJulia): While the internal client which every networkmanager user + # should have is internal, dhclient has better behavior which includes + # shutting down the port between retries which is critical for recovery + # from LACP port blocking situations. As such, we'll force it to dhclient. + # For more information, see https://storyboard.openstack.org/#!/story/2008001 + DIB_DHCP_CLIENT=${DIB_DHCP_CLIENT:-dhclient} +fi + + +# Sets appropriate NetworkManager configuration, if the folder is present. +if [ -x "/etc/NetworkManager" ]; then + install -D -g root -o root -m 0644 ${SCRIPTDIR}/NetworkManager-conf.d-00-main.conf /etc/NetworkManager/conf.d/00-main.conf + sed -i "s/DIB_DHCP_CLIENT/${DIB_DHCP_CLIENT:-internal}/g" /etc/NetworkManager/conf.d/00-main.conf + sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/g" /etc/NetworkManager/conf.d/00-main.conf fi diff --git a/diskimage_builder/elements/dhcp-all-interfaces/install.d/NetworkManager-conf.d-00-main.conf b/diskimage_builder/elements/dhcp-all-interfaces/install.d/NetworkManager-conf.d-00-main.conf new file mode 100644 index 00000000..2074d0af --- /dev/null +++ b/diskimage_builder/elements/dhcp-all-interfaces/install.d/NetworkManager-conf.d-00-main.conf @@ -0,0 +1,24 @@ +# WARNING: This file has been modified by the diskimage-builder +# dhcp-all-interfaces element as this machine is likely running +# a ramdisk or needs to attempt auto-configuration on all interfaces. +[main] +# This makes sense even with dhcp on all interfaces in the event +# that the configuration has been or is being supplied via external means. +ignore-carrier=* +# Use dhclient as was done previously to the Centos8/RHEL8 RPM defaults. +# This is because dhclient shuts the interface down after a retry attempt +# which allows the link state to reset with some switches, which may be +# important for the ramdisk to recover networking. +dhcp=DIB_DHCP_CLIENT + +[connection] +# Keep retrying, this is important for this important espescialy for +# ramdisks in environments where varying switch configurations may +# cause traffic to be blocked or intermittent connectivity failures +# such as those at an edge site may cause issues. +autoconnect-retries=-1 +# Set the timeout. Diskimage-builder dhcp-all-interfaces has a 30 +# second default. NetworkManager, by default, is 45 seconds. +# In some cases where ramdisks are in use, 60 seconds is advisable. +ipv4.dhcp-timeout=DIB_DHCP_TIMEOUT +ipv6.dhcp-timeout=DIB_DHCP_TIMEOUT diff --git a/releasenotes/notes/dhcp-all-interfaces-networkmanager-b34f2fc8fb1a678f.yaml b/releasenotes/notes/dhcp-all-interfaces-networkmanager-b34f2fc8fb1a678f.yaml new file mode 100644 index 00000000..28a3214c --- /dev/null +++ b/releasenotes/notes/dhcp-all-interfaces-networkmanager-b34f2fc8fb1a678f.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + Fixes support for the ``dhcp-all-interfaces`` element when the system + networking configuration is managed via ``NetworkManager``. + - | + Fixes ``NetworkManager`` configuration with the ``dhcp-all-interfaces`` + element to account for Centos8/RHEL8's default change to the + ``NetworkManager`` internal DHCP client, which can introduce different + behavior for infrastucture operators such as those using LACP.