Thursday September 09, 2004
All
|
General
|
I am using a wireless router for my home internet connection, that says, all my home computers will be behind a firewall. To connect my home computers from office, Ineed to:
Firstly, create a perl script in a http server to determine the remote ip address: #!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
$query_string = $ENV{'REMOTE_ADDR'};
print "$query_string";
Then, use another perl script poking that server to get the real internet address: #!/usr/bin/perl
use IO::Socket;
$server = 'site';
$port = 80;
$script = '/path/to/cgi/myip.cgi';
$socket = IO::Socket::INET->new(
Proto => 'tcp',
PeerAddr => $server,
PeerPort => $port,
Timeout => 10,
);
unless($socket) {
die("Could not connect to $server:$port");
}
$socket->autoflush(1);
print $socket ("GET $script HTTP/1.0\nHost: $server\nUser-Agent: YY\n\n");
$ip = "";
$off = 1;
while ($line = <$socket>) {
$off = 0 if ($line =~ /^\s*$/)?
unless ($off) {
$ip = $line if (length($line) > 0)?
}
}
[snip]Finally, I use blat to send the ip to my office's mailbox: blat ip.addr -to xxx -cc xxx -s "ip" -u xxx -pw xxx Now I'm able to do FTP, VNC, etc. from office to my home! September 09, 2004 11:39 AM PDT PermalinkComments:
Post a Comment: Comments are closed for this entry. |
Calendar
Links
NavigationReferersToday's Page Hits: 15 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
