Can I use it to FIX my internet connection?
Donald Pearson
donaldwhpearson at gmail.com
Sat Feb 18 16:18:16 CET 2012
Oh I never meant for the script to retrieve that information. That's
something you look up first and define directly in the script.
It would require re-configuring the script every time you change networks
which is perhaps more common on a laptop. Or whenever the local network's
gateway to the internet changes but that's usually pretty rare.
But I did find this with some googling.
@For /f "tokens=3" %%* in (
'route.exe print ^|findstr "\<0.0.0.0\>"'
) Do @Set "DefaultGateway=%%*"
You can then call %DefaultGateway%.
So the only other piece you would need for this to be more universal is a
way to determine what the remote Tinc server's WAN IP is. You could
possibly write something that would read the hostfile, in which case you
would execute this script with a hostfile input, do something similar to
the snippet above to extract the remote hostname or IP and set that to
maybe RemoteTinc. Or maybe there's a more direct way in tinc-up?
So.. route ADD %RemoteTinc% MASK 255.255.255.255 %DefaultGateway%
On Sat, Feb 18, 2012 at 7:35 AM, Guus Sliepen <guus at tinc-vpn.org> wrote:
> On Mon, May 09, 2011 at 10:25:35AM -0400, Donald Pearson wrote:
>
> > Example: route ADD <IP address of remote Tinc participant> MASK
> > 255.255.255.255 <IP of your normal default gateway>
> [...]
> > Scripting this would simply be adding these commands to a plain text
> > file with the ".bat" extension. Windows will recognize it as
> > executable by default.
>
> Hm, but how would you get the IP of the normal default gateway in a .bat
> script?
>
> --
> Met vriendelijke groet / with kind regards,
> Guus Sliepen <guus at tinc-vpn.org>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk8/mx8ACgkQAxLow12M2ntg3QCdH80OqA/mTq4Qc5JjWhb5CK6K
> 6L8Anj2PqTG+I4zUd+rzNOdVKyjelcVd
> =c60h
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> tinc mailing list
> tinc at tinc-vpn.org
> http://www.tinc-vpn.org/cgi-bin/mailman/listinfo/tinc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.tinc-vpn.org/pipermail/tinc/attachments/20120218/37101153/attachment.html>
More information about the tinc
mailing list