Add NetworkUtils::setup_ipv6_forwarding

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14099 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2012-10-23 11:25:12 +00:00
parent 3a931a7317
commit 8d07e61c14

View File

@ -488,6 +488,35 @@ sub setup_ip_forwarding
return 0;
}
#-----------------------------------------------------------------------------
=head3 setup_ipv6_forwarding
Sets up ipv6 forwarding on localhost
=cut
#-----------------------------------------------------------------------------
sub setup_ipv6_forwarding
{
my ($class, $enable)=@_;
if (xCAT::Utils->isLinux()) {
my $conf_file="/etc/sysctl.conf";
`grep "net.ipv6.conf.all.forwarding" $conf_file`;
if ($? == 0) {
`sed -i "s/^net.ipv6.conf.all.forwarding = .*/net.ipv6.conf.all.forwarding = $enable/" $conf_file`;
} else {
`echo "net.ipv6.conf.all.forwarding = $enable" >> $conf_file`;
}
`sysctl -e -p $conf_file`;
}
else
{
`no -o ip6forwarding=$enable`;
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 prefixtomask