/[pxelator]/lib/PXElator/ssh.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/PXElator/ssh.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 312 - (show annotations)
Thu Aug 27 18:57:46 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 625 byte(s)
we need to open ethernet tunnel as root, so check it

1 package ssh;
2
3 use Net::OpenSSH;
4 use English;
5
6 my $id = 2;
7
8 sub ethernet_bridge_to {
9 my $host = shift;
10
11 die "you need to run this as root\n" unless $UID == 0;
12
13 warn "# reset local IP address";
14 system "ifconfig virtual 172.16.10.$id";
15
16 warn "# connect to $host";
17 my $ssh = Net::OpenSSH->new( $host,
18 master_opts => [ -w => "$id:$id", -o => 'Tunnel=ethernet' ],
19 );
20
21 foreach my $command ( "ifconfig tap$id up", "brctl addif virtual tap$id" ) {
22 warn "# $command";
23 system $command;
24 $ssh->system( $command ) or die "$command ", $ssh->error;
25 }
26
27 warn "press enter to close tunnel to $host from $id";
28 <STDIN>;
29
30 }
31
32 1;

  ViewVC Help
Powered by ViewVC 1.1.26