xcat2 / xcat-core

Code repo for xCAT core packages
Eclipse Public License 1.0
356 stars 170 forks source link

DNS entries not getting updated using confignetwork script #7407

Open abhishek-sa1 opened 10 months ago

abhishek-sa1 commented 10 months ago

I am using confignetworkscript to convert DHCP IP to static after provisioning of the server. I have observed that confignetworkscript is not configuring DNS entries provided in the nameservers field of site table.

       str_lease_file=`ls /var/lib/dhclient/*$str_inst_nic* | grep lease`
        if [ -e "$str_lease_file" ];then
            str_inst_ip=`grep fixed-address $str_lease_file | tail -n 1 | awk '{print $2}' | sed 's/;$//'`
            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/;$//'`

      if [ -n "${str_inst_dns}" ];then
            if [ $networkmanager_active -eq 1 ]; then
                nmcli con modify $con_name ipv4.dns ${str_inst_dns}
                fi
        fi

I saw above code in configethscript(called internally from confignetwork) related to DNS. I don't find any files in /var/lib/dhclient/folder.

Why xCAT is not picking DNS entries from nameservers field? I can see NAMESERVERSenvironment variable present on each server.

@samveen @gurevichmark

abhishek-sa1 commented 10 months ago

@samveen can you help me on this?

samveen commented 10 months ago

@abhishek-sa1 when you refer to nameservers, are you referring to network.nameservers of network objects? This field is used to configure the DHCP server (as with each network object). This is utilized by the confignetwork script where it examines the lease file for the domain-name-servers field, which is would have received via DHCP response when it got it's IP address.

I can see the script tries to attach that IP into the current network connection's DNS server using the nmcli con modify command.

For this node, can you check the location of the interface's lease file? Once that is traced, we can proceed from there.

Also check linkedin for a connect request from me.