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

Для добавления статического маршрута в Windows, необходимо в командной строке (Пуск –> Выполнить или Ctrl+R) набираем команду
route ADD -p 10.10.0.101 MASK 255.255.255.0 192.168.1.1 METRIC 1
и нажимаем «Enter»

Пояснения:

route программа работы с маршрутами;
ADD – команда для добавления маршрута на указанный адрес. У нас на 10.1.1.1;
-p – этот ключ нужен, что бы сохранить маршрут. Если его не прописать, то после перезагрузки таблица маршрутов обносится;
10.10.0.101 – адрес назначения;
MASK – маски сети;
192.168.1.1 – адрес основного шлюза. Чаще всего это ip-адрес модема;.
METRIC 1 – параметр, определяющий приоритет указанного выше шлюза. 1- наивысший приоритет.

Проверить прописанные маршруты можно командой route print. Для этого заходим в командную строку (Пуск –> Выполнить –> cmd –> Ok). В открывшемся окне набираем команду route print

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
.

Маршруты — это сетевые установки, которые используются операционной системой для организации трифака и доступа к локальной сети и в Интернет. С помощью этой странички вы научитесь просматривать, удалять и добавлять маршруты на компьютере с ОС Windows от XP до 10. Все эти действия выполняются в командной строке или ее улучшенном и расширенном аналоге PowerShell.

Хочется также сказать о том, что если вы не уверены в своих знаниях, лучше не изменять данные настройки. Т.к. при неправильном использовании маршрутизации вы можете оставить ваш компьюетр без доступа к сети Интернет.

Просмотр маршрутов

Наберите команду

route print

persistent-routes-0011

Удаление всех статических маршрутов:

route -f

persistent-routes-0012

Добавление статического маршрута:

route -p add 0.0.0.0 mask 0.0.0.0 192.168.95.1

persistent-routes-0013

Удаляем все маршруты: route -f
persistent-routes-0015

После того, как все маршруты стёрты, естественно пропадёт Интернет. Для того, чтобы он появился вновь, необходимо задать маршрут по умолчанию. Добавляем постоянный маршрут к шлюзу:

route -p add 0.0.0.0 0.0.0.0 192.168.10.254 OK

В Windows XP/2003 Server после этого появится Интернет. Но если у вас Windows 7/8.1/или 2008/2012 Server, необходимо также выполнить команды:

ipconfig /release
ipconfig /renew

Как удалённо очистить таблицу маршрутов

Если вы хотите проделать все эти операции удалённо, вам понадобится программа NetAdapter Repair (подробнее). Дело в том, что после применения команды route -f соединение с сервером будет утрачено. А утилита NetAdapter Repair автоматически перезагрузит компьютер после очистки таблицы маршрутов. Для удалённой очистки необходимо проделать следующие действия:

1 Запустить утилиту NetAdapter Repair от имени Администратора.

2 Установить флажок возле пункта Clear ARP/Route Table.

3 Нажать кнопку Run All Selected:

NetAdapter Repair. Удалённая очистка таблицы маршрутов

После выполнения операции пойдёт обратный отсчёт времени и компьютер (сервер) перезагрузится автоматически:

persistent-routes-0022

Если что-то непонятно, спрашивайте в комментариях.

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.

  • Windows 10 долго копирует файлы
  • Windows 10 долго запускается проводник windows
  • Windows 10 долго загружается при запуске
  • Windows 10 долго загружается при включении черный экран
  • Windows 10 долго загружается при включении asus