A
A
Artur Gabitov2015-03-05 16:12:14
Windows
Artur Gabitov, 2015-03-05 16:12:14

How to set priority between networks with two gateways?

Good evening.
I have Windows 7
and
two Internet connections
- enterprise Internet
- Yota 4g modem.
It is necessary to make the enterprise Internet a priority and only when it disappears traffic goes through the modem.

C:\Users\Трансляционный зал 1>route print
===========================================================================
Список интерфейсов
 11...40 16 7e aa e4 83 ......Intel(R) Ethernet Connection (2) I218-V
 24...00 09 3b f0 1a 40 ......Modem Yota
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Адаптер Microsoft ISATAP
 17...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface
 19...00 00 00 00 00 00 00 e0 Адаптер Microsoft ISATAP #3
 23...00 00 00 00 00 00 00 e0 Адаптер Microsoft 6to4
===========================================================================

IPv4 таблица маршрута
===========================================================================
Активные маршруты:
Сетевой адрес           Маска сети      Адрес шлюза       Интерфейс  Метрика
          0.0.0.0          0.0.0.0     31.13.133.97     31.13.133.98    266
          0.0.0.0          0.0.0.0         10.0.0.1        10.0.0.10    276
         10.0.0.0    255.255.255.0         On-link         10.0.0.10    276
        10.0.0.10  255.255.255.255         On-link         10.0.0.10    276
       10.0.0.255  255.255.255.255         On-link         10.0.0.10    276
     31.13.133.96  255.255.255.252         On-link      31.13.133.98    266
     31.13.133.98  255.255.255.255         On-link      31.13.133.98    266
     31.13.133.99  255.255.255.255         On-link      31.13.133.98    266
        224.0.0.0        240.0.0.0         On-link      31.13.133.98    266
        224.0.0.0        240.0.0.0         On-link         10.0.0.10    276
  255.255.255.255  255.255.255.255         On-link      31.13.133.98    266
  255.255.255.255  255.255.255.255         On-link         10.0.0.10    276
===========================================================================
Постоянные маршруты:
  Сетевой адрес            Маска    Адрес шлюза      Метрика
          0.0.0.0          0.0.0.0     31.13.133.97  По умолчанию
===========================================================================

IPv6 таблица маршрута
===========================================================================
Активные маршруты:
 Метрика   Сетевой адрес            Шлюз
 23   1110 ::/0                     2002:c058:6301::c058:6301
 17     58 2001::/32                On-link
 17    306 2001:0:5ef5:79fd:384e:2d85:e0f2:7a9d/128
                                    On-link
 23   1010 2002::/16                On-link
 23    266 2002:1f0d:8562::1f0d:8562/128
                                    On-link
 17    306 fe80::/64                On-link
 17    306 fe80::384e:2d85:e0f2:7a9d/128
                                    On-link
===========================================================================
Постоянные маршруты:
  Отсутствует

These commands did not help me =(
route -p add 10.0.0.0 mask 255.255.255.0 10.0.0.1 metric 2
route -p add 31.13.133.0 mask 255.255.255.252 31.13.133.97 metric 1
or
route -p add 10.0.0.10 mask 0.0. 0.0 10.0.0.1 metric 2
route-p add 0.0.0.0 mask 0.0.0.0 31.13.133.97
metric
Tell me, please, to me a teapot in materiel .

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Birulya, 2015-03-05
@garlp

You can specify multiple default gateways, in which case Windows will iterate over them one by one. If the first fails, traffic will go through the second, and so on. The problem here is that traffic will also return to the first gateway only in case of failures, that is, 3g / 4g modems are not quite suitable for such a scenario (and it would be so beautiful), because until they, in turn, fall down, traffic so it will go through them regardless of whether the "wired" gateway has risen or not.
You can search more about Dead Gateway Detection.
As far as I know, there are no other options to build some kind of fault tolerance using standard tools in Windows.

L
ldv, 2015-03-05
@ldvldv

You can try that.
Remove permanent routes. And manually assign metrics to interfaces.
support.microsoft.com/kb/894564/en
How to change interface metrics on network adapter
or with pictures itpcnotes.blogspot.ru/2009/12/faq.html

S
slavbase, 2015-04-08
@slavbase

Automatic switching between the main and backup Internet channel
We finally have a backup Internet channel in our office. But with all obviousness the task of automatic selection of the Internet channel arose. The connection scheme is as follows: there is a server on Windows, working as a gateway (recently moved from fribsd, for no reason understood by anyone - the order of the general manager). It includes one network cable from the internal network and goes to the switch, into which, among other things, the provider's equipment is plugged. Now another piece of iron has appeared there, which is also located on the Internet and distributes it (in the common people - a router).
After some time, I gave birth to a script (batch file - aka .bat), which I simply placed in autoload and ran. Undoubtedly, this is a temporary solution, but if you need it now or even right now, and the work is another endless edge, then it will do. Below is the source code of the script for automatic switching to the backup channel:
## Author: Kostuchenko Vasiliy.
@echo off
:first_ping
Ping -n 4 -l 1 8.8.8.8>Nul
If "%ERRORLEVEL%"=="1" goto reserv
if "%ERRORLEVEL%"=="0" Echo First IP OK.
set Timer=60
ping -n %Timer% 127.0.0.1>nul
goto first_ping
:second_ping
Ping -n 4 -l 1 192.168.0.50>Nul
If "%ERRORLEVEL%"=="1" echo First IP is not response.
if "%ERRORLEVEL%"=="0" goto first
set Timer=60
ping -n %Timer% 127.0.0.1>nul
goto second_ping
:rezerv
net send The server has started switching to the backup Internet channel.
echo Reserv IP configuring. Please wait.
echo ==================================
netsh interface ip set address inet static 192.168.0.57 255.255.255.0 192.168. 0.50 1 >nul # inet - network connection name. Addresses: 1 - IP, 2 - mask, 3 - gateway.
echo IP Reconfiguring OK
netsh interface ip set dns inet static 192.168.0.17 >nul # replace primary DNS.
echo Reserv IP configure starting.
echo First DNS OK
netsh interface ip add dns inet 192.168.0.9 >nul # add secondary DNS
echo Second DNS OK
echo Reserv IP configured.
echo Testing...
Ping -n 4 -l 1 8.8.8.8>Nul
If "%ERRORLEVEL%"=="1" net send Both providers are unavailable.
if "%ERRORLEVEL%"=="0" goto second_ping
:first
echo First IP configuring. Please wait.
echo ================================
netsh interface ip set address inet static 192.168.0.58 255.255.255.0 192.168.0.51 1 >nul # inet - network connection name. Addresses: 1 - IP, 2 - mask, 3 - gateway.
echo IP Reconfiguring OK
netsh interface ip set dns inet static 192.168.0.9 >nul # replace primary DNS.
echo Reserv IP configure starting. Please wait.
echo First DNS OK
netsh interface ip add dns inet 192.168.0.17 >nul # add secondary DNS
echo Second DNS OK
echo Reserv IP configured.
echo Testing...
Ping -n 4 -l 1 192.168.0.51>Nul
If "%ERRORLEVEL%"=="1" goto rezerv
if "%ERRORLEVEL%"=="0" goto first_ping
I want to note that the availability check occurs every 60 seconds. You can change this to any time you need by changing the corresponding parameter. But too much time will make the address change irrelevant, and too little delay will give a small but unpleasant (perhaps on very bad or busy networks) delay. It's funny to talk about bytes, of course, but still.
dojuk.livejournal.com/1350.html
======================================== =====================================
Automatically switch Internet distribution from one line to another when the signal degrades or disappears possibly with Kerio WinRoute Firewall
======================================== =====================================
v2.nat32.com/index.html
======================================== =====================================
The easiest option is to use NetSetMan 4
AutoSwitch click on the light bulb it is gray inactive make a condition for example on ping + when triggered, you can hang any script
www.netsetman.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question