Skip to content

Commit

Permalink
Merge pull request #7440 from Obihoernchen/megware/el9_dns
Browse files Browse the repository at this point in the history
EL9: Adding parsing NM resolv.conf for dns entries
  • Loading branch information
Obihoernchen authored Jun 11, 2024
2 parents 167d029 + 0f95df1 commit 1acc570
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xCAT/postscripts/configeth
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ elif [ "$1" = "-s" ];then
str_inst_mask=`grep subnet-mask $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_gateway=`grep routers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_dns=`grep domain-name-servers $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
str_inst_dns_search=`grep domain-search $str_lease_file | tail -n 1 | awk '{print $3}' | sed 's/;$//'`
else
if [ -n "$MACADDRESS" ];then
str_inst_mac=$MACADDRESS
Expand All @@ -594,6 +595,11 @@ elif [ "$1" = "-s" ];then
fi
fi
str_inst_gateway=`ip ro ls|grep default|awk '{print $3}'|head -1`
str_resolv_file=/var/run/NetworkManager/resolv.conf
if [ -f $str_resolv_file ];then
str_inst_dns=`grep ^nameserver $str_resolv_file | sed 's/^nameserver //g'`
str_inst_dns_search=`grep ^search $str_resolv_file | sed 's/^search //g'`
fi
fi
fi
fi
Expand Down Expand Up @@ -755,6 +761,11 @@ elif [ "$1" = "-s" ];then
nmcli con modify $con_name ipv4.dns ${str_inst_dns}
fi
fi
if [ -n "${str_inst_dns_search}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name ipv4.dns-search "${str_inst_dns_search}"
fi
fi
if [ -n "${str_inst_mtu}" ];then
if [ $networkmanager_active -eq 1 ]; then
nmcli con modify $con_name mtu ${str_inst_mtu}
Expand Down

0 comments on commit 1acc570

Please sign in to comment.