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

Route Table Header

In some specific types of environments, you might find it useful to add a static route to the routing table. Here’s how to go about it in Windows 11, 10, 8, and 7.

RELATED: How to Use Traceroute to Identify Network Problems

What Are Routing Tables?

A routing table dictates where all packets go when they leave a system — whether that system is a physical router or a PC. Most routers — including the one built into your Windows PC — use some form of dynamic routing, where the router is capable of selecting the best place to forward packets based on information it gets from other routers. You can see it at work if you use the traceroute command to watch the connections a packet makes as it reaches it’s final destination.

Most routers also allow you to add a static route (one that doesn’t get dynamically updated) if you want to always forward certain traffic to a specific router or gateway. Why? Well, most people using Windows in their home or small business probably won’t — but this can be useful under certain circumstances, such as:

  • You have two internet connections — maybe one for regular use and one for connecting to a work network — and you want all traffic to a certain IP address range to go out over one of those connections.
  • You have set up multiple subnets on your network and need to direct traffic to a particular subnet. Static routes can be particular useful in testing these types of environments.
  • You’re actually using a Windows PC as a router for your network and you want finer control over it.

If any of those apply to you, read on. You’ll need to dive into the Command Prompt to add a static route to the Windows routing table, but it’s easy and we’ll walk you through the steps.

View the Windows Routing Table

Before you get started adding routes, it may be helpful to view the routing table first. Fire up Command Prompt by hitting Windows+X and then selecting “Command Prompt (Admin)” on the Power Users menu.

Run Command Prompt as an Administrator through the Poweruser Menu.

Note: If you see PowerShell instead of Command Prompt on the Power Users menu, that’s a switch that came about with the Creators Update for Windows 10. It’s very easy to switch back to showing the Command Prompt on the Power Users menu if you want, or you can give PowerShell a try. You can do pretty much everything in PowerShell that you can do in Command Prompt, plus a lot of other useful things.

RELATED: How to Put the Command Prompt Back on the Windows+X Power Users Menu

At the Command Prompt, type the following command and hit Enter:

route print

You’ll see a long list of network destinations and the gateways to which packets are forwarded when they are headed to that destination. Unless you’ve already added static routes to the table, everything you see here will be dynamically generated.

Add a Static Route to the Windows Routing Table

To add a static route to the table, you’ll type a command using the following syntax:

route ADD destination_network MASK subnet_mask  gateway_ip metric_cost

The subnet_mask and metric_cost components are optional to the command. If you don’t specify a subnet mask, 255.255.255.0 will be used automatically. If you don’t specify a metric cost, a cost one greater than the 0.0.0.0 destination entry will be used. The metric cost value is just a cost that is relative to other costs in the table and is used when Windows decides between multiple routes that could reach the same destination.

So, for example, if you wanted to add a route specifying that all traffic bound for the 192.168.35.0 subnet went to a gateway at 192.168.0.2 and you just wanted to use the automatic metric cost, you would use the following command:

route ADD 192.168.35.0 MASK 255.255.255.0 192.168.0.2

If you were to use the route print command to look at the table now, you’d see your new static route.

Type

That’s all easy enough, but there is one extra little catch. When you add a static route, by default it only lasts until the next time you start Windows. The reason for this is that many companies use a coordinated list of static routes that gets updated fairly often. Rather than adding and updating all those routes on every machine, they just distribute a batch script file that adds the newest routes during Windows startup. This keeps the routing table relatively uncluttered.

RELATED: How to Write a Batch Script on Windows

You could certainly use the batch script method yourself. Writing batch scripts isn’t hard. But if you’re just adding one or two static routes that you don’t expect to change often, you can instead just add the -p option to the command to make the route persistent. A persistent route stays in place even when Windows starts up. Using the same command we used earlier, you could make that route persistent with the following modification:

route -p ADD 192.168.35.0 MASK 255.255.255.0 192.168.0.2

Adding

Remove a Static Route from the Windows Routing Table

Of course, there will come a time you might want to remove a static route from your table. All you have to do is type a command using the following syntax:

route delete destination_network

So, to delete the route we created earlier with the destination network 192.168.35.0, all we’d have to do is type this command and hit Enter:

route delete 192.168.35.0

Type


Yes, using static routes is a bit esoteric when it comes to managing most home and small business networks. But if you do need to do it, it’s a pretty easy process. And if you don’t need to do it right now, at least you know it’s an option in the future.

Note: This article have been indexed to our site. We do not claim legitimacy, ownership or copyright of any of the content above. To see the article at original source Click Here

Related Posts
Mazda: Having your own electric car is not bad if you have a second car thumbnail

Mazda: Having your own electric car is not bad if you have a second car

30.12.2021 Im kommenden Jahr will Mazda eine Plug-in Hybrid-Version des MX-30 herausbringen. Das E-Auto MX-30 von Mazda ist aufgrund seiner bescheidenen Reichweite für viele Besitzer*innen eine Enttäuschung. Der japanische Autobauer scheint das mit einem Schulterzucken hinzunehmen und meint nun, dass der Wagen für jene Käufer*innen geeignet sei, die zusätzlich über ein Zweitauto für längere Strecken…
Read More
Boeing opens 767BCF refurbishment project in China in 22 years in Guangzhou thumbnail

Boeing opens 767BCF refurbishment project in China in 22 years in Guangzhou

 ボーイングは現地時間9月28日、旅客機の767を貨物機に転用する767-300BCF(ボーイング・コンバーテッド・フレーター)について、中国・広州のGAMECO(広州飛機維修工程有限公司)に改修ラインを2本、2022年に開設すると発表した。GAMECOには737を転用する737-800BCFの改修ラインを備えており、両機種の改修に対応した初のMRO(整備・修理・分解点検)事業者となる。 中国で改修事業を始める767-300BCF(ボーイング提供)  767-300BCFは、旅客機として運航していた機材をボーイングが貨物機に改修するもの。旅客機の客室にあたる「メインデッキ」前方左側に大型ドアを追加するなどの改修が行われ、航続距離は約3300海里(6111.6キロメートル)、貨物積載量は約51トンとなる。  ボーイングは、今後20年間の旅客機から貨物機への改修需要は1720機を見込んでいる。このうち520機は767などのワイドボディ機で、アジア向けが40%以上を占めると予測している。  中国で767-300BCFの改修ラインを備えるのは、GAMECOが初となる。GAMECOは2020年10月に737-800BCFの改修ラインを稼働しており、今年2月には3本目の改修ラインを増設する計画を発表している。 関連リンクFreighters(Boeing) ・ボーイング、737BCFの改修事業拡大 コスタリカに新施設(21年5月6日) ・新型コロナで退役機年5%以上に ボーイング予測、貨物堅調も777BCF計画なし(21年2月26日) ・GEとIAI、777-300ERを大型貨物機に改修 ジャンボ後継777-300ERSF、22年リース開始(20年8月6日) ・就航15周年迎えた貨物専用機 写真特集・ANAカーゴ767-300F(17年8月27日)
Read More

Archaeologists have found the oldest footprints of man so far

Prevádzkovatelia parku našli prvé odtlačky už v roku 2009 vo vyschnutom jazere v národnom parku White Sands. Nepopierateľný dôkaz Vedci z americkej geologickej služby (USGS) ale len nedávno analyzovali semienka zachytené vo skamenelinách a zistili, že ich približný vek je asi 22 800 až 21-tisíc rokov. Zistenia môžu pomôcť objasniť záhadu, kedy do oboch Amerík…
Read More
This Basic Skincare Routine Won't Overwhelm You thumbnail

This Basic Skincare Routine Won’t Overwhelm You

Photo: popcorner (Shutterstock)As someone who has done little more than wash with Target-brand face cleanser and use $4 Suave lotion on my face for the better part of four decades, when it comes to skincare, I’m no guru. Through a mix of cluelessness, willful ignorance, and a little luck, I didn’t need to understand proper…
Read More
Index Of News
Consider making some contribution to keep us going. We are donation based team who works to bring the best content to the readers. Every donation matters.
Donate Now

Liking our Index Of News so far? Would you like to subscribe to receive news updates daily?

Total
1
Share