Route add постоянный маршрут windows 10

У некоторых Интернет-провайдеров иногда возникает необходимость дополнительно прописать статический маршрут. Например, для работы файлообменных сетей DC++ и torrent. Если Вы подключены через роутер, то все настройки маршрутизации делаются на нём, а на компьютере ничего дополнительно указывать не нужно.

А вот если кабель провайдера подключен напрямую в компьютер или через модем в режиме «мост»(Bridge), тогда может возникнуть необходимость прописать статический маршрут, добавив его в таблицу маршрутизации Windows. Чтобы это сделать, Вы должны запустить командную строку с правами Администратора. Для этого надо нажать  кнопку «Пуск» и выбрать  пункт меню «Программы» -> «Стандартные» -> «Командная строка», либо нажать комбинацию клавиш Win+R и ввести команду «cmd».

В открывшемся черном окне консоли нужно прописать маршруты используя команду route.

Параметры команды:
 -f          Очистка таблиц маршрутов от записей всех шлюзов.  При указании одной из команд таблицы очищаются до выполнения команды.
  -p          При использовании с командой ADD задает сохранение маршрута при перезагрузке системы. По умолчанию маршруты не сохраняются при перезагрузке. Пропускается для остальных команд, изменяющих соответствующие постоянные маршруты. 
  -4          Обязательное использование протокола IPv4.
  -6           Обязательное использование протокола IPv6.
<command>      Одна из следующих команд:
PRINT          Печать маршрута
ADD          Добавление маршрута
DELETE          Удаление маршрута
CHANGE          Изменение существующего маршрута
destination          Адресуемый узел.
MASK          Указывает, что следующий параметр интерпретируется как маска сети.
netmask          Значение маски подсети для записи данного маршрута. Если этот параметр не задан, по умолчанию используется значение 255.255.255.255.
gateway          Шлюз.
interface          Номер интерфейса для указанного маршрута.
METRIC          Определение метрики, т.е. цены для адресуемого узла.

Для примера рассмотрим три основных подсети, используемые как локальные:

192.168.0.0/16
10.0.0.0/8
172.16.0.0/16

Соответственно, Вам надо будет прописать 3 вот такие строки:

route -p add 192.168.0.0 mask 255.255.0.0 <ваш_шлюз>
route -p add 10.0.0.0 mask 255.0.0.0 <ваш_шлюз>
route -p add 172.16.0.0 mask 255.240.0.0 <ваш_шлюз>

Например, Ваш шлюз 192.168.50.1, тогда команды будут выглядеть так:

route -p add 192.168.0.0 mask 255.255.0.0 192.168.50.1
route -p add 10.0.0.0 mask 255.0.0.0 192.168.50.1
route -p add 172.16.0.0 mask 255.240.0.0 192.168.50.1

Если возникнет необходимость удалить статические маршруты — просто введите следующие команды:

route delete 192.168.0.0
route delete 10.0.0.0
route delete 172.16.0.0

Sometimes you need to create static route entries to make communication with different networks that are connected via a different gateway. A gateway is simply a network router that routes the network traffic between different networks. When you have more than one gateway (router) on your network, then you may need to implement static route technique on Windows 10/Windows 11 or Windows servers/any Operating system.

A static route will tell the Operating System to send network packets to the appropriate router instead of sending them to the default router. This simple guide shows how to add, delete and modify a static route to the routing table on Windows 11/10 and Microsoft Server Operating Systems.

There are a few useful commands you must know. Route delete, add and print. These commands will be handy to any user who has administrative access and know which router/gateway should be used for which network.

Why Add Static Route?

It mostly depends on the network setup. Usually, you can add these static routes on your default router (if it can support) or core switch. When you have this kind of proper network setup, you do not need to add a static route to each computer separately on the network. But in a few exceptional cases, you may need to implement static routes on individual computers. Here are a few examples.

  1. You have more than one internet router on the network and you need to send traffic to certain websites (based on their IP addresses) via a different router than the default gateway. Let’s say, for example, all traffic to Netflix can be sent via the 2nd internet router where other website traffic can go through the 1st internet router.
  2. There are several VLANs or subnets available on the network. Before building the proper routing table on the router or core switch, adding a static route on your Windows computer will help you to test the connectivity see the traffic flow.
  3. For network security or isolation purpose, certain routes can’t be added to the default gateway device. In this case, as a network administrator, you can add the static route on a local computer to make network communication.

Route Add on Windows 11/10 and Windows Servers

Though there are major changes and interface upgrades in the latest Windows 11, the below steps remain the same.

Make sure you run the below commands on command prompt (or PowerShell) which is opened as Administrator.

run as cmd

Here is the command to add a static route to the routing table.

route ADD destination_network MASK subnet_mask  gateway_ip metric_cost
route add 10.10.10.0 mask 255.255.255.0 10.10.29.1

It indicates that any packets to 10.10.10.0 (in class C – 255.255.255.0) network should be forwarded to the 10.10.29.1 router (gateway).

Obviously, the PC/server in which we run this command is in the 10.10.29.0/24 network because it should communicate to the gateway from the same network.

The issue with the above command is when you shut down or restart the computer, these route entries will be removed. To make it permanent and add to the Windows OS routing table, we should use the –p key with the add command. So, adding a persistent (or permanent) static route on Windows 10 command will be like this;

route add –p 10.10.10.0 mask 255.255.255.0 10.10.29.1

Route Print

Route print command is another useful command to view the entries on the routing table and which routes are active at the moment.  If you need to modify an entry that is already in the routing table, better to confirm the entries before changing. To do it, use the route print command.

Route print

route print command Windows

Also, we can view the persistent routes in a Windows OS by checking the following registry path. Look for the entries in this area before or after modifying any routing table entries.

HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet-> Services->Tcpip->Parameters->PersistentRoutes

Route Delete on Windows 11/10 & Windows 2022/2019/2016 Servers

The below command is to delete an existing persistent route from a computer. Even though we added a route entry with the network, network mask and gateway, but to delete, we need to mention the network only. So, it goes like this;

route delete 10.10.10.0

That will delete the 10.10.10.0 route entry from the computer. You do not need to restart the computer to take effect. Adding and deleteting route entries take effect instantly.

Let’s say that after the recent network change, now the network 10.10.10.0 should be routed through the 10.10.29.200 gateway. Obviously, you have to modify the existing route for this network and change the gateway to 10.10.29.200.

So, how to modify the existing route entry? You can’t modify an existing entry.

The simple method is to delete it and add the new entry. So, in this case, you would perform the below commands.

Route delete 10.10.10.0

Route add –p 10.10.10.0 mask 255.255.255.0 10.10.29.200

We hope this simple guide is helpful in understanding the route add, delete and print commands in Windows 10/Windows 11 client PC and other server Operating Systems. Make sure you open the command prompt or PowerShell as Administrator to perform these commands. If you want to use cosmetic variables to identify the fast hops to reach a network, you can use the metric key as described at the Microsoft site here.

add static route windows

Adding a static route in Microsoft Windows 10 or Server is done by using the route add command.

The following is the general syntax of the route add command we need to follow to add a permanent static route in Windows:

route add -p <destination> mask <subnet-mask> <gateway>

For example, the following route command tells the windows to add a new persistent route to the 192.168.1.0/24 network, using 10.0.0.1 as the gateway to reach the network.

route add -p 192.168.1.0 mask 255.255.255.0 10.0.0.1

When you want to add a static route to a single host, use the netmask 255.255.255.255.

For example, the following command adds a static route to the destination host 192.168.1.100 with the gateway address 10.0.0.1.

route add -p 192.168.1.100 mask 255.255.255.255 10.0.0.1

The most important part of the route add command is the -p option. Without the -p switch, our new route would not be persistent. It will disappear the next time you reboot your Windows PC/Server.

We can print the windows routing table using the route print command. Under the Persistent Routes header, you will see the list of permanent static routes.

Windows routing table

Routing Table

Following is another static route example with a metric value:

route add -p 192.168.1.0 mask 255.255.255.0 10.0.0.1 metric 5

In case if you have more than one network interface, you could also specify the interface ID using the if command option.

route add -p 192.168.1.0 mask 255.255.255.0 10.0.0.1 if 1

When specifying the network interface, you have to provide the interface ID which you can find using the route print command.

Route Add Windows Command to Add Persistent Static Route in Windows

Windows hold permanent static routes in the following registry
location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi
ces\Tcpip\Parameters\PersistentRoutes
.

In this article, we will look at what a ‘static route’ is and why it should be added at all. We will use the so-called ‘Root’ — meaning we will prescribe routes using the ‘route add’ command in the Windows command line. Let’s recap the theory and in what cases using the ‘route add’ in this way may be useful for you.

‘Static routing’ is a type of routing in which routes are explicitly specified when configuring a router. All routing occurs without the participation of any routing protocols.

A ‘static route’ is an administrator-defined route causing packets that move between the source and destination to go along the specified path. It is an explicitly indicated path that a packet must travel from point A to point B.

Why do we need to be able to add static routes? It is very common for security to use Virtual Private Networks (VPN). VPNs are used both by organizations — for the organization of their secure networks — and by providers — to provide access to the global Internet to simple users. This sometimes causes minor inconveniences, however, to organizations and among ordinary users.

For example, if you have two computers at home, the first of which has access to the Internet via VPN, it is also connected to the second computer’s local network. Every time it connects to the Internet, the connection between the two computers is lost because the first computer (the one connected to the VPN) is already on another network and therefore unavailable to the second computer. This can be corrected just by configuring a static route.

Routes are network settings that are used by the operating system for organizing network traffic, as well as accessing the local network and the Internet. With help of the information on this page, you will learn how to view, delete, and add routes on a computer running a version of Windows — from XP to 10.

1. View Active Routes in Command Prompt Tool

To simply see the routing table on your computer, type the following at the command prompt Start Run cmd:

route print

2. How to Remove All Static Routes

This is done in the following way: run the command line and type the following command:

route -f

3. Add Static Route in Command Line Shell

To add a static IP route, in the command line running as administrator, enter the command:

route -p add 0.0.0.0 mask 0.0.0.0 192.168.95.1

Where:

  • route the program itself that works with the routing table;
  • -p is a key that says that the route will be permanent, because (Important note!) without this key, all routes that you add will be deleted after rebooting, so if you want to use the route always, write this key if only once, then you can not write;
  • add the command itself that adds an entry to the routing table;
  • 0.0.0.0 the network with which you want to have a connection;
  • mask 0.0.0.0 subnet mask;
  • 192.168.95.1 the gateway address, usually the modem address.

4. How to Remove Specific Static Route

To remove static route open command line and type this command:

route delete 0.0.0.0 mask 0.0.0.0 192.168.95.1

How to Manage Static Route with Action1

The first thing you need to do is login to the Action1 dashboard.

Next, on the left side menu, select the Managed Endpoints item and mark the endpoint for which you want to block the port.

Then click on the More Actions button and select the Run Command option.

In the window that opens, enter the command route -p add 0.0.0.0 mask 0.0.0.0 192.168.95.1 to add a static route you need.

In case you need to delete a route use this command route delete 0.0.0.0 mask 0.0.0.0 192.168.95.1

After clicking the Next Step button, you need to select the endpoints for which you are going to add or remove static route. To do this, click Add Endpoints and select the desired endpoint.

Click Next Step and in the next step you can schedule the execution time of your command. Then click Finish.

Consider Using Action1 Cloud RMM Solution

Action1 allows IT professionals to efficiently manage configurations for computers within and outside the local network. In addition, the platform offers total control of patch management, software distribution, remote desktop, as well as many other features to run your IT security and administration as seamlessly as possible.

Add a Static TCP/IP Route to the Windows Routing Table

Here’s a best way to add a static route to the Windows Routing Table, make route persistent and delete static route from the Routing Table via Command Prompt.

Inside Article:

  • Open Command Prompt
  • route print Command in Windows
  • route ADD Command to Add a Static Route to the Windows Routing Table
  • Make a Static Route Persistent
  • Delete a Static Route from the Windows Routing Table
  • FAQs

A routing table is the one that performs routing of the packets or simply indexing of multiple routes with the instructions where all these packets will go when they leave a system. Whether it’s a physical router or a PC.

Most of the routers, including the built-in Windows PC router, use dynamic routing. As the router is an intelligent device and it selects the best route while sending packets.

You can look out everything in-depth detail with the “traceroute” command that will show you all the connections a packet makes and finally reaches its final destination.

Let’s try to understand somehow, what is a static route?

 A static route is the one, which is not updated dynamically.

Sometimes you want to add some certain traffic from your company/home router or gateway then we add a static route.

Almost all the routers allow us to add a static route to pass certain traffic.

Most people use windows PC at home just like me and want to add a static TCP/IP route to the Windows Routing Table.

For this, let’s take a scenario

You have two internet connections, one is for your regular use and the other is for official working. Now you want to send/receive some traffic to a certain IP address range using only one internet connection.

You also have done subnetting on your network and want to send traffic to a certain subnet.

Then static routes are most useful in such a testing environment.

You also want your Windows PC should be used as a router for your network and you want an overall control over it.

If you are facing any of the above situations then this article is for you.

Stay with me!

We will simply use the command prompt to add a static route to the Windows routing table.

How to View the Windows Routing Table

Before starting to add a static TCP/IP route to the Windows Routing Table, it is necessary for judgment to view the routing table first.

For this

  • Open up Command Prompt or hit Windows+X
  • Select Command Prompt (Admin)

how to add route in windows 7

Note:- If you see PowerShell, instead of Command Prompt on the power user menu, then you don’t need to worry about it, you can use PowerShell as you use the command prompt. The functionality of both is the same.

[su_highlight]You can also open a command prompt via short keys: (Windows Key + x + c)[/su_highlight]

After opening the Command Prompt, go ahead and type the following command and hit Enter:

[su_highlight]route print[/su_highlight]
You will be followed by:
add static route windows server 2012 r2

The output is divided into three sections:

  • Interfaces List
  • IPv4 Route Table
  • IPv6 Route Table

The Interface List comprises all your interfaces by MAC address while the IPv4 Route Table and IPv6 Route Table point to the Dynamic and persistent routes.

As you can see the list of the network with destinations and the default gateways in the above Windows PC routing table to which packets are forwarded whenever they are sent to some destination.

It is the default gateway which forwards all type of information to specific destinations.

Now let’s add a static TCP/IP route to the Windows Routing Table

Add a Static Route to the Windows Routing Table

To add a route we use the route ADD command in Windows 10 or other Windows versions that tell the Windows which Network to add and then we enter the Subnet mask and Gateway.

To add a static route to the table, You need to type the following command according to the syntax.

[su_highlight]route ADD destination_network MASK subnet_mask gateway_ip metric_cost [/su_highlight]

The above command in a more simple way:

[su_highlight]route ADD to this network with this mask via this gateway IP[/su_highlight]

The subnet mask and the “cost metrics” are optional to the command. If you do not mention the subnet mask then it will automatically take a Class C subnet mask that is 255.255.255.0.

Also, if you do not provide metric cost, a cost one greater than the 0.0.0.0 destination entry will be used

The cost metric value is used when Windows has to decide to select the best path among all the routes pointing towards the same destination.

Example:

Let’s suppose we’re on the 192.168.0.0 network whose default gateway is 192.168.0.3 and we want to add a static route to one of our management VLAN located on the 192.168.20.0 network.

Assuming our subnet mask is 255.255.255.0

Or in a more convenient way:

We want to add a Static Route to the Windows Routing Table saying that all the traffic should merge at 192.168.20.0 subnet through the gateway 192.168.0.3 with the automatic metric cost.

Then we could add a route like this:

[su_highlight]route ADD 192.168.20.0 MASK 255.255.255.0 192.168.0.3[/su_highlight]

Where

192.168.20.0 is the Network

255.255.255.0 is the Subnet Mask

192.168.0.3 is the Default Gateway

Now hit the Enter

route add windows 10

Now, again give route print command to see your windows routing table again, you will see a new static route to the table

[su_highlight]route print[/su_highlight]

route add command in windows 7

where 192.168.20.0 is the network destination, 255.255.255.0 is the network mask specifying class C IP address and 192.168.0.3 is the default gateway or the router’s IP address with 56 metric cost.

That’s it

You have added a Static Route to the Windows Routing Table.

But there is something necessary and you can’t skip that:

When you add a static route in Windows 10, with by default behavior its session ends until the next restart of your Windows PC. This means when you will restart the computer the added static route will poof.

That is why many major companies use a coordinated list of static routes that are often updated.

Instead of adding static routes every time on every machine, they use a batch script file that adds all the latest routes at the time of Windows startup. This technique keeps the windows routing table stable and organized.

You can write the batch script with your own hands. Because writing a script is an easy job to do.

But if your network is so small or you are a home user and you want to add just a few static routes to your windows routing table then you can add the –p option to the command to make the route persistent.

Now you might be wondering that how do I permanently add a route in Windows that should be consistent even I restart my computer?

How to Make a Route Persistent?

What is Persistent Route?

A persistent route is the one, which stays in place when the windows startup or when you Reboot the Windows.

And to make a static route persistent you need to add “-p identifier ” at the start or at the end in the Windows route add interface.

Here’s how you can add a persistent route in the Windows routing table and make that static route constant.

Syntax to add persistent route Windows

[su_highlight]route ADD to this network with this mask via this gateway IP -p[/su_highlight]

[su_highlight]route -p ADD 192.168.20.0 MASK 255.255.255.0 192.168.0.3 [/su_highlight]

You can also use -p identifier at the end of the Windows route add interface command like this:

[su_highlight]route ADD 192.168.20.0 MASK 255.255.255.0 192.168.0.3 -p [/su_highlight]

How do I permanently add a route in Windows? what is persistent static route in the windows routing table

How to Delete a Static Route from the Windows Routing Table

Once you add a static route to the windows routing table, it can be easily deleted. Because in the future, maybe you don’t need it and you have to remove it.

then here is how to delete a static route from the windows routing table.

Syntax:

[su_highlight]route delete destination_network [/su_highlight]

So, this is the static route, 192.168.20.0, we have just added to the windows routing table, now let’s delete it by entering the following command at the command prompt.

[su_highlight]route delete 192.168.20.0 [/su_highlight]

how to delete a static route from the windows routing table

Let’s check with the “route print”  command in the command prompt either the route has been deleted or not?

how to delete a static route from the windows routing table 2

That’s it

You can see the above table there is no static route entry because it has been deleted with the typed command.

Static routes are used for testing and other multiple-purpose at home or in every small and large scale organizations networks. Use it with your own consent.

See Also:

  • How To Restart Windows’ Explorer.Exe Using Taskbar And Start Menu
  • How to Add Control Panel Shortcut to Windows 10 Right Click Menu
  • How to Take Screenshot of Complete Webpage With One Click
  • How To Make Adobe PDF And Sumatra PDF Readers To Restore Last Opened Files
  • How To Access The Most Recently Opened Documents In MS Word

FAQs: Add Routes, Delete Routes, View and Clear All Routes

  1. What is Route add command in Windows?

The Rout add command is used to add a static route to the windows routing table which tells the Windows which Network to add. Also, we need to add Subnet Mask and the Gateway.

Here is the route add command in Windows 10:

route ADD this Network with this Subnet-Mask via this Gateway IP.

  1. How do I add a persistent route in Windows 10?

When you add a static route to the windows 10, it remains active until you restart your computer. After restart the static route disappears this is why you need to add a persistent route in Windows 10 so that it remain permanent.

Syntax add a persistent route in Windows 10?

route ADD this Network with this Subnet-Mask via this Gateway IP –p

Where –p is the modifier to make the added route permanent

  1. How do I setup a static route?

Here is how you can setup a static route in Windows

[su_highlight]route ADD destination_network MASK subnet_mask gateway_ip metric_cost [/su_highlight]

  1. How do I view a route table in Windows?

To view a route table in Windows, just open Command Prompt with the following command: [su_highlight](Windows Key + x + c)[/su_highlight]

Then enter the following Rout Print command

[su_highlight]route print[/su_highlight]

  1. How do I change the metric route in Windows?

Route.exe Change Tool in Windows

The route.exe tool is used to change the metric route in Windows. When we talk about metric route we mean metric of an adapter. It has limitations that you cannot set any metric number lower than the current metric value.

Suppose the IP for the Ethernet adapter is 192.168.2.5. Now let’s just change the metric route in Windows using Route.exe tool.

To increase the metric for an Ethernet adapter with an IP of 192.168.2.5, the command syntax is:

[su_highlight] route.exe CHANGE (Network Destination) MASK (Network Mask) (Interface IP) METRIC (NUMBER) IF (INTERFACE NUMBER) [/su_highlight]

Now let’s execute the command

  • Open the Command Prompt by (Windows Key + x + c) and type the following command
  • [su_highlight] exe change 0.0.0.0 mask 0.0.0.0 192.168.2.5 metric 5 IF 7 [/su_highlight]

The metric for the Ethernet adapter will become 25.

  1. How do I permanently add a route in Windows?

See the answer in the question no. 2

  1. How do I view a persistent route in Windows?

To view a persistent route in Windows just type “rout print” command in the command prompt.

Now go to the “Persistent Rout” section where you can view the persistent route.

  1. How to Delete Persistent Route in Windows?

To remove or to delete persistent route entry type the following command

 route -p delete 192.168.20.0

  1. What command do you use to display the routing table on a local system?

Open the Command Prompt and type the either one of the following commands

“netstat” –r or “route print”

  1. How to clear All Routes in Windows

You can delete all routes in windows by the following commands

  • route print

View all routes in windows (all versions)

You can see a list of 16 active networks and their routes here. Now let’s delete all routes in windows

Type the following Command

[su_highlight]route delete 192.168.16.0 mask 255.255.255.0 192.168.15.100[/su_highlight]

how-to-clear-active-routes-in-windows-10

Now type “route print”

Now you can see all the routes in the windows routing table are deleted by the command

delete-active-routes-in-windows-7

Final Words

We have learned “how to add a static TCP/IP route to the Windows Routing Table” and also how to delete a static route from the windows routing table.

Share it with your friends and your thoughts with us through the comments section that how it was helpful for you.

  • Root spaceport windows 10 скачать драйвер 64 bit
  • Rsat for windows 10 21h2
  • Route add windows что это
  • Rsat active directory windows 10 x64
  • Root spaceport 0000 драйвер windows 10