Dual Internet Connections on Windows

This is a quick script I threw together to be able to route specific IP traffic (i.e. a connection to a game server) through my backup internet connection whenever I needed a low latency connection (my main high-bandwidth, high-allowance connection suffers serious congestion during peak times.)

The networks are set up like this:

NIC1 – 192.168.1.0/24 (default gateway at .1) – default gateway set to 192.168.1.1 (all traffic will go through this connection by default.)
NIC2 – 192.168.0.0/24 (default gateway at .1) – default gateway NOT set (no traffic will use this connection UNLESS we set up a route for it.)

In the code below, make sure you replace “192.168.0.1” with the gateway of your “NIC2”.


@echo off

echo Current Static Routes:
echo.
route print | find "192.168.0.1"

echo ----------------------------
set choice=
set /p choice=Add New IP Address:
echo.

route add %choice% MASK 255.255.255.255 192.168.0.1

echo.
echo ----------------------------
echo Hit enter to delete the route.
pause

route delete %choice%

Leave a Reply

Your email address will not be published. Required fields are marked *