diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 15d0086e3..fd052a060 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -861,10 +861,23 @@ sub initDB $master = "NORESOLUTION"; } # get forwarders which are the nameserver entries in /etc/resolv.conf + # don't use if the address is this machine (Management Node) my $forwarders; - my @names = + # find out the names for the Management Node + my @MNnodeinfo = xCAT::Utils->determinehostname; + my $MNnodename = pop @MNnodeinfo; # hostname + my @MNnodeipaddr = @MNnodeinfo; # ipaddresses + + my @names; + my @tmpnames = xCAT::Utils->runcmd( "/bin/grep ^[^#]*nameserver /etc/resolv.conf | awk '{print \$2}'", -1); + foreach my $ip (@tmpnames) { + if (!grep(/$ip/, @MNnodeipaddr)) + { # if not the MN + push @names,$ip; # add it as a forwarder + } + } if (@names) { $forwarders = join(',', @names);