• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 14615
  • Last Modified:

Windows, clear routing table without killing default gateway

I am remote desktopping to a Windows Server

I needed to flush the routing table to connect to a linux server, so I issued a route -f

I lost the gateway, and the remote machine had to be rebooted, which is a problem

The route table flush did do its job after the reboot, and I was able to get to the Linux server from the Windows machine

My question is:  Is there any way to flush the routing table without clearing out the default gateway value

(I can not set the default gateway after the flush, because I lose connectivity immediately after the route -f)

Thanks
0
Los Angeles1
Asked:
Los Angeles1
  • 3
4 Solutions
 
AnuroopsunddCommented:
when you give the route -f it clears all the routing information even the default gateway routing. so only solution after that is to disable/Enable network card or reboot the server.

If you know which route is the issue you can specifically remove that route instead of removing all the routing information.

1. route print  --- this will print all the route information and you can check what route you want to remove.

2. then use route delete or route update command to delete or update the existing route
 route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2
 CHANGE is used to modify gateway and/or metric only.
route DELETE 157.0.0.0


Hope this helps.
0
 
AnuroopsunddCommented:
also you can use the netroute view utility which is graphical and works same as route.

http://www.nirsoft.net/utils/network_route_view.html
0
 
n2fcCommented:
Another possibility is to write a .bat or .cmd script that does the flush and adds the gateway back in instead of only running the flush and thereby breaking your connection!
0
 
AnuroopsunddCommented:
one more option....
In you incase loose network like what you did.. you can RDP some other machine/server on the same network/subnet and then you will be able to connect to the server.
as you loose the default gateway it does not matter for local network (same subnet).
so you can RDP from that server and do what ever you require to do in case of emergency.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now