diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index d0ff144e9..bb6d3c4ef 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -624,7 +624,7 @@ ppchcp => { }, }, servicenode => { - cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver comments disable)], + cols => [qw(node nameserver dhcpserver tftpserver nfsserver conserver monserver ldapserver ntpserver ftpserver nimserver ipforward comments disable)], keys => [qw(node)], table_desc => 'List of all Service Nodes and services that will be set up on the Service Node.', descriptions => { @@ -639,6 +639,7 @@ servicenode => { ntpserver => 'Not used presently. Do we set up a ntp server on this service node? Valid values:yes or 1, no or 0.', ftpserver => 'Do we set up a ftp server on this service node? Valid values:yes or 1, no or 0.', nimserver => 'Do we set up a NIM server on this service node? Valid values:yes or 1, no or 0.', + ipforward => 'Do we set up ip forwarding on this service node? Valid values:yes or 1, no or 0.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", @@ -1015,6 +1016,7 @@ my @nodeattrs = ( tabentry => 'noderes.nimserver', access_tabentry => 'noderes.node=attr:node', }, + ### # TODO: Is noderes.nfsdir used anywhere? Could not find any code references # to this attribute. @@ -1083,6 +1085,10 @@ my @nodeattrs = ( {attr_name => 'setupconserver', tabentry => 'servicenode.conserver', access_tabentry => 'servicenode.node=attr:node', + }, + {attr_name => 'setupipforward', + tabentry => 'servicenode.ipforward', + access_tabentry => 'servicenode.node=attr:node', }, # - moserver not used yet # {attr_name => 'setupmonserver', diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 9338c8114..c89d00b06 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2965,7 +2965,7 @@ sub isServiceReq my @services = ( "nameserver", "dhcpserver", "tftpserver", "nfsserver", "conserver", "monserver", "ldapserver", "ntpserver", - "ftpserver" + "ftpserver", "ipforward" ); my @ips = @$serviceip; # list of service node ip addresses and names diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 67cbeb66c..9b4c4f2b2 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -252,6 +252,16 @@ sub init_plugin "AAsn.pm:Error reading the servicenode table."); } + my $service = "ipforward"; + if (grep(/$service/, @servicelist)) + { + + $rc = &setup_ip_forwarding($nodename, $doreq); # setup ip forwarding + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } + } } else # management node { @@ -1234,4 +1244,33 @@ sub setup_HTTP return $rc; } +#----------------------------------------------------------------------------- + +=head3 setup_ip_forwarding + + Sets up ip forwarding on the sn + +=cut + +#----------------------------------------------------------------------------- +sub setup_ip_forwarding +{ + if (xCAT::Utils->isLinux()) { + my $conf_file="/etc/sysctl.conf"; + my $rc=`grep "net.ipv4.ip_forward" $conf_file`; + if ($? == 0) { + `sed -i "s/^net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/" $conf_file`; + } else { + `echo "net.ipv4.ip_forward = 1" >> $conf_file`; + } + $rc = `sysctl -p $conf_file`; + } + else + { #AIX: TODO + } + + return $rc; +} + + 1;