0

I am using a simple powershell command,(ran as Admin) as follows.

route –p add 172.30.200.0 mask 255.255.255.0 0.0.0.0 IF 28

I have done this no problem on Windows 8.1, but when I do this in Windows Server 2012 R2, I get the following error.

The route addition failed: The system cannot find the file specified.

I am a sysadmin JR, So I apologize if this is mundane, But I have no idea where to start. The few google searched I did pointed me to: This Technet Article

The route command converts destination names to addresses using the networks database file located in the (\system32\drivers\etc\networks) directory. If you add a route to the routing table, the network address of the destination name must be added to the networks database file for address resolution. For the route utility to work correctly, the gateway/network numbers must be specified in the NETWORKS file.

Am I in the right ballpark?

Thank you everyone.

S4br3L0FF
  • 1
  • 4
  • Are you running PowerShell as an administrator when you execute the command? – Todd Wilcox Jul 14 '15 at 19:37
  • Yes I am, that was a good question though I'll edit that in. – S4br3L0FF Jul 14 '15 at 19:41
  • Do a route print, and be sure **28** exist. Take the number you need from the list at the end of the route print – yagmoth555 Jul 14 '15 at 20:32
  • route print will give a output like: C:\Users\admin>route print =========================================================================== Interface List 3...xx xx xx xx xx xx ......Intel(R) 82567LM-3 Gigabit Network Connection 1...........................Software Loopback Interface 1 4...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 5...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface ===========================================================================. Match the IF interface number – yagmoth555 Jul 14 '15 at 20:33
  • Yes, thank you. The IF does exist. It is indeed IF 28. Still no dice. – S4br3L0FF Jul 14 '15 at 22:12
  • Well, this command worked: route add 172.30.200.0 mask 255.255.255.0 0.0.0.0 IF 28 -p I'm really confused as to why the syntax would be different... but there it is. Okay guys, thanks. The -p has to be at the end of Windows Server 2012 R2? – S4br3L0FF Jul 14 '15 at 22:26
  • That's really weird. What happens if you use `/p` instead of `-p`? I'm asking after looking at the documentation here: https://technet.microsoft.com/en-us/library/ff961510.aspx Also, since you're using powershell, why not use the cmdlet `New-NetRoute` to do the job instead of the crunchy old `route` command? https://technet.microsoft.com/en-us/library/hh826148(v=wps.630).aspx – austinian Jul 15 '15 at 03:45

1 Answers1

0

Well, this command worked: route add 172.30.200.0 mask 255.255.255.0 0.0.0.0 IF 28 -p

The -p was throwing it off, it has to be at the end of the command for whatever reason.

S4br3L0FF
  • 1
  • 4