1. Yes, there is but it requires some scripting
2&3. I don't know any programs that do exactly what you want. So,
to get your external ip from NATed openbsd box you have to contact some
external web site (e.g: www.showmyip.com, showip.net and etc). my
favourite is checkip.dyndns.org since it retuns only one line (excluding
html header). Here is my implementation on perl: (getmyip.pl)
----------start--------------------------------------------------
#!/usr/bin/perl
use Socket;
$port = "80";
$host = "checkip.dyndns.org";
$iaddr=inet_aton($host);
$paddr=sockaddr_in($port,$iaddr);
socket(SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp'))
or die "Couldn`t create socket : $!\n";
connect(SOCK, $paddr)
or die "Couldn`t connect to $host:$port : $!\n";
send(SOCK, "GET / HTTP/1.1\nHost: checkip.dyndns.org\n\n", 0);
@data = <SOCK>;
$html = @data[8];
if($html =~ m/(\d+.?.\d+.?.\d+.?.\d+)/) {
$myip = $1;
}
print("$myip\n");
close(SOCK);
-----------end--------------------------------------------------
Yes, you can use cron or you can modify the script above
so that it hangs in background and checks your ip after some
interval of time.
_______________________________________________
Openbsd-newbies mailing list
[email protected]
http://mailman.theapt.org/listinfo/openbsd-newbies