How To Add Routes in Windows OS.

When you have 2 or more network interfaces attached to your windows or linux machine you need to add routing for each destinations. Otherwise it will take default route of the system (destination any via default gateway). If you have only single network interface card, you dont need to think about this because only one gateway you have. See the below diagram and you need to reach 10.10.101.5 from your windows machine. You have 3 different paths and we have mentioned which one is the default gateway. As per below information, 10.10.101.5 is not in the default path. So, we need to add routes.

If you dont add routes for destination 10.10.101.5,your traffic will go through default gateway (10.28.17.1) wen you try to reach 10.10.101.5. It means that you are unable to reach 10.10.101.5. So it menas you need to say please go through 192.168.168.1 when you reach 10.10.101.15. We call this adding routings. Lets see, how to see available routing in windows. Try with below command.

Search for CMD

Right Click & Run As Administrator

Now run command route print

Output will be shown available routes

Now you need to add new route using below command.

route ADD 10.10.101.5 MASK 255.255.255.255 192.168.168.1

If add using below command route will be kept till a reboot and after a reboot route will be automatically removed from OS. So, we can add persistent routes using below command.

route -P ADD 10.10.101.5 MASK 255.255.255.255 192.168.168.1

Lets say you add above route mistakenly & now you need to remove it. You can use below command to remove a route.

route DELETE 10.10.101.5 MASK 255.255.255.255 192.168.168.1

If you need add to add routes for complete 10.10.101.0/24 block, you need edit command as below. Here you will define subnet mask.

route ADD 10.10.101.0 MASK 255.255.255.0 192.168.168.1

If you still have any problem connect with us.