From a884b6f20fe12dbb2cd3780649a22c9af4952d81 Mon Sep 17 00:00:00 2001 From: J vanBemmel Date: Wed, 11 Dec 2024 23:22:01 -0600 Subject: [PATCH] bonding - set intf down before up --- netsim/extra/bonding/linux.j2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/netsim/extra/bonding/linux.j2 b/netsim/extra/bonding/linux.j2 index f8a6884d8..9eb167bb0 100644 --- a/netsim/extra/bonding/linux.j2 +++ b/netsim/extra/bonding/linux.j2 @@ -3,12 +3,13 @@ set -e -{% for intf in interfaces|default([]) if intf.type=='bond' %} -{% set mode = intf.bonding.mode|default('active-backup') %} -{{ create_bond_dev(intf|combine( {'type':'lag','lag': { 'mode': mode, 'lacp': 'off' } }) ) }} +{% for intf in interfaces|default([]) if intf.bonding.mode is defined %} +{{ create_bond_dev(intf,{ 'mode': intf.bonding.mode, 'lacp': 'off' } ) }} ip link set dev {{ intf.ifname }} down -{% for member in intf.members %} +{% for member in intf.bonding.members %} +ip link set dev {{ member }} down ip link set dev {{ member }} master {{ intf.ifname }} +ip link set dev {{ member }} up {% endfor %} ip link set dev {{ intf.ifname }} up {% endfor %}