Achievable logo
Exam preparation
Lifestyle topics
Achievable blue logo on white background
Achievable blue logo on white background

How to add a static TCP/IP route to the Windows routing table

A routing table is a set of rules, usually viewed in table format, that is used to track where data packets traveling over an Internet Protocol (IP) network will be directed. It dictates where all packets go when they leave a system. Most routers, and this includes the one built into your Windows PC, use …

Achievable blue logo on white background
add-static-tcp-ip-route-to-routing-table
Achievable blue logo on white background
Achievable blue logo on white background
Achievable SIE - $99
Pass the FINRA SIE on your first try with Achievable's online course. Includes everything you need: easy-to-read online textbook, 2,000+ review quizzes, and 35+ full-length practice exams.
Laptop displaying the Achievable exam prep dashboard and a smartphone displaying a quiz question

A routing table is a set of rules, usually viewed in table format, that is used to track where data packets traveling over an Internet Protocol (IP) network will be directed. It dictates where all packets go when they leave a system. Most routers, and this includes the one built into your Windows PC, use some form of dynamic routing, meaning that the router is capable of selecting the best place to forward packets based on information it gets from other routers. You can see it if you use the “traceroute” command to watch the connections a packet can make as it reaches its final destination.


freepik / Freepik / “Hand-drawn flat design website hosting illustration” / Freepik license

Adding a static TCP/IP route to the routing table in Windows 11, 10, 8, and 7


Most routers will allow you to add a static route–one that does not get dynamically updated–if you want to always forward certain traffic to a specific router or gateway. Generally, there is no need for this, but there are a few exceptions, for example:


You have two internet connections–perhaps one is for work–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.


You want better, more specific control over your Windows PC, which you used as a router.


You will need to dive into the Command prompt to add a static route to the Windows routing table, but it is not too difficult if you follow these steps.


View the routing table


It will be helpful to view the routing table first, so hit Command + X and select “Command Prompt (Admin)” on the Power Users menu.


At the Command prompt, type route print and hit Enter.


You should 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.


Adding a static route to the routing table


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


route add destination_network MASK subnet_mask gateway_ip metric_cost


The subnet_mask and metric_cost part of the commands are optional. Note that if you do not specify a subnet mask, 255.255.255.0 will be used automatically. Likewise, if you do not 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.


If you wanted to add a route specifying that all traffic bound for the 192.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


Now, if you were to use the “route print” command to look at the table, you should be able to find your new static route.


It is important to keep in mind that when you add a static route, it only lasts until the next time you start Windows, by default. This helps keep the table uncluttered.


How to fix this


Writing batch scripts is an option to counter the short window of time issue, and it is not too hard. But if you’re just adding one or two static routes that you don’t expect to change often, you can just add the -p option to the command to make the route persistent. A persistent route, as its name suggests, stays in place even when Windows starts up. Your command should look something like this:


route -p add 192.168.35.0 MASK 255.255.255.0 192.168.0.2


Removing a static route from the Windows routing table


To undo whatever you did above, the command mostly stays the same, except that this time, you want to delete it. Type a command using the following syntax:


route delete destination_network


Given our earlier example, if you want to delete that specific static route with that destination network, you just have to type this command in:


route delete 192.168.35.0


Overall, it is an easy process to add and remove static routes to the Windows routing table. Considering the few circumstances in which you might need to use this set of instructions, it is always an option to keep open.


Achievable blue logo on white background
Achievable blue logo on white background
Achievable SIE - $99
Pass the FINRA SIE on your first try with Achievable's online course. Includes everything you need: easy-to-read online textbook, 2,000+ review quizzes, and 35+ full-length practice exams.
Laptop displaying the Achievable exam prep dashboard and a smartphone displaying a quiz question
Achievable blue logo on white background
Related Posts
What is Google and what does it mean?
Tech

What is Google and what does it mean?

Google is an online technology firm that runs the search engine most widely used globally, commonly known by the same name. The word “Google” is commonly used as a verb meaning “Search for something on the Google search engine.” In its name, the search engine alludes to the enormous number of links it can retrieve. …

A step-by-step guide to sharing files in Windows 7 and Windows XP
Tech

A step-by-step guide to sharing files in Windows 7 and Windows XP

Sharing files between computers on a network is essential for home and office environments. If you have a home network with Windows 7 and Windows XP computers, you might want to share files and devices between them. Whether you’re working with Windows 7 or the older Windows XP, both operating systems offer built-in tools to …

Forgot your Windows password? Try Ophcrack
Tech

Forgot your Windows password? Try Ophcrack

People rely on technology now more than ever. A person’s most important files—their photos, their projects, their livelihood—can all lie behind a Windows password. But what happens when that password is lost? How do you access that important data? That’s where Ophcrack can help. Ophcrack is a free, open-source program designed to recover lost Windows …

Achievable logo
Have questions?
Earn 20% as an affiliate
Partner with Achievable to generate new revenue from your website and help people achieve their professional goals
Learn more