• ARTICLES
SEARCH

How-To Geek

Adding a TCP/IP Route to the Windows Routing Table

The Routing table dictates where all packets go when they leave your system. On most environments, all packets that leave your system will be forwarded over to your router or hub, and from there out to the internet.

In some circumstances, you may have a testing network configured to duplicate another environment, or you may be configuring a more complex network topology that requires the use of additional routes. Adding routes to your machine is a useful testing tool for some of these situations.

Syntax:

route ADD xxx.xxx.xxx.xxx MASK xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx

Means:

route ADD “network” MASK “subnet mask”  “gateway ip”

For example, if you were on the 192.168.1.0 network, and you had a gateway on 192.168.1.12 configured to access the 10.10.10.0/24 network, you would use a route add statement like this:

route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12

Your routing table should now reflect that change, and all traffic to the 10.10.10.x range will now be sent over to the gateway machine.

The route add change will only stick across reboots if you add it with the -p flag, as in the following:

route -p ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/13/06

Comments (14)

  1. wan

    I’ve a few question and Need help.
    1) Where is right place to put that network route statments on suse 9
    2) How to make auto route scripts so that, i don’t need to up manually this routing on suse9.

  2. Graham Allen

    Nice intro into adding static routes.
    Do you have any other articles on TCP/IP?
    If not, I have a detailed document that explains TCP/IP and routing I would be happy to email you to post on your site. I had to create this a while ago for training in my company.

  3. Drowles

    I had to put the -p at the end in order to get the registry updated.
    All the help docs that I found show it at the beginning ?*&%??
    route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.12 -p

  4. camil7

    Thanks for the hint. Saved the day for a windows newbie :)

    By the way: removing routes (e.g. in case of typos) works as well as:

    route delete “network”

    e.g. to remove the route for 10.10.10.0 one types in

    route delete 10.10.10.0

    Ok, and “route help” even gives help, e.g. “route print” to show the routing table (actually the same output as “netstat -nr”)

  5. Hitesh Sakre

    i HAVE THREE SITE. (Hongkong, Chennai and Mumbai)Chennai and mumbai ARE CONNECTED TO mpls vpn and HK uesr are in Firewall VPN. suppose i want to access HK user desktop. what route i have to add in chennai route and HK firewall.

  6. Shamshad Khan

    Hi Hitesh,

    If your problem is still not resolved let me know the way to talk to you.

  7. hanu

    thanks a lot really very usefull……..

  8. sjbascom10

    how do i set up a toshiba ip cam
    ikwb02a

  9. just some guy passing by

    >sjbascom10
    >how do i set up a toshiba ip cam
    >ikwb02a

    taking the old stab in the internet darkness on this one bud?

  10. SuB

    Thanks man. It works great.

    Note: Run “cmd” as administrator if you received “The requested operation requires elevation” error.

    I have been used this command to access to local network when I am connected to VPN server and that works.

  11. jeff

    Also to add a route to another network from the same physical device (eth0 in this example) you can:
    route add -net 192.168.1.0 netmask 255.255.255.0 dev eth0

    In this example eth0 is DHCPd as 192.168.123.456 and I have added a route to the 192.168.1 network so I can communicate with a device at 192.168.1.200.

  12. Toph Payas

    route add 192.168.1.0 mask 255.255.255.0 192.168.3.241 -p
    what if route router 192.168.3.241 is down, as a backup i have an IPSec configured. my concern is the routing doesn’t detect if there’s a network problem, is there a way to automatically shift all the traffic to the IPSec?

  13. zoo plado

    Hello, is it possible to edit my routing table so that I access a different route towards a gaming server, instead of the route my ISP is giving me? How?

  14. TopNach

    I ran the route ADD -p command and it worked but I am having a problem with one of the PCs. Every time the PC is turned off and turned back on, it is dropped from the routing table. Any idea of what setting is causing this?

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!