Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm writing a batch script that does the following:

  1. rasdial - connect VPN
  2. net use - map a drive to a remote folder share (on the VPN)
  3. xcopy - copy a bunch of files from the mapped drive to the local machine
  4. net use - unmap drive
  5. rasdial - disconnect VPN

However, it never is able to map the drive. It says:

System error 67 has occurred.

The network name cannot be found.

If I run the same sequence of commands manually from the command line, everything runs fine. Any ideas as to what would cause it to not see the newly created network?

My first though is security, but I've tried all I can think of to no avail.

share|improve this question
    
Are you using a DNS name or IP to map the drive? –  xeon Oct 14 '09 at 23:51
    
Out of curiosity, what happens if you throw in a delay between "rasdial" and the "net use"-- say, "ping -n30 127.0.0.1" to throw in a 29 second pause. I've noticed that the RAS client, at least in Windows XP, plays around with the routing table for a few seconds after the connection comes up. –  Evan Anderson Oct 14 '09 at 23:57
    
@xeon - using DNS –  Greg Dean Oct 15 '09 at 0:08
    
@Evan gave it a shot, same outcome –  Greg Dean Oct 15 '09 at 0:11
    
Darn. It was worth a shot. I'll try and repro it when I get home. (For now, I'm stuck in Crystal Reports hell...) –  Evan Anderson Oct 15 '09 at 0:12

1 Answer 1

up vote 1 down vote accepted

Out of curiosity, what happens if you throw in a delay between "rasdial" and the "net use"-- say, "ping -n30 127.0.0.1" to throw in a 29 second pause. I've noticed that the RAS client, at least in Windows XP, plays around with the routing table for a few seconds after the connection comes up.

I'm not aware of any documentation that describes what the RAS client does to the routing table. When I connect to a RRAS server from a Windows XP client with the "Use default gateway on remote network" option unchecked I see the folling behaviour:

  • A "classful" route to the remote network is added to the routing table
  • Within roughly 3 - 5 seconds that route is removed and a route with the same subnet mask as the RRAS server is added to the routing table in its place

When the "Use default gateway on remote network" option is ticked on, I see the following behaviour:

  • A default gateway route to the remote network is added to the routing table
  • Within roughly 3 - 5 seconds a route with the same subnet mask as the RRAS server is added to the routing table (and the default gateway route remains)

Supposedly if you use the Connection Manager Administation Kit you can create RRAS client entries that execute a script and/or have customized routing table entries. I've never gotten this functionality to work, though.

I'd take a snapshot of the routing table immediately after 'RASDIAL' completes (route print > before.txt) then again after a pause (route print > after.txt), figure out what lines change (fc before.txt after.txt) and add a little loop to the script to print the routing table, look for the line that signifies that the "after" condition has occurred, and if not, pause for a second and loop.

It's grungy and hackish, but it ought to work.

BTW: The behavior is different in Windows 7. You have an option to "disable classful route addition".

The while proxy ARP nature of the RRAS server has always been a little off-putting to me. I prefer VPNs where the clients end up in their own subnet and the VPN server routes traffic to them. Still, I suppose I can understand why Microsoft implemented it the way they did. RRAS clients, in their model, just end up appearing as cleints on the same wire as the LAN, and the proxy ARP "magic" that the RRAS server provides makes the sysadmin blissfully free not to have to think about IP routing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.