|
|
Hi,
You can use the ping command to create a 5 second delay in a Windows batch
file as it sends one ping per second.
ping -n 6 127.0.0.1 >nul
or, if you wanted to make your own command, sleep.cmd -
@echo off
set /a tm=%1+1
ping -n %tm% 127.0.0.1 >nul
You could do something more complex and sleep until the connection is
established. That would shorten the delay (or automatically extended it if
for some reason 5 seconds wasn't enough).
Here is a simple script I have thrown together to do just that. It uses
netstat to determine if a connection to the remote IP/port has been
established. E.g.
waitconnect 123.45.6.7:80 20
This would wait up to 20 seconds for a connection to port 80 on 123.45.6.7
to be established.
waitconnect.cmd -
@echo off
REM Usage waitconnect remote_ip timeout
set con_found=0
set /a timeout=%2
:testloop
for /f "tokens=3,4" %%a in ('netstat -an') do if "%%a"=="%1" (if
"%%b"=="ESTABLISED" set con_found=1)
if "%con_found%"=="1" goto end
if "%timeout%"=="0" goto end
ping -n 2 127.0.0.1 >nul
set /a timeout=%timeout%-1
goto testloop
:end
echo %con_found%
Hope some of this is helpful.
- R. Latimer
-----Original Message-----
From: openvpn-users-admin@xxxxxxxxxxxxxxxxxxxxx
[mailto:openvpn-users-admin@xxxxxxxxxxxxxxxxxxxxx]On Behalf Of Dave Lau
Sent: Saturday, 23 August 2003 2:20 a.m.
To: openvpn-users@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [Openvpn-users] 1.5-beta6 testing report
Hi, Tom,
I have done something similar to what you are describing by using a "sleep"
command to force the up script to wait a few seconds before executing. This
seems to give openVPN time to establish the tunnel before the up script
runs, and allows the routes to be created correctly. Maybe there is a good
way to cause a batch file to pause for a few seconds using native WinXP
shell commands, but I couldn't figure it out, so I downloaded a little
program called "sleep.com" from the following link:
http://www.computerhope.com/dutil.htm
then, I made my batch file look like this:
---------------------------------------------------------------
sleep 5
route add 172.16.0.0 mask 255.255.255.0 10.0.50.1
---------------------------------------------------------------
After a mildly annoying 5-second pause, The static route was created
properly. I eventually got away from this and decided to use a bridged
connection instead of a routed one, but if you need to use routing for
whatever reason, give this a try. It's not the prettiest solution, but it
seemed to produce the desired results, at least for me.
thanks,
Dave
----- Original Message -----
From: "Tom Bin" <s1curity@xxxxxxxxxxxx>
To: <openvpn-users@xxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, August 22, 2003 2:58 AM
Subject: [Openvpn-users] 1.5-beta6 testing report
> Hi,
>
>
> I've testing the openvpn 1.5-beta6 in the following combinations:
>
> FreeBSD <-> FreeBSD
> XP <-> FreeBSD
> XP <-> XP
>
> All are working just fine.
>
> I particularly prefer to use TCP mode because it is the only way to thru
> firewall.
> However I have a suggestion about the win32 version.
>
> From a windows box connect to a openvpn server by TCP port,
> the "up" script will execute "before" the TCP connection establishes.
> But I need to use the "up" script on Windows to assign the IP address
> and routing table after the TCP connection is established.
>
> It is not allowed to set additional routing table entries on the tap
> interface
> when it is down (disconnected) in Windows.
>
> Is it possible to run the "up" script after the TCP established when in
TCP
> mode?
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: VM Ware
> With VMware you can run multiple operating systems on a single machine.
> WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
> at the same time. Free trial click
here:http://www.vmware.com/wl/offer/358/0
> _______________________________________________
> Openvpn-users mailing list
> Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/openvpn-users
____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users
____________________________________________
Openvpn-users mailing list
Openvpn-users@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openvpn-users
|