|
Folks,
I want to semi-automate an "Add Route" on one WinXP client.
Let me walk you through it, step by step..?
1) Launch VPN to remote site. VPN interface will be assigned address 10.0.0.123, for example. Assume "Use Default Gateway on Remote Network" is NOT selected.
2) Internal network at remote site is 192.168.21.x/24.
3) I manually add a route, using "Route Add 192.168.21.0 mask 255.255.255.0 10.0.0.123" and I'm happy.
Keeping in mind that 10.0.0.123 is dynamically assigned and often changes, I'm looking to automate step #3.
I can "ipconfig > ipconf.txt", then "grep 10.0.0 ipconf.txt" which returns one line, such as:
IP Address. . . . . . 10.0.0.123
*IF* I could ltrim (or rtrim?) that to output *JUST* 10.0.0.123 in a text file, how can I script the "Route Add 192.168.21.0 mask 255.255.255.0 **INSERT VALUE HERE**" from the file..?
I know what I want to do, but I suck at bashing the code. No attention span.
If there's a more elegant solution than dumping to text, greping that to another text, trimming that text and piping it INTO a script, I'd love to see how it could be done.
So, worst case, if someone could help me:
1) trim the "ipconf.txt" file and 2) Show me an example of how to use contents of a text file as input into a script
.. I'll be working, despite how ugly it'll be..
Thanks, VM, everyone!
-- Scott.
|