Oh I never meant for the script to retrieve that information. That's something you look up first and define directly in the script.<div><br></div><div>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.<br>
<br>But I did find this with some googling.</div><div><br></div><div><div>@For /f "tokens=3" %%* in (</div><div>'route.exe print ^|findstr "\<0.0.0.0\>"'</div><div>) Do @Set "DefaultGateway=%%*"</div>
<div><br></div><div>You can then call %DefaultGateway%.</div><div><br></div><div>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?</div>
<div><br></div><div><div>So.. route ADD %RemoteTinc% MASK 255.255.255.255 %DefaultGateway%</div></div><div><br></div><div class="gmail_quote">On Sat, Feb 18, 2012 at 7:35 AM, Guus Sliepen <span dir="ltr"><<a href="mailto:guus@tinc-vpn.org">guus@tinc-vpn.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, May 09, 2011 at 10:25:35AM -0400, Donald Pearson wrote:<br>
<br>
> Example: route ADD <IP address of remote Tinc participant> MASK<br>
> 255.255.255.255 <IP of your normal default gateway><br>
</div>[...]<br>
<div class="im">> Scripting this would simply be adding these commands to a plain text<br>
> file with the ".bat" extension. Windows will recognize it as<br>
> executable by default.<br>
<br>
</div>Hm, but how would you get the IP of the normal default gateway in a .bat<br>
script?<br>
<div><div></div><div class="h5"><br>
--<br>
Met vriendelijke groet / with kind regards,<br>
Guus Sliepen <<a href="mailto:guus@tinc-vpn.org">guus@tinc-vpn.org</a>><br>
</div></div><br>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iEYEARECAAYFAk8/mx8ACgkQAxLow12M2ntg3QCdH80OqA/mTq4Qc5JjWhb5CK6K<br>
6L8Anj2PqTG+I4zUd+rzNOdVKyjelcVd<br>
=c60h<br>
-----END PGP SIGNATURE-----<br>
<br>_______________________________________________<br>
tinc mailing list<br>
<a href="mailto:tinc@tinc-vpn.org">tinc@tinc-vpn.org</a><br>
<a href="http://www.tinc-vpn.org/cgi-bin/mailman/listinfo/tinc" target="_blank">http://www.tinc-vpn.org/cgi-bin/mailman/listinfo/tinc</a><br>
<br></blockquote></div><br></div>