Setting Route Depending on Destination Network


I've a machine with 2 LAN cards

I'd like it to access the Internet via the gateway.
I'd like it to able to access both LAN segments 192.168.0.x and 10.x.x.x but I'd also like any traffic to the hosts to to go via the gateway.
I want to make it *impossible* for the machine to connect to Internet hosts via the gateway unless they in the range above.  Even if the gateway is down.

The routes need to persist even if the machine gets rebooted.

What do I have to do to get this setup?

My current routing table is this:

0x1 ........................... MS TCP Loopback interface
0x2 ...00 02 e3 03 e3 ba ...... NETGEAR FA311/312 PCI Adapter
0x3 ...00 a0 c9 c8 08 27 ...... Intel(R) PRO Adapter
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
       1       1       1       1       1       1       1       1       1       1       1
Default Gateway:
Persistent Routes:


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


c:\>route delete mask
c:\>route add mask -p
c:\>route add mask -p

bendeckoAuthor Commented:

The command...

route delete mask

will delete both my extra-network outbound routes?

What is preventing the route re-appearing after a reboot?


bendeckoAuthor Commented:
How can I verify what route a packet is taking.

TRACERT gives loads of timeout now.  Maybe because the in between hops are going through the wrong gateway?

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

>What is preventing the route re-appearing after a reboot?
Nothing if you get your IP dynamically. You can go into TCP/IP properties and make sure it is not listed there..
The only way to verify if to do traceroute. As long as your next hop shows as the, there is nothing you can do about the ones in between, and not all of them will respond.
bendeckoAuthor Commented:
The route is given dynamically by DHCP.

Obviously I need that interface to access that LAN subnet from this machine.

If  I put in manually then remove the route will that persist over reboots?

If you use the -p option to make each entry permanent, then after a reboot, you may still have to remove the default to, or at least give it a higher metric.
You could create a little batch file and keep it on the desktop to execute after you reboot.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bendeckoAuthor Commented:
Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.