diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 45dac8450..c12f44e79 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -368,7 +368,8 @@ sub windows_net_cfg { my $gateway; my $interface_cfg = ''; my ($nicname, $ips) = split(/!/, $_); - unless ($nicname) {next;} + unless ($nicname) { next; } + if ($nicname =~ /^bmc/) { next; } # do nothing for bmc interface if ($ips) { $interface_cfg .= 'falsefalse'; $interface_cfg .= "$nicname"; @@ -384,6 +385,10 @@ sub windows_net_cfg { if ($gw) { $gateway = $gw; } $interface_cfg .= ''.$ip."/$netmask".''; } + if ($num eq 1) { + # no correct IP with correct network is found + next; + } $interface_cfg .= "" } else { @@ -393,7 +398,9 @@ sub windows_net_cfg { } # add the default gateway - $interface_cfg .= '1'.$gateway.'0/0'; + if ($gateway) { + $interface_cfg .= '1'.$gateway.'0/0'; + } $interface_cfg .= ''; $interfaces_cfg .= $interface_cfg; @@ -1047,8 +1054,6 @@ sub enablesshbetweennodes return $result; } -# Get the netmask and gateway for a specific ip -# netmask is the number of bits sub getNM_GW() { my $ip = shift;