diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index b1c19c6da..7f48eb42d 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -486,13 +486,25 @@ IPADDR_$ipindex=$nicip" >> $dir/ifcfg-$nic if [ $ipindex -eq 1 ] then if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then - # ipv6 - if echo $nicip | grep : 2>&1 1>/dev/null - then - nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip - else # ipv4 - prefix=$(convert_netmask_to_cidr $netmask) - nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + if nmcli --field connection.id con show $nic 2>&1 1>/dev/null + then # modify current connection + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip + else # ipv4 + prefix=$(convert_netmask_to_cidr $netmask) + nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + fi + else # create new connection + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip + else # ipv4 + prefix=$(convert_netmask_to_cidr $netmask) + nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + fi fi else nmcontrol="" @@ -540,7 +552,7 @@ IPADDR=$nicip" > $dir/ifcfg-$nic value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then - nmcli con modify $con_name $name $value + nmcli con modify $nic $name $value else grep -i "${name}" $dir/ifcfg-$nic if [ $? -eq 0 ];then @@ -553,13 +565,25 @@ IPADDR=$nicip" > $dir/ifcfg-$nic done else # not the first ip address if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then - # ipv6 - if echo $nicip | grep : 2>&1 1>/dev/null - then - nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip - else # ipv4 - prefix=$(convert_netmask_to_cidr $netmask) - nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + if nmcli --field connection.id con show $nic 2>&1 1>/dev/null + then # modify current connection + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip + else # ipv4 + prefix=$(convert_netmask_to_cidr $netmask) + nmcli con modify $nic type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + fi + else # create new connection + # ipv6 + if echo $nicip | grep : 2>&1 1>/dev/null + then + nmcli con add type infiniband con-name $nic ifname $nic ipv6.method manual ipv6.addresses $nicip + else # ipv4 + prefix=$(convert_netmask_to_cidr $netmask) + nmcli con add type infiniband con-name $nic ifname $nic ipv4.method manual ipv4.addresses $nicip/$prefix + fi fi else # ipv6 @@ -620,7 +644,7 @@ IPADDR$ipindex=$nicip" value="${array_extra_param_values[$i]}" echo " $i: name=$name value=$value" if [[ "$OSVER" =~ ^(rhels9|alma9|rocky9) ]]; then - nmcli con modify $con_name $name $value + nmcli con modify $nic $name $value else grep -i "${name}" $cfgfile if [ $? -eq 0 ]; then