/[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 283 - (show annotations)
Mon Aug 24 18:07:19 2009 UTC (14 years, 8 months ago) by dpavlin
File size: 555 byte(s)
http://blog.rot13.org/2009/08/tap_magic_kvm_bridge_ssh_ethernet_tunnel.html

turned into simple package for pxelator... nice and simple
(runs same commands on both hosts :-)

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

  ViewVC Help
Powered by ViewVC 1.1.26