2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-21 18:50:28 +00:00

Remove invalid default gateway on RHEL 8.x systems

This commit is contained in:
Wai Yee Wong
2022-08-18 22:51:05 -04:00
parent 9df17c8d00
commit 45cfcdd893

View File

@@ -715,7 +715,7 @@ elif [ "$1" = "-s" ];then
tmp_con_name=${str_inst_nic}"-tmp"
nmcli con modify $con_name connection.id $tmp_con_name
fi
nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix} connection.autoconnect-priority 9
nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix} connection.autoconnect-priority 9 gw4 ${str_inst_gateway}
str_conf_file_1="/etc/sysconfig/network-scripts/ifcfg-xcat-${str_inst_nic}-1"
if [ -f $str_conf_file_1 ]; then
grep $con_name $str_conf_file_1 >/dev/null 2>/dev/null
@@ -732,6 +732,7 @@ elif [ "$1" = "-s" ];then
echo "ONBOOT=yes" >> $str_conf_file
echo "NAME=${con_name}" >> $str_conf_file
echo "HWADDR=${str_inst_mac}" >> $str_conf_file
echo "GATEWAY=${str_inst_gateway}" >> $str_conf_file
fi
if [ $networkmanager_active -eq 2 ]; then
echo "AUTOCONNECT_PRIORITY=9" >> $str_conf_file
@@ -747,14 +748,6 @@ elif [ "$1" = "-s" ];then
else
echo "MTU=${str_inst_mtu}" >> $str_conf_file
fi
fi
if [ -n "$str_inst_gateway" ];then
grep -i "GATEWAY" /etc/sysconfig/network
if [ $? -eq 0 ];then
sed -i "s/.*GATEWAY.*/GATEWAY=${str_inst_gateway}/i" /etc/sysconfig/network
else
echo "GATEWAY=${str_inst_gateway}" >> /etc/sysconfig/network
fi
fi
#add extra params
i=0