Route add windows the route addition failed

Route Add Windows — a Guide to Windows Routing

Apr 25 th , 2016 | Comments

Sometimes you need to manually add, change, or remove a route on a Windows machine. Here is quick guide to help you accomplish these tasks.

First start by opening a CMD prompt by going to start then typing cmd .

These commands should work for Win XP, Win Vista, Win 98, Win NT, Win 2000, Win 2008, Win 2012, Win 7, Win 8, Win 10.

Show the Current Routing Table

The default route is represented by A destination/netmask of 0.0.0.0 . If there isn’t a route with a more specific destination and netmask, the default route is used.

Use this subnet calculator if you need help subnetting.

Add a Static Route

To add a route to the routing table use the route add command. An example looks like this:

You can optionally add a metric 2 to the end if you want to add a specific weight to the route. The routes with the lowest metric will take precedence over higher metrics. By default, static routes have a metric of 6.

You can also optionally add a IF 2 to the end. This will force the route to use interface 2. You can see what interface numbers you have with the route print command.

Remove a Static Route

To remove a route you must use the route delete command and the destination.

Change a Static Route

If you simply want to update a static route you can use the route change command.

Troubleshooting

If you get the following error: The requested operation requires elevation.

To resolve this you will need administrator access to the system. Go to the start menu and when you type cmd right click on the cmd.exe program and click Run As Administrator . This opens a CMD prompt with more privileges.

For any further help you can use the built in help the route command provides. Simply type route and hit enter.

Check out this article for more cool Windows CLI commands.

Posted by Jack Apr 25 th , 2016 misc, routing, windows

Why does this ROUTE ADD command fail?

I am trying to block access to a single IP address by adding a specific route that leads «nowhere» (instead of the default gateway):

The problem is that this command fails with the following error:

The route addition failed: The parameter is incorrect.

It doesn’t say which parameter is incorrect. I probably violated an implied rule of networking basics but I don’t know what it is. Any idea which parameter is incorrect and, more importantly, why?

3 Answers 3

You cannot have the loopback device (127.0.0.1) be the gateway. It doesn’t make sense.

What you are saying with this command is «route all traffic that goes to this address(es) through this gateway». Because loopback does not route to any network, it does not work.

Find out which gateway you want this traffic to go through and use that instead. In a comment you mentioned using your own IP address. That might work because your IP would just fail routing the traffic. I have not tested this so ymmv:

Might be worth for you to check out Wikipedia’s article on loopback for more information. Also, check out this superuser question for information on the gateway’s role in routing.

You’re trying to add your own device as the gateway, for every port on your computer I can come up with a reason to do this. The issues, is that windows will not let you set 127.0.0.1 as the gateway. This might be due to the fact that it is not defined by windows ipconfig. So, instead of using 127.0.0.1 as the gateway, Windows has re-defined it as «On-Link» :

To set an On-Link gateway you have to specify it as 0.0.0.0 . My guess is that Microsoft knew that this gateway is impossible, so they internally defined it as the local address gateway.

Читайте также:  Windows environment in visual programming

To set this simply use:

Make sure you specify your own metric and interface as Windows might not pick the one you intended on using.

With the subnet mask set to 255.255.255.255 you are masking every single bit of the address, that sounds like an issue to me

OpenVPN Support Forum

Community Support Forum

Windows route add command failed

Windows route add command failed

Post by SparkySam » Wed Oct 28, 2015 5:55 pm

I can’t seem to connect to my VPN and i can’t seem to understand why, anyone any ideas, error code is below

Wed Oct 28 17:48:15 2015 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=3]
Wed Oct 28 17:48:15 2015 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Wed Oct 28 17:48:15 2015 ERROR: Windows route add command failed [adaptive]: returned error code 1
Wed Oct 28 17:48:15 2015 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=4]
Wed Oct 28 17:48:15 2015 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Wed Oct 28 17:48:15 2015 ERROR: Windows route add command failed [adaptive]: returned error code 1
Wed Oct 28 17:48:15 2015 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=4]
Wed Oct 28 17:48:15 2015 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Wed Oct 28 17:48:15 2015 ERROR: Windows route add command failed [adaptive]: returned error code 1
Wed Oct 28 17:48:15 2015 Warning: address 192.168.1.1 is not a network address in relation to netmask 255.255.255.0
Wed Oct 28 17:48:15 2015 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=4]
Wed Oct 28 17:48:15 2015 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Wed Oct 28 17:48:15 2015 ERROR: Windows route add command failed [adaptive]: returned error code 1
Wed Oct 28 17:48:15 2015 ROUTE: route addition failed using CreateIpForwardEntry: Access is denied. [status=5 if_index=4]
Wed Oct 28 17:48:15 2015 env_block: add PATH=C:\Windows\System32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Wed Oct 28 17:48:15 2015 ERROR: Windows route add command failed [adaptive]: returned error code 1
Wed Oct 28 17:48:15 2015 Initialization Sequence Completed

Route add windows the route addition failed

Вопрос

Ответы

Мне конкретно надо прокинуть данные идущие на адреса 10.2.0.0/16 через интерфейс VPN (68),

надо выполнить следующую команду:

где IP.REMOTE.GATEWAY — адрес шлюза по умолчанию в удалённой сети. Вы не можете просто так указать номер интерфейса, Вам нужно указать адрес шлюза для удалённой сети.

Теоретически, Вы можете указать только номер интерфейса, но тогда этот интерфейс должен работать в режиме моста, но я такого его не встречал.

P.S.: На чём у Вас реализован VPN сервер? на многих VPN серверах можно настраивать маршруты, которые принудительно записываются клиенту при подключении VPN. Если у Вас VPN на Windows Server Вы можете использовать DHCP и опцию 121 для раздачи маршрутов.

Все ответы

Так не пробовали:

route ADD 10.2.0.0 MASK 255.255.0.0 10.2.0.1 METRIC 100 IF 68

Я не волшебник, я только учусь MCP CCNA. Если Вам помог чей-либо ответ, пожалуйста, не забывайте жать на кнопку «Пометить как ответ» или проголосовать «полезное сообщение». Мнения, высказанные здесь, являются отражением моих личных взглядов, а не позиции работодателя. Вся информация предоставляется как есть без каких-либо гарантий. Блог IT Инженера, Twitter, YouTube, GitHub.

Мне конкретно надо прокинуть данные идущие на адреса 10.2.0.0/16 через интерфейс VPN (68),

надо выполнить следующую команду:

где IP.REMOTE.GATEWAY — адрес шлюза по умолчанию в удалённой сети. Вы не можете просто так указать номер интерфейса, Вам нужно указать адрес шлюза для удалённой сети.

Теоретически, Вы можете указать только номер интерфейса, но тогда этот интерфейс должен работать в режиме моста, но я такого его не встречал.

P.S.: На чём у Вас реализован VPN сервер? на многих VPN серверах можно настраивать маршруты, которые принудительно записываются клиенту при подключении VPN. Если у Вас VPN на Windows Server Вы можете использовать DHCP и опцию 121 для раздачи маршрутов.

Мне конкретно надо прокинуть данные идущие на адреса 10.2.0.0/16 через интерфейс VPN (68),

надо выполнить следующую команду:

где IP.REMOTE.GATEWAY — адрес шлюза по умолчанию в удалённой сети. Вы не можете просто так указать номер интерфейса, Вам нужно указать адрес шлюза для удалённой сети.

Теоретически, Вы можете указать только номер интерфейса, но тогда этот интерфейс должен работать в режиме моста, но я такого его не встречал.

P.S.: На чём у Вас реализован VPN сервер? на многих VPN серверах можно настраивать маршруты, которые принудительно записываются клиенту при подключении VPN. Если у Вас VPN на Windows Server Вы можете использовать DHCP и опцию 121 для раздачи маршрутов.

Вы пробовали выполнить рекомендации данные коллегой вам, Цитата онных в посте?

Я не волшебник, я только учусь MCP CCNA. Если Вам помог чей-либо ответ, пожалуйста, не забывайте жать на кнопку «Пометить как ответ» или проголосовать «полезное сообщение». Мнения, высказанные здесь, являются отражением моих личных взглядов, а не позиции работодателя. Вся информация предоставляется как есть без каких-либо гарантий. Блог IT Инженера, Twitter, YouTube, GitHub.

OpenVPN Support Forum

Community Support Forum

What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by woodrock » Sun Jun 04, 2017 10:44 pm

What causes this error on Windows 10 (and not on Windows XP)?
What is this error trying to tell me?
What is the fix?

Читайте также:  Драйвера для usb windows embedded

It’s important to note that I have been using freely available public VPN server openvpn configuration files off the net on Windows XP with no problems.

It’s only when moving to Windows 10 this week, using the latest OpenVPN builds, that these problems shown below arise.

It’s extremely important to note that the Windows 10 setup for my use model is fully and completely described over here:
— Tutorial to set up Windows 10 OpenVPN client to work on HUNDREDS of sometimes unreliable freely available openvpn config files

Summarized, the use model in action is trivially simple:
1. I download openvpn files off the net from vpngate and I doubleclick on them.
2. That’s it. That’s the entire use model. It’s that simple.
3. When I want to disconnect from VPN, I hit the [x] windows close box on the openvpn daemon running log file.

The problem I’m asking about is that the OpenVPN Daemon works just fine on these config files in Windows XP, but when the SAME config files are run the same way on Windows 10, I get the errors below (see Windows-specific UAC permission setup in the aforementioned tutorial)

Q: What are these errors telling me, and what can I do on Windows 10 to eliminate these errors?

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by TinCanTech » Mon Jun 05, 2017 1:12 am

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by woodrock » Mon Jun 05, 2017 4:01 am

Hmmmmm. thank you for that advice pointing me in the direction of test to figure out where the OpenVPN bug lies.
Bearing in mind this OpenVPN bug doesn’t occur in Windows XP, I just tried doubleclicking on a SINGLE config file.’

As you suggested might happen, I don’t see an error.

Then I closed down that VPN session by hitting the Windows [X] and waited a couple of minutes.
Then I doubleclicked on the very same config file, and now I do see the error 3 times.

I only have two questions:
1. Is this just a warning or an error (in that I’m always worried about my VPN privacy)?
2. Why does this bug only occur on Windows 10 and not on Windows XP?

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by TinCanTech » Mon Jun 05, 2017 12:01 pm

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by woodrock » Tue Jun 06, 2017 3:27 am

Thank you for pointing this out.
As noted in this tutorial, I haven’t noticed this «route addition failed» error on WinXP SP3.

I just went back to the WinXP machine and confirmed by the following sequence, which I will write up separately because this question in this thread is about Windows 10 «route addition failed» errors, which do not occur on Windows XP using the exact same files & procedures.

Here’s the WinXP test sequence, which never once eliciited these new Win10-only «route addition failed» errors:
1a) I doubleclicked on VPN config file 1 on WinXP (no route addition failed errors).
1b) I killed VPN 1 using the [X] box. (I will post the log file separately, in a different thread, as proof.)

2a) Moments later, doubleclicked on VPN config file 2 on WinXP (there were still no route addition failed errors).
2b) I killed VPN 2 using the [X] box. (I will post the log file separately, in a different thread, as proof.)

3a) Moments later I repeated step #1a above
3b) I killed VPN 1 using the [F4] key. (I will post the log file separately, in a different thread, as proof.)

4a) Moment later I repeated step #3 above.
4b) I killed VPN 2 using the [F4] key. (I will post the log file separately, in a different thread, as proof.)

5a) Moments later I repeated step #1a above
5b) I killed VPN 1 using the [F4] key. (I will post the log file separately, in a different thread, as proof.)

The reason I’m not posting the WinXP proof of the above here is that it’s a lot of work to redact private information, and, even more importantly, this thread is only about Windows 10 so I don’t want to detract from the main issue (we can take up why WinXP doesn’t fail with the «route addition failed» errors separately).

Thank you for pointing out the F4 (in the header even!), which, even though my use model has worked for years, I hadn’t known about.
I will use F4 from now on in Windows 10 (and I will adjust the Windows 10 batch-vpn tutorial accordingly).

I see the F4 is documented (but only very briefly) over here.

I will stop using the [X] box to close the OpenVPN Daemon processes and I will start using the keyboard [F4] key moving forward.
Thank you for pointing out my faux pas.

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by woodrock » Wed Jun 07, 2017 4:54 pm

Читайте также:  Резервная копия линукс tar

It’s been hard to break the habit of using the [X] to close the OpenVPN Daemon log window (what do you call that window anyway?).

But I’m getting used to hitting the [F4] key, which, unfortunately still requires the mouse because you have to focus your cursor on the OpenVPN Daemon log windows before it will close.

The good news is that, in another thread, TinCanTech kindly confirmed that the [X] works just fine in Windows XP; so the problem I saw only crops up in Windows 10 (or perhaps earlier as I skipped the intermediate Windows releases).

The commands that TinCanTech kindly spoke about above that follow the [F4] occur in a tenth of a second, so, on Windows 10, I had to set my screen capture program (Irfanview freeware) to automatically snap screenshots every tenth of a second.

Here are those commands (at verbosity=3):


Unfortunately, when I tried the same tenth-of-a-second-capture with the [X] on Windows 10, the window just died in that tenth of a second with no commands issued that I could see. Irfanview wouldn’t go to a hundredth of a second screen capture, so I dropped it at that point (unless folks have questions).

In SUMMARY:
Thank you for your help in IMPROVING this very basic «privacy» KISS (keep it super simple) use model for OpenVPN where the users’ IP address is what we’re trying to protect from business and government meta-data aggregators.

This KISS PRIVACY (not security, per se!) use model can be summarized as below (PLEASE IMPROVE!)

1. Create directories for each task you wish to perform
(For example, gmail could be one task, Usenet could be another task, web browsing another task, online purchases another task, etc.)

2. Populate each directory with at least one unique free public VPN configuration file (which gives that task its own IP address)
(In practice, you need multiple free public VPN config files, simply because they’re flaky, by design, at least from vpngate they are.)

3. Select one or more of those free public VPN config files, right click to OPEN, and one will work (almost always).
(You perform your task, and when you’re done, you simply close the one working OpenVPN Daemon log window using the [F4] key.)

Of course, there are plenty of other things needed to be done for privacy (e.g., flash, java, HOSTS, MAC spoofing, panopticlick.eff.org, UserAgents, phone-home settings, etc.) but this thread is only about the simplest of use models for OpenVPN on Windows which makes use of hundreds of freely available sometimes flaky public VPN server config files (where you can’t hide from the VPN server collecting your meta data, so that’s not the goal).

PLEASE: Improvements to this KISS use model are always welcome, where your suggestions will help everyone who reads this in the future.

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by TinCanTech » Wed Jun 07, 2017 5:36 pm

Thread title

  • Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

In your case

  • Route addition failed . The object already exists

    This means you are trying to add the same route more than once

Re: What causes «route addition failed» errors on Windows 10 only & what is the fix for Windows 10?

Post by woodrock » Wed Jun 07, 2017 6:31 pm

Thank you for summarizing and keeping this thread on topic so that others, in the future, can benefit, as well as me benefiting now.
I agree with you.

Here’s a summary of the main difference between Windows XP & Windows 10:
1. In Windows XP, hitting the [X] or [F4] causes the routes added for VPN to be deleted.
2. In Windows 10, hitting the [X] does NOT cause those VPN-related routes to be deleted.
3. Luckily, in Windows 10, hitting [F4] DOES cause those VPN-related routes to be deleted.
So, clearly, the «solution’ is for me (and anyone else) to use [F4] and not [X] on Windows 10!

I probably should bone up on the Windows «arp» and «route» commands to dig deeper into WHY the OpenVPN Daemon on Windows 10 can’t close routes that Windows XP has no problem closing.

It seems, from reading that documentation, that either «route print» or «arp -a» should show that on Windows XP, the routes added by OpenVPN are deleted with both the [X] and [F4] operations, while the routes added by OpenVPN (likely) won’t be deleted on Windows 10 with the [X] operation, but they will be deleted with the [F4] operation.

I don’t know if this is a bug or a feature, or if it’s something imposed by Windows 10 that we just have to live with.
I’m not complaining since the solution is so simple (I’ll just use F4).

But, at the moment, it does seem like a bug; but maybe not because the [X] was never documented to work in the first place.

Оцените статью