Changeset 3246 in /cluster/svnroot for bccd-ng/trunk/trees/usr/local/lib/site_perl/5.10.0/Bccd.pm
- Timestamp:
- Jun 21, 2011 8:20:14 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bccd-ng/trunk/trees/usr/local/lib/site_perl/5.10.0/Bccd.pm
r3236 r3246 2198 2198 if(defined($natnic)) { 2199 2199 if($self->is_log($INFO) || $self->is_log($DEBUG)) { 2200 $self->log_and_cont('INFO',$sub,"Writing out $NATSH"); 2201 } 2202 open(my $NAT, '>', $NATSH) or 2203 $self->log_and_die("ERROR",$sub,"Couldn't open $NATSH for writing: $!"); 2204 2205 my $natip = $self->get_nic_ip($natnic); 2206 if(!defined($natip)) { 2207 $self->log_and_die("ERROR",$sub,"Couldn't get IP address for $natnic!"); 2208 } 2209 2210 print $NAT qq{#!/bin/bash\n\n}; 2211 foreach my $LINE ( 2212 q{--flush}, 2213 q{-t nat --flush}, 2214 q{--delete-chain}, 2215 q{-t nat --delete-chain}, 2216 qq{-t nat -A POSTROUTING -s 192.168.3.0/24 -j SNAT --to $natip}, 2217 ) { 2218 print $NAT "/sbin/iptables $LINE\n"; 2219 } 2220 2221 close($NAT); 2200 $self->log_and_cont('INFO',$sub,"Writing out $NATSH"); 2201 } 2202 open(my $NAT, '>', $NATSH) or 2203 $self->log_and_die("ERROR",$sub,"Couldn't open $NATSH for writing: $!"); 2204 2205 my $natip = $self->get_nic_ip($natnic); 2206 if(!defined($natip)) { 2207 $self->log_and_die("ERROR",$sub,"Couldn't get IP address for $natnic!"); 2208 } 2209 2210 print $NAT qq{#!/bin/bash\n\n}; 2211 2212 print $NAT qq{if hostname|grep -q node000; then\n}; 2213 2214 foreach my $LINE ( 2215 q{--flush}, 2216 q{-t nat --flush}, 2217 q{--delete-chain}, 2218 q{-t nat --delete-chain}, 2219 qq{-t nat -A POSTROUTING -o $natnic -j LOG --log-level debug --log-prefix "POSTRT: "}, 2220 qq{-t nat -A POSTROUTING -o $natnic -s 192.168.3.0/24 -j SNAT --to $natip}, 2221 ) { 2222 print $NAT qq{\t/sbin/iptables $LINE\n}; 2223 } 2224 print $NAT qq{fi\n}; 2225 2226 close($NAT); 2222 2227 if($self->is_log($INFO) || $self->is_log($DEBUG)) { 2223 2228 $self->log_and_cont('INFO',$sub,"Making $NATSH executable");
Note: See TracChangeset
for help on using the changeset viewer.